diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-02-03 00:26:17 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-03 00:26:17 -0800 |
commit | f39e4cfa2ec2bab4175cee3a9e806d8b65161c75 (patch) | |
tree | 080aa6dcd4d42ef5e4583b7ea84f33d97efd7c1f /t | |
parent | 1487eb68f7fd145151caa9a11ee00283629b75ef (diff) | |
parent | 4cc8d6c62db1f82b3c98468806d2ee54c7e037ca (diff) | |
download | git-f39e4cfa2ec2bab4175cee3a9e806d8b65161c75.tar.gz |
Merge branch 'jc/maint-add-u-remove-conflicted'
* jc/maint-add-u-remove-conflicted:
add -u: do not fail to resolve a path as deleted
Diffstat (limited to 't')
-rwxr-xr-x | t/t2200-add-update.sh | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh index cd9231cf61..b2ddf5ace3 100755 --- a/t/t2200-add-update.sh +++ b/t/t2200-add-update.sh @@ -12,7 +12,7 @@ and issues a git add -u with path limiting on "dir" to add only the updates to dir/sub. Also tested are "git add -u" without limiting, and "git add -u" -without contents changes.' +without contents changes, and other conditions' . ./test-lib.sh @@ -128,4 +128,52 @@ test_expect_success 'add -n -u should not add but just report' ' ' +test_expect_success 'add -u resolves unmerged paths' ' + git reset --hard && + one=$(echo 1 | git hash-object -w --stdin) && + two=$(echo 2 | git hash-object -w --stdin) && + three=$(echo 3 | git hash-object -w --stdin) && + { + for path in path1 path2 + do + echo "100644 $one 1 $path" + echo "100644 $two 2 $path" + echo "100644 $three 3 $path" + done + echo "100644 $one 1 path3" + echo "100644 $one 1 path4" + echo "100644 $one 3 path5" + echo "100644 $one 3 path6" + } | + git update-index --index-info && + echo 3 >path1 && + echo 2 >path3 && + echo 2 >path5 && + git add -u && + git ls-files -s "path?" >actual && + { + echo "100644 $three 0 path1" + echo "100644 $one 1 path3" + echo "100644 $one 1 path4" + echo "100644 $one 3 path5" + echo "100644 $one 3 path6" + } >expect && + test_cmp expect actual && + + # Bonus tests. Explicit resolving + git add path3 path5 && + test_must_fail git add path4 && + test_must_fail git add path6 && + git rm path4 && + git rm path6 && + + git ls-files -s "path?" >actual && + { + echo "100644 $three 0 path1" + echo "100644 $two 0 path3" + echo "100644 $two 0 path5" + } >expect + +' + test_done |