]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5318-commit-graph.sh
t5318: use test_oid for HASH_LEN
[thirdparty/git.git] / t / t5318-commit-graph.sh
index 4f17d7701e456bbb0992efdba2861e1dac8f7c23..75fe09521f370e2da5a69ef0b80f9535122d06da 100755 (executable)
@@ -8,7 +8,8 @@ test_expect_success 'setup full repo' '
        cd "$TRASH_DIRECTORY/full" &&
        git init &&
        git config core.commitGraph true &&
-       objdir=".git/objects"
+       objdir=".git/objects" &&
+       test_oid_init
 '
 
 test_expect_success 'verify graph with no graph file' '
@@ -134,7 +135,7 @@ test_expect_success 'Add one more commit' '
        git branch commits/8 &&
        ls $objdir/pack | grep idx >existing-idx &&
        git repack &&
-       ls $objdir/pack| grep idx | grep -v --file=existing-idx >new-idx
+       ls $objdir/pack| grep idx | grep -v -existing-idx >new-idx
 '
 
 # Current graph structure:
@@ -254,9 +255,9 @@ test_expect_success 'check that gc computes commit-graph' '
        git config gc.writeCommitGraph true &&
        git gc &&
        cp $objdir/info/commit-graph commit-graph-after-gc &&
-       ! test_cmp commit-graph-before-gc commit-graph-after-gc &&
+       ! test_cmp_bin commit-graph-before-gc commit-graph-after-gc &&
        git commit-graph write --reachable &&
-       test_cmp commit-graph-after-gc $objdir/info/commit-graph
+       test_cmp_bin commit-graph-after-gc $objdir/info/commit-graph
 '
 
 # the verify tests below expect the commit-graph to contain
@@ -273,7 +274,7 @@ test_expect_success 'git commit-graph verify' '
 
 NUM_COMMITS=9
 NUM_OCTOPUS_EDGES=2
-HASH_LEN=20
+HASH_LEN="$(test_oid rawsz)"
 GRAPH_BYTE_VERSION=4
 GRAPH_BYTE_HASH=5
 GRAPH_BYTE_CHUNK_COUNT=6
@@ -444,25 +445,27 @@ test_expect_success 'setup non-the_repository tests' '
 test_expect_success 'parse_commit_in_graph works for non-the_repository' '
        test-tool repository parse_commit_in_graph \
                repo/.git repo "$(git -C repo rev-parse two)" >actual &&
-       echo $(git -C repo log --pretty="%ct" -1) \
-               $(git -C repo rev-parse one) >expect &&
+       {
+               git -C repo log --pretty=format:"%ct " -1 &&
+               git -C repo rev-parse one
+       } >expect &&
        test_cmp expect actual &&
 
        test-tool repository parse_commit_in_graph \
                repo/.git repo "$(git -C repo rev-parse one)" >actual &&
-       echo $(git -C repo log --pretty="%ct" -1 one) >expect &&
+       git -C repo log --pretty="%ct" -1 one >expect &&
        test_cmp expect actual
 '
 
 test_expect_success 'get_commit_tree_in_graph works for non-the_repository' '
        test-tool repository get_commit_tree_in_graph \
                repo/.git repo "$(git -C repo rev-parse two)" >actual &&
-       echo $(git -C repo rev-parse two^{tree}) >expect &&
+       git -C repo rev-parse two^{tree} >expect &&
        test_cmp expect actual &&
 
        test-tool repository get_commit_tree_in_graph \
                repo/.git repo "$(git -C repo rev-parse one)" >actual &&
-       echo $(git -C repo rev-parse one^{tree}) >expect &&
+       git -C repo rev-parse one^{tree} >expect &&
        test_cmp expect actual
 '