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

Crash when generating patch for multiple files and a file only on one side #252

Closed
Simran-B opened this issue Jan 10, 2020 · 3 comments
Closed

Comments

@Simran-B
Copy link

WinMerge v2.16.4.0 32 bit / WinMerge v2.16.5.0 64-bit (pre-release) under Windows 10 64-bit

File structure to reproduce the crash:

|__ foo
|   |__ a.txt
|
|__ bar
    |__ a.txt
    |__ b.txt

Demo files: winmerge_patch_crash.zip

  1. Drag both folders onto WinMerge and select them

    image

  2. Click Tools > Generate Patch and set a result path

  3. The other options don't matter, but make sure not to change the default [2 files selected]

    image

  4. Click OK and wait. Crash occurs.

The reason seems to be that it tries to compare in pairs, but doesn't check whether the file exists in both directories.

sdottaka added a commit that referenced this issue Jan 11, 2020
@sdottaka
Copy link
Member

Fixed by commit 8ef3d8e

Thank you for the report.

The latest CI build artifacts are available at:
https://ci.appveyor.com/project/sdottaka/winmerge/build/artifacts

@Simran-B
Copy link
Author

Thanks, it does no longer crash with the patch.

The generated patch in unified style is not quite as I expected though:

--- a.txt	Fri Jan 10 14:23:29 2020
+++ a.txt	Fri Jan 10 14:23:29 2020
--- b.txt	Thu Jan  1 01:00:00 1970
+++ b.txt	Fri Jan 10 14:23:29 2020
@@ -0,0 +1 @@
+test
\ No newline at end of file

Git itself gives me this for a commit which transitions a folder from "state" foo\ to bar\

diff --git b.txt b.txt
new file mode 100644
index 0000000..30d74d2
--- /dev/null
+++ b.txt
@@ -0,0 +1 @@
+test
\ No newline at end of file

The first three lines are git-specific, but what I find confusing about the WinMerge patch is that it seems to include +++ filename / --- filename for all files, even if they stay the same, and that an added or removed file shows with its actual filename instead of /dev/null and with a Unix timestamp of 0 converted a string and taking into account my local UTC offset. Is that on purpose or would you mind adjusting it to match what git would produce more closely?

sdottaka added a commit that referenced this issue Jan 19, 2020
@sdottaka
Copy link
Member

Sorry for the slow response.

The current WinMerge diff output mimics the 'diff -N' option.
WinMerge is not git, so I won't try to match it perfectly.
But it was better to output /dev/null as you say, so I fixed it that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants