Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2022-06-18 03:20:53 +0300
committerJunio C Hamano <gitster@pobox.com>2022-06-23 02:10:06 +0300
commitb520bc6caa35e621396dd69ae4d84314615cf7ac (patch)
treeaf3e9a8de28d77b9a9118e1ad7d05fd3892b0084 /t/t4301-merge-tree-write-tree.sh
parent7fa3338870d66dd3946c5c3a0bd09dadb798893d (diff)
merge-tree: provide easy access to `ls-files -u` style info
Much like `git merge` updates the index with information of the form (mode, oid, stage, name) provide this output for conflicted files for merge-tree as well. Provide a --name-only option for users to exclude the mode, oid, and stage and only get the list of conflicted filenames. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4301-merge-tree-write-tree.sh')
-rwxr-xr-xt/t4301-merge-tree-write-tree.sh26
1 files changed, 24 insertions, 2 deletions
diff --git a/t/t4301-merge-tree-write-tree.sh b/t/t4301-merge-tree-write-tree.sh
index 8e6dba4428..0ec5f0d3f7 100755
--- a/t/t4301-merge-tree-write-tree.sh
+++ b/t/t4301-merge-tree-write-tree.sh
@@ -65,6 +65,7 @@ test_expect_success 'Content merge and a few conflicts' '
expected_tree=$(git rev-parse AUTO_MERGE) &&
# We will redo the merge, while we are still in a conflicted state!
+ git ls-files -u >conflicted-file-info &&
test_when_finished "git reset --hard" &&
test_expect_code 1 git merge-tree --write-tree side1 side2 >RESULT &&
@@ -108,7 +109,7 @@ anonymize_hash() {
}
test_expect_success 'test conflict notices and such' '
- test_expect_code 1 git merge-tree --write-tree side1 side2 >out &&
+ test_expect_code 1 git merge-tree --write-tree --name-only side1 side2 >out &&
anonymize_hash out >actual &&
# Expected results:
@@ -143,7 +144,7 @@ do
done
test_expect_success 'Just the conflicted files without the messages' '
- test_expect_code 1 git merge-tree --write-tree --no-messages side1 side2 >out &&
+ test_expect_code 1 git merge-tree --write-tree --no-messages --name-only side1 side2 >out &&
anonymize_hash out >actual &&
test_write_lines HASH greeting whatever~side1 >expect &&
@@ -151,4 +152,25 @@ test_expect_success 'Just the conflicted files without the messages' '
test_cmp expect actual
'
+test_expect_success 'Check conflicted oids and modes without messages' '
+ test_expect_code 1 git merge-tree --write-tree --no-messages side1 side2 >out &&
+ anonymize_hash out >actual &&
+
+ # Compare the basic output format
+ q_to_tab >expect <<-\EOF &&
+ HASH
+ 100644 HASH 1Qgreeting
+ 100644 HASH 2Qgreeting
+ 100644 HASH 3Qgreeting
+ 100644 HASH 1Qwhatever~side1
+ 100644 HASH 2Qwhatever~side1
+ EOF
+
+ test_cmp expect actual &&
+
+ # Check the actual hashes against the `ls-files -u` output too
+ tail -n +2 out | sed -e s/side1/HEAD/ >actual &&
+ test_cmp conflicted-file-info actual
+'
+
test_done