Commit 3e4068ed authored by Jeff King's avatar Jeff King Committed by Junio C Hamano

symbolic-ref: propagate error code from create_symref()

If create_symref() fails, git-symbolic-ref will still exit
with code 0, and our caller has no idea that the command did

This appears to have been broken since the beginning of time
(e.g., it is not a regression where create_symref() stopped
calling die() or something similar).
Signed-off-by: default avatarJeff King <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent a2558fb8
......@@ -67,7 +67,7 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
if (!strcmp(argv[0], "HEAD") &&
!starts_with(argv[1], "refs/"))
die("Refusing to point HEAD outside of refs/");
create_symref(argv[0], argv[1], msg);
ret = !!create_symref(argv[0], argv[1], msg);
usage_with_options(git_symbolic_ref_usage, options);
......@@ -63,4 +63,10 @@ test_expect_success 'symbolic-ref fails to delete real ref' '
test_expect_success 'symbolic-ref reports failure in exit code' '
test_when_finished "rm -f .git/HEAD.lock" &&
>.git/HEAD.lock &&
test_must_fail git symbolic-ref HEAD refs/heads/whatever
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment