]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5318-commit-graph.sh
Merge branch 'mh/notes-duplicate-entries'
[thirdparty/git.git] / t / t5318-commit-graph.sh
index 22cb9d66430410f726e821e906fa79587f43c3e8..ab3eccf0fafa3f8e9158b6347a544a8b4202b7ce 100755 (executable)
@@ -23,11 +23,10 @@ test_expect_success 'write graph with no packs' '
        test_path_is_missing info/commit-graph
 '
 
-test_expect_success 'close with correct error on bad input' '
+test_expect_success 'exit with correct error on bad input to --stdin-packs' '
        cd "$TRASH_DIRECTORY/full" &&
        echo doesnotexist >in &&
-       { git commit-graph write --stdin-packs <in 2>stderr; ret=$?; } &&
-       test "$ret" = 1 &&
+       test_expect_code 1 git commit-graph write --stdin-packs <in 2>stderr &&
        test_i18ngrep "error adding pack" stderr
 '
 
@@ -41,6 +40,15 @@ 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