-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jh/diff-index-line-abbrev'
* jh/diff-index-line-abbrev: diff.c: Ensure "index $from..$to" line contains unambiguous SHA1s Conflicts: diff.c
- Loading branch information
Showing
2 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
|
||
test_description='test unique sha1 abbreviation on "index from..to" line' | ||
. ./test-lib.sh | ||
|
||
cat >expect_initial <<EOF | ||
100644 blob 51d2738463ea4ca66f8691c91e33ce64b7d41bb1 foo | ||
EOF | ||
|
||
cat >expect_update <<EOF | ||
100644 blob 51d2738efb4ad8a1e40bed839ab8e116f0a15e47 foo | ||
EOF | ||
|
||
test_expect_success 'setup' ' | ||
echo 4827 > foo && | ||
git add foo && | ||
git commit -m "initial" && | ||
git cat-file -p HEAD: > actual && | ||
test_cmp expect_initial actual && | ||
echo 11742 > foo && | ||
git commit -a -m "update" && | ||
git cat-file -p HEAD: > actual && | ||
test_cmp expect_update actual | ||
' | ||
|
||
cat >expect <<EOF | ||
index 51d27384..51d2738e 100644 | ||
EOF | ||
|
||
test_expect_success 'diff does not produce ambiguous index line' ' | ||
git diff HEAD^..HEAD | grep index > actual && | ||
test_cmp expect actual | ||
' | ||
|
||
test_done |