Git integration question
Git integration question
Why does https://www.prestosoft.com/edp_versioncontrol.asp recommend setting merge.trustExitCode to false?
Re: Git integration question
We don't use git so this was based on recommendations from multiple users.
psguru
PrestoSoft
PrestoSoft
Re: Git integration question
From the documentation of git's diff tool integration:
And the merge tool integration:difftool.trustExitCode
Exit difftool if the invoked diff tool returns a non-zero exit status.
See the --trust-exit-code option above for more details.
--[no-]trust-exit-code
git-difftool invokes a diff tool individually on each file. Errors reported by the diff tool are ignored by default. Use --trust-exit-code to make git-difftool exit when an invoked diff tool returns a non-zero exit code.
git-difftool will forward the exit code of the invoked tool when --trust-exit-code is used.
So it basically depends on when EDP returns an error code.If the custom merge tool correctly indicates the success of a merge resolution with its exit code, then the configuration variable mergetool.<tool>.trustExitCode can be set to true. Otherwise, git mergetool will prompt the user to indicate the success of the resolution after the custom tool has exited.
mergetool.<tool>.trustExitCode
For a custom merge command, specify whether the exit code of the merge command can be used to determine whether the merge was successful. If this is not set to true then the merge target file timestamp is checked and the merge assumed to have been successful if the file has been updated, otherwise the user is prompted to indicate the success of the merge.
Re: Git integration question
Well, since EDP does return exit code, we'll change the page to have "trustExitCode true".
psguru
PrestoSoft
PrestoSoft
Re: Git integration question
Actually, from reading the help page, it appears that the original suggestion was correct.
EDP returns a non-zero exit code in cases where no error occurred.Comparison Exit Codes
0 identical files or directories
1 different files or directories
2 an error occurred
Merging Exit Codes
0 no conflicts
1 some conflicts were found
2 an error occurred
Re: Git integration question
Unfortunately, I am having another issue.
Running the following
Displays a directory comparison as expected, but then I start getting incessant pop-ups that files got changed prompting to re-compare the directories. Indeed, many of the displayed files start changing to italics as if they are getting changed, but not all of them.
Interestingly, when I clicked on a line to open a file comparison, and waited, I got a notification for that file in directory comparison window, but did not get any notification in the file comparison window, suggesting that the file did not actually change.
Is it possible to disable the external change monitoring via a command-line switch?
Running the following
Code: Select all
git difftool --dir-diff <some branch> <some other branch>
Interestingly, when I clicked on a line to open a file comparison, and waited, I got a notification for that file in directory comparison window, but did not get any notification in the file comparison window, suggesting that the file did not actually change.
Is it possible to disable the external change monitoring via a command-line switch?
Re: Git integration question
Well then we'll reverse the recommendation back to what it was.Actually, from reading the help page, it appears that the original suggestion was correct.
Not directly but you can always export your options to a file and use the /g option to use the saved options files.Is it possible to disable the external change monitoring via a command-line switch?
psguru
PrestoSoft
PrestoSoft
Re: Git integration question
It seems to me exactly the opposite, as is customary.Alexo wrote: Sun Feb 13, 2022 5:34 pm EDP returns a non-zero exit code in cases where no error occurred.
Zero usually means ok.
Re: Git integration question
Zero does usually means OK but EDP has to also tell whether differences/conflicts were found. Compare with GNU diff https://man7.org/linux/man-pages/man1/diff.1.html:
Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.
psguru
PrestoSoft
PrestoSoft
Re: Git integration question
The behaviour is still problematic, and disabling the notifications is a workaround at best (not an optimal one, since any changes need to be exported again).Not directly but you can always export your options to a file and use the /g option to use the saved options files.
This did not happen with other diff programs that are aware of file changes (BC4 and others).
Can this be investigated?
Re: Git integration question
You can change notification settings in the Registry by using the UI, and it will affect all future sessions.
What exactly do you want to be investigated? I'm not sure what the problem is.This did not happen with other diff programs that are aware of file changes (BC4 and others).
Can this be investigated?
psguru
PrestoSoft
PrestoSoft
Re: Git integration question
As I wrote above:psguru wrote: Mon Feb 14, 2022 2:36 pm What exactly do you want to be investigated? I'm not sure what the problem is.
I do not know what causes the directory comparison window to decide that files are changing when the file comparison windows don't.Alexo wrote: Sun Feb 13, 2022 10:47 pm Running the followingDisplays a directory comparison as expected, but then I start getting incessant pop-ups that files got changed prompting to re-compare the directories. Indeed, many of the displayed files start changing to italics as if they are getting changed, but not all of them.Code: Select all
git difftool --dir-diff <some branch> <some other branch>
Interestingly, when I clicked on a line to open a file comparison, and waited, I got a notification for that file in directory comparison window, but did not get any notification in the file comparison window, suggesting that the file did not actually change.
Thank you!
Re: Git integration question
I also asked the same question on SO and got the following comment:
The --dir-diff option pushes all the work off to the diff tool itself: Git just extracts the two commits to be compared into two temporary directories, and then sends the names of the two directories to the diff tool. So everything that shows up from the moment the diff tool starts, until the entire git difftool command finishes, is because of the tool.
Re: Git integration question
Both directory and file comparison use the same file system monitoring WIN32 API, ReadDirectoryChangesW. There is no way for me to answer your question without having a concrete reproducible scenario.I do not know what causes the directory comparison window to decide that files are changing when the file comparison windows don't.
There must be some files that are being created/deleted/modified while the directory comparison view is on. You should be able to inspect your file system to see what they are. You can even use a tool like https://www.codeproject.com/Articles/95 ... angesW-all, or similar, to have a look at what's changing.I also asked the same question on SO and got the following comment:
The --dir-diff option pushes all the work off to the diff tool itself: Git just extracts the two commits to be compared into two temporary directories, and then sends the names of the two directories to the diff tool. So everything that shows up from the moment the diff tool starts, until the entire git difftool command finishes, is because of the tool.
psguru
PrestoSoft
PrestoSoft
Re: Git integration question
Well, yes and no.psguru wrote: Tue Feb 15, 2022 9:38 am There must be some files that are being created/deleted/modified while the directory comparison view is on. You should be able to inspect your file system to see what they are.
I used the SysInternals Process Monitor to see what processes access the files, trimmed the log to only include a single file name, and posted it here: https://pastebin.com/hLbQnwPs
What we can see is that the file is accessed by two processes: Windows Defender and EDP.
What happens is that once git copies the files to the temp folder, Windows Defender starts scanning them in the background.
This is a work machine, managed by the organization, so I cannot disable the antivirus, or change its parameters (like exclusions), but if we look closely at what it is doing, we see that the only write operation that it performs is setting the file's extended attributes, which should not affect the comparison in any way.
The NotifyChangeDirectory call from EDP filters on:
FILE_NOTIFY_CHANGE_FILE_NAME
FILE_NOTIFY_CHANGE_DIR_NAME
FILE_NOTIFY_CHANGE_ATTRIBUTES
FILE_NOTIFY_CHANGE_SIZE
FILE_NOTIFY_CHANGE_LAST_WRITE
FILE_NOTIFY_CHANGE_CREATION
FILE_NOTIFY_CHANGE_SECURITY
I suspect that in this case, FILE_NOTIFY_CHANGE_ATTRIBUTES causes the false positive.