Skip to content

Commit 6faf11a

Browse files
committed
Set +x in index in added-file-changed-content-and-mode
This fixes the second `gix-merge::merge tree::run_baseline` failure in which the baseline fixture `added-file-changed-content-and-mode` produced the wrong results when run on Windows, due to `chmod +x` having no effect (but reporting success) when run in Git Bash. The failure that this fixes, which is visible since the fix for the first baseline case failure was fixed in the preceding commit, is: --- STDERR: gix-merge::merge tree::run_baseline --- failed to extract 'tests\fixtures\generated-archives\tree-baseline.tar': Ignoring archive at 'tests\fixtures\generated-archives\tree-baseline.tar' as GIX_TEST_IGNORE_ARCHIVES is set. thread 'tree::run_baseline' panicked at gix-merge\tests\merge\tree\mod.rs:93:17: assertion failed: `(left == right)`: added-file-changed-content-and-mode-A-B-reversed: tree mismatch: We improve on executable bit handling, but loose on diff quality as we are definitely missing some tweaks [ Conflict { resolution: Ok( OursModifiedTheirsModifiedThenBlobContentMerge { merged_blob: ContentMerge { merged_blob_id: Sha1(7ad0b902fe3f9d6857ca2e02a84f17c3eae607d6), resolution: Conflict, }, }, ), ours: Addition { location: "new", relation: None, entry_mode: EntryMode( 33188, ), id: Sha1(ec046db5d8b05470e472330d75f419c81ed6c9d3), }, theirs: Addition { location: "new", relation: None, entry_mode: EntryMode( 33188, ), id: Sha1(8a1218a1024a212bb3db30becd860315f9f3ac52), }, map: Original, }, ] added-file-changed-content-and-mode-A-B-reversed Diff < left / right > : <297247d >c5c706c ├── a:fd269b6 │ └── x.f:100644:4406528 "original\n1\n2\n3\n4\n5\n" <└── new:100644:7ad0b90 "<<<<<<< B\noriginal\n1\n2\n3\n4\n5\n6\n=======\n1\n2\n3\n4\n5\n>>>>>>> A\n" >└── new:100644:c3e610f "<<<<<<< A\n1\n2\n3\n4\n5\n=======\noriginal\n1\n2\n3\n4\n5\n6\n>>>>>>> B\n" See the previous commit for a general description. The situation here differs because the file, `new`, is newly created at the same time as its mode is set, so it is not already in the index. While staging it and using the same approach used in the previous commit would work, this instead adds `--chmod=+x` to the existing `git add` commands to stage them with the desired permissions initially, since here those commands immediately follow the `chmod +x` commands. To make this work (and so it is clear), this also changes the path argument to refer to the specific file, rather than passing `.`, which had alredy been done in one place. These commands are (and were) only staging a single file, so this is sufficient. It turns out that the baseline cases fixed in the preceding commit and here are the only causes of failure for that test, so the test is now passing, even on Windows with `GIX_TEST_IGNORE_ARCHIVES=1`.
1 parent 041bdde commit 6faf11a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gix-merge/tests/fixtures/tree-baseline.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,13 @@ git init added-file-changed-content-and-mode
530530
git checkout B
531531
write_lines original 1 2 3 4 5 6 >new
532532
chmod +x new
533-
git add .
533+
git add --chmod=+x new
534534
git commit -m "add new with content B and +x"
535535

536536
git checkout expected
537537
echo -n $'<<<<<<< A\n1\n2\n3\n4\n5\n=======\noriginal\n1\n2\n3\n4\n5\n6\n>>>>>>> B\n' >new
538538
chmod +x new
539-
git add new
539+
git add --chmod=+x new
540540
git commit -m "Git has a better merge here, but that's due to better hunk handling/hunk splitting. We, however, consistently use +x"
541541
)
542542

0 commit comments

Comments
 (0)