diff options
author | Ramkumar Ramachandra <artagnon@gmail.com> | 2012-11-30 17:07:34 +0530 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-12-02 01:58:40 -0800 |
commit | 20fa53855e5479e9903047ba18cc247fd4519db4 (patch) | |
tree | c6dc62c5cefb3d26446cd30b8eaac5618a0040b2 /t/t4041-diff-submodule-option.sh | |
parent | 3b13af9d6cfab0d66cae386cbdc924030ad7a1e8 (diff) | |
download | git-20fa53855e5479e9903047ba18cc247fd4519db4.tar.gz |
t4041 (diff-submodule-option): parse digests sensibly
`git rev-list --max-count=1 HEAD` is a roundabout way of saying `git
rev-parse --verify HEAD`; replace a bunch of instances of the former
with the latter. Also, don't unnecessarily `cut -c1-7` the rev-parse
output when the `--short` option is available.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4041-diff-submodule-option.sh')
-rwxr-xr-x | t/t4041-diff-submodule-option.sh | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh index 537763916f..08d549a7b0 100755 --- a/t/t4041-diff-submodule-option.sh +++ b/t/t4041-diff-submodule-option.sh @@ -21,7 +21,7 @@ add_file () { test_tick && git commit -m "Add $name" done >/dev/null - git rev-parse --verify HEAD | cut -c1-7 + git rev-parse --short --verify HEAD cd "$owd" } commit_file () { @@ -33,7 +33,7 @@ test_create_repo sm1 && add_file . foo >/dev/null head1=$(add_file sm1 foo1 foo2) -fullhead1=$(cd sm1; git rev-list --max-count=1 $head1) +fullhead1=$(cd sm1; git rev-parse --verify HEAD) test_expect_success 'added submodule' " git add sm1 && @@ -116,8 +116,8 @@ EOF test_cmp expected actual " -fullhead2=$(cd sm1; git rev-list --max-count=1 $head2) test_expect_success 'modified submodule(forward) --submodule=short' " +fullhead2=$(cd sm1; git rev-parse --verify HEAD) git diff --submodule=short >actual && cat >expected <<-EOF && diff --git a/sm1 b/sm1 @@ -135,7 +135,7 @@ commit_file sm1 && head3=$( cd sm1 && git reset --hard HEAD~2 >/dev/null && - git rev-parse --verify HEAD | cut -c1-7 + git rev-parse --short --verify HEAD ) test_expect_success 'modified submodule(backward)' " @@ -220,8 +220,8 @@ EOF rm -f sm1 && test_create_repo sm1 && head6=$(add_file sm1 foo6 foo7) -fullhead6=$(cd sm1; git rev-list --max-count=1 $head6) test_expect_success 'nonexistent commit' " +fullhead6=$(cd sm1; git rev-parse --verify HEAD) git diff-index -p --submodule=log HEAD >actual && cat >expected <<-EOF && Submodule sm1 $head4...$head6 (commits not present) @@ -318,8 +318,8 @@ EOF " (cd sm1; git commit -mchange foo6 >/dev/null) && -head8=$(cd sm1; git rev-parse --verify HEAD | cut -c1-7) && test_expect_success 'submodule is modified' " +head8=$(cd sm1; git rev-parse --short --verify HEAD) && git diff-index -p --submodule=log HEAD >actual && cat >expected <<-EOF && Submodule sm1 $head6..$head8: @@ -461,7 +461,7 @@ EOF test_cmp expected actual " -fullhead7=$(cd sm2; git rev-list --max-count=1 $head7) +fullhead7=$(cd sm2; git rev-parse --verify HEAD) test_expect_success 'given commit --submodule=short' " git diff-index -p --submodule=short HEAD^ >actual && |