mirror of
https://github.com/git/git
synced 2024-08-25 10:45:59 +00:00
![Junio C Hamano](/assets/img/avatar_default.png)
When a path is unmerged in the index, we used to always say "unmerged" in the "Changed but not updated" section, even when the path was deleted in the work tree. Remove unmerged entries from the "Updated" section, and create a new section "Unmerged paths". Describe how the different stages conflict in more detail in this new section. Note that with the current 3-way merge policy (with or without recursive), certain combinations of index stages should never happen. For example, having only stage #2 means that a path that did not exist in the common ancestor was added by us while the other branch did not do anything to it, which would have autoresolved to take our addition. The code nevertheless prepares for the possibility that future merge policies may leave a path in such a state. Signed-off-by: Junio C Hamano <gitster@pobox.com>
59 lines
1.2 KiB
Bash
Executable file
59 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='basic work tree status reporting'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success setup '
|
|
test_commit A &&
|
|
test_commit B oneside added &&
|
|
git checkout A^0 &&
|
|
test_commit C oneside created
|
|
'
|
|
|
|
test_expect_success 'A/A conflict' '
|
|
git checkout B^0 &&
|
|
test_must_fail git merge C
|
|
'
|
|
|
|
test_expect_success 'Report path with conflict' '
|
|
git diff --cached --name-status >actual &&
|
|
echo "U oneside" >expect &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'Report new path with conflict' '
|
|
git diff --cached --name-status HEAD^ >actual &&
|
|
echo "U oneside" >expect &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
cat >expect <<EOF
|
|
# On branch side
|
|
# Unmerged paths:
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
# (use "git add <file>..." to mark resolution)
|
|
#
|
|
# deleted by us: foo
|
|
#
|
|
no changes added to commit (use "git add" and/or "git commit -a")
|
|
EOF
|
|
|
|
test_expect_success 'M/D conflict does not segfault' '
|
|
mkdir mdconflict &&
|
|
(
|
|
cd mdconflict &&
|
|
git init &&
|
|
test_commit initial foo "" &&
|
|
test_commit modify foo foo &&
|
|
git checkout -b side HEAD^ &&
|
|
git rm foo &&
|
|
git commit -m delete &&
|
|
test_must_fail git merge master &&
|
|
test_must_fail git status > ../actual
|
|
) &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_done
|