Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append random id to log files so they get ignored during git-diff #285

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/jit-analyze/jit-analyze.cs
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ class ScriptResolverPolicyWrapper : ICommandResolverPolicy
// There are files with diffs. Build up a dictionary mapping base file name to net text diff count.
// Use "git diff" to do the analysis for us, then parse that output.
//
// "git diff --no-index --exit-code --numstat" output shows added/deleted lines:
// "git diff --no-index --diff-filter=M --exit-code --numstat" output shows added/deleted lines:
//
// <added> <removed> <base-path> => <diff-path>
//
Expand Down
6 changes: 5 additions & 1 deletion src/jit-dasm-pmi/jit-dasm-pmi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,13 @@ void AppendEnvironmentVariableToPmiEnv(string varName, string varValue)
// Generate path to the output file
var assemblyFileName = Path.ChangeExtension(assembly.Name, ".dasm");
var dasmPath = Path.Combine(_rootPath, assembly.OutputPath, assemblyFileName);
var logPath = Path.ChangeExtension(dasmPath, ".log");

// Create logs in seperate folder so they don't get picked up by "git diff"
kunalspathak marked this conversation as resolved.
Show resolved Hide resolved
var logPath = Path.Combine(Path.GetDirectoryName(dasmPath) + "logs", assemblyFileName);
logPath = Path.ChangeExtension(logPath, ".log");

PathUtility.EnsureParentDirectoryExists(dasmPath);
PathUtility.EnsureParentDirectoryExists(logPath);

AppendEnvironmentVariableToPmiEnv("COMPlus_JitStdOutFile", dasmPath);

Expand Down
8 changes: 6 additions & 2 deletions src/jit-dasm/jit-dasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,19 @@ public void GenerateAsm()
}

string dasmPath = null;
string logPath = null;
if (_rootPath != null)
{
// Generate path to the output file
var assemblyFileName = Path.ChangeExtension(assembly.Name, ".dasm");
dasmPath = Path.Combine(_rootPath, assembly.OutputPath, assemblyFileName);

// Create logs in seperate folder so they don't get picked up by "git diff"
kunalspathak marked this conversation as resolved.
Show resolved Hide resolved
logPath = Path.Combine(Path.GetDirectoryName(dasmPath) + "logs", assemblyFileName);
logPath = Path.ChangeExtension(logPath, ".log");

PathUtility.EnsureParentDirectoryExists(dasmPath);
PathUtility.EnsureParentDirectoryExists(logPath);

AddEnvironmentVariable("COMPlus_JitStdOutFile", dasmPath);
}
Expand All @@ -544,8 +550,6 @@ public void GenerateAsm()

if (_rootPath != null)
{
var logPath = Path.ChangeExtension(dasmPath, ".log");

// Redirect stdout/stderr to log file and run command.
using (var outputStreamWriter = File.CreateText(logPath))
{
Expand Down