diff options
Diffstat (limited to 'third_party/git/t/t5318-commit-graph.sh')
-rwxr-xr-x | third_party/git/t/t5318-commit-graph.sh | 101 |
1 files changed, 7 insertions, 94 deletions
diff --git a/third_party/git/t/t5318-commit-graph.sh b/third_party/git/t/t5318-commit-graph.sh index 9bf920ae1716..22cb9d664304 100755 --- a/third_party/git/t/t5318-commit-graph.sh +++ b/third_party/git/t/t5318-commit-graph.sh @@ -19,14 +19,15 @@ test_expect_success 'verify graph with no graph file' ' test_expect_success 'write graph with no packs' ' cd "$TRASH_DIRECTORY/full" && - git commit-graph write --object-dir $objdir && - test_path_is_missing $objdir/info/commit-graph + git commit-graph write --object-dir . && + test_path_is_missing info/commit-graph ' -test_expect_success 'exit with correct error on bad input to --stdin-packs' ' +test_expect_success 'close with correct error on bad input' ' cd "$TRASH_DIRECTORY/full" && echo doesnotexist >in && - test_expect_code 1 git commit-graph write --stdin-packs <in 2>stderr && + { git commit-graph write --stdin-packs <in 2>stderr; ret=$?; } && + test "$ret" = 1 && test_i18ngrep "error adding pack" stderr ' @@ -40,15 +41,6 @@ test_expect_success 'create commits and repack' ' git repack ' -test_expect_success 'exit with correct error on bad input to --stdin-commits' ' - cd "$TRASH_DIRECTORY/full" && - echo HEAD | test_expect_code 1 git commit-graph write --stdin-commits 2>stderr && - test_i18ngrep "invalid commit object id" stderr && - # valid tree OID, but not a commit OID - git rev-parse HEAD^{tree} | test_expect_code 1 git commit-graph write --stdin-commits 2>stderr && - test_i18ngrep "invalid commit object id" stderr -' - graph_git_two_modes() { git -c core.commitGraph=true $1 >output git -c core.commitGraph=false $1 >expect @@ -85,7 +77,7 @@ graph_read_expect() { num_commits: $1 chunks: oid_fanout oid_lookup commit_metadata$OPTIONAL EOF - test-tool read-graph >output && + git commit-graph read >output && test_cmp expect output } @@ -124,42 +116,6 @@ test_expect_success 'Add more commits' ' git repack ' -test_expect_success 'commit-graph write progress off for redirected stderr' ' - cd "$TRASH_DIRECTORY/full" && - git commit-graph write 2>err && - test_line_count = 0 err -' - -test_expect_success 'commit-graph write force progress on for stderr' ' - cd "$TRASH_DIRECTORY/full" && - GIT_PROGRESS_DELAY=0 git commit-graph write --progress 2>err && - test_file_not_empty err -' - -test_expect_success 'commit-graph write with the --no-progress option' ' - cd "$TRASH_DIRECTORY/full" && - git commit-graph write --no-progress 2>err && - test_line_count = 0 err -' - -test_expect_success 'commit-graph verify progress off for redirected stderr' ' - cd "$TRASH_DIRECTORY/full" && - git commit-graph verify 2>err && - test_line_count = 0 err -' - -test_expect_success 'commit-graph verify force progress on for stderr' ' - cd "$TRASH_DIRECTORY/full" && - GIT_PROGRESS_DELAY=0 git commit-graph verify --progress 2>err && - test_file_not_empty err -' - -test_expect_success 'commit-graph verify with the --no-progress option' ' - cd "$TRASH_DIRECTORY/full" && - git commit-graph verify --no-progress 2>err && - test_line_count = 0 err -' - # Current graph structure: # # __M3___ @@ -481,7 +437,7 @@ test_expect_success 'detect bad version' ' ' test_expect_success 'detect bad hash version' ' - corrupt_graph_and_verify $GRAPH_BYTE_HASH "\03" \ + corrupt_graph_and_verify $GRAPH_BYTE_HASH "\02" \ "hash version" ' @@ -621,47 +577,4 @@ test_expect_success 'get_commit_tree_in_graph works for non-the_repository' ' test_cmp expect actual ' -test_expect_success 'corrupt commit-graph write (broken parent)' ' - rm -rf repo && - git init repo && - ( - cd repo && - empty="$(git mktree </dev/null)" && - cat >broken <<-EOF && - tree $empty - parent $ZERO_OID - author whatever <whatever@example.com> 1234 -0000 - committer whatever <whatever@example.com> 1234 -0000 - - broken commit - EOF - broken="$(git hash-object -w -t commit --literally broken)" && - git commit-tree -p "$broken" -m "good commit" "$empty" >good && - test_must_fail git commit-graph write --stdin-commits \ - <good 2>test_err && - test_i18ngrep "unable to parse commit" test_err - ) -' - -test_expect_success 'corrupt commit-graph write (missing tree)' ' - rm -rf repo && - git init repo && - ( - cd repo && - tree="$(git mktree </dev/null)" && - cat >broken <<-EOF && - parent $ZERO_OID - author whatever <whatever@example.com> 1234 -0000 - committer whatever <whatever@example.com> 1234 -0000 - - broken commit - EOF - broken="$(git hash-object -w -t commit --literally broken)" && - git commit-tree -p "$broken" -m "good" "$tree" >good && - test_must_fail git commit-graph write --stdin-commits \ - <good 2>test_err && - test_i18ngrep "unable to parse commit" test_err - ) -' - test_done |