From: Junio C Hamano Date: Mon, 28 Dec 2015 21:57:24 +0000 (-0800) Subject: Merge branch 'jk/symbolic-ref-maint' X-Git-Tag: v2.7.0-rc3~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e929264e8d769cd3637279c0a2b6338f9ec1c4c3;p=thirdparty%2Fgit.git Merge branch 'jk/symbolic-ref-maint' "git symbolic-ref" forgot to report a failure with its exit status. * jk/symbolic-ref-maint: t1401: test reflog creation for git-symbolic-ref symbolic-ref: propagate error code from create_symref() --- e929264e8d769cd3637279c0a2b6338f9ec1c4c3 diff --cc t/t1401-symbolic-ref.sh index 20b022ae33,64968b7891..1f0dff3a0b --- a/t/t1401-symbolic-ref.sh +++ b/t/t1401-symbolic-ref.sh @@@ -63,33 -63,26 +63,55 @@@ test_expect_success 'symbolic-ref fail ' reset_to_sane +test_expect_success 'create large ref name' ' + # make 256+ character ref; some systems may not handle that, + # so be gentle + long=0123456789abcdef && + long=$long/$long/$long/$long && + long=$long/$long/$long/$long && + long_ref=refs/heads/$long && + tree=$(git write-tree) && + commit=$(echo foo | git commit-tree $tree) && + if git update-ref $long_ref $commit; then + test_set_prereq LONG_REF + else + echo >&2 "long refs not supported" + fi +' + +test_expect_success LONG_REF 'symbolic-ref can point to large ref name' ' + git symbolic-ref HEAD $long_ref && + echo $long_ref >expect && + git symbolic-ref HEAD >actual && + test_cmp expect actual +' + +test_expect_success LONG_REF 'we can parse long symbolic ref' ' + echo $commit >expect && + git rev-parse --verify HEAD >actual && + test_cmp expect actual +' + + 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 + ' + + test_expect_success 'symbolic-ref writes reflog entry' ' + git checkout -b log1 && + test_commit one && + git checkout -b log2 && + test_commit two && + git checkout --orphan orphan && + git symbolic-ref -m create HEAD refs/heads/log1 && + git symbolic-ref -m update HEAD refs/heads/log2 && + cat >expect <<-\EOF && + update + create + EOF + git log --format=%gs -g >actual && + test_cmp expect actual + ' + test_done