]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5703-upload-pack-ref-in-want.sh
Merge branch 'rs/preserve-merges-unused-code-removal'
[thirdparty/git.git] / t / t5703-upload-pack-ref-in-want.sh
index 92ad5eeec091122dedf2e707fae398be1a47accb..d9ecf0f4a95e2ef2bb43ee7816ee83a5c23b0b03 100755 (executable)
@@ -27,6 +27,15 @@ check_output () {
        test_cmp sorted_commits actual_commits
 }
 
+write_command () {
+       echo "command=$1"
+
+       if test "$(test_oid algo)" != sha1
+       then
+               echo "object-format=$(test_oid algo)"
+       fi
+}
+
 # c(o/foo) d(o/bar)
 #        \ /
 #         b   e(baz)  f(master)
@@ -34,7 +43,6 @@ check_output () {
 #             \ | /
 #               a
 test_expect_success 'setup repository' '
-       test_oid_init &&
        test_commit a &&
        git checkout -b o/foo &&
        test_commit b &&
@@ -65,7 +73,7 @@ test_expect_success 'config controls ref-in-want advertisement' '
 
 test_expect_success 'invalid want-ref line' '
        test-tool pkt-line pack >in <<-EOF &&
-       command=fetch
+       $(write_command fetch)
        0001
        no-progress
        want-ref refs/heads/non-existent
@@ -86,7 +94,7 @@ test_expect_success 'basic want-ref' '
 
        oid=$(git rev-parse a) &&
        test-tool pkt-line pack >in <<-EOF &&
-       command=fetch
+       $(write_command fetch)
        0001
        no-progress
        want-ref refs/heads/master
@@ -110,7 +118,7 @@ test_expect_success 'multiple want-ref lines' '
 
        oid=$(git rev-parse b) &&
        test-tool pkt-line pack >in <<-EOF &&
-       command=fetch
+       $(write_command fetch)
        0001
        no-progress
        want-ref refs/heads/o/foo
@@ -132,7 +140,7 @@ test_expect_success 'mix want and want-ref' '
        git rev-parse e f >expected_commits &&
 
        test-tool pkt-line pack >in <<-EOF &&
-       command=fetch
+       $(write_command fetch)
        0001
        no-progress
        want-ref refs/heads/master
@@ -155,7 +163,7 @@ test_expect_success 'want-ref with ref we already have commit for' '
 
        oid=$(git rev-parse c) &&
        test-tool pkt-line pack >in <<-EOF &&
-       command=fetch
+       $(write_command fetch)
        0001
        no-progress
        want-ref refs/heads/o/foo