diff options
Diffstat (limited to 't/t1400-update-ref.sh')
-rwxr-xr-x | t/t1400-update-ref.sh | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 6ee7d216fb..0d4f73acaa 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -4,6 +4,9 @@ # test_description='Test git update-ref and basic ref logging' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh Z=$ZERO_OID @@ -371,7 +374,7 @@ test_expect_success 'Query "main@{May 25 2005}" (before history)' ' echo "$C" >expect && test_cmp expect o && echo "warning: log for '\''main'\'' only goes back to $ed" >expect && - test_i18ncmp expect e + test_cmp expect e ' test_expect_success 'Query main@{2005-05-25} (before history)' ' test_when_finished "rm -f o e" && @@ -379,7 +382,7 @@ test_expect_success 'Query main@{2005-05-25} (before history)' ' echo "$C" >expect && test_cmp expect o && echo "warning: log for '\''main'\'' only goes back to $ed" >expect && - test_i18ncmp expect e + test_cmp expect e ' test_expect_success 'Query "main@{May 26 2005 23:31:59}" (1 second before history)' ' test_when_finished "rm -f o e" && @@ -387,7 +390,7 @@ test_expect_success 'Query "main@{May 26 2005 23:31:59}" (1 second before histor echo "$C" >expect && test_cmp expect o && echo "warning: log for '\''main'\'' only goes back to $ed" >expect && - test_i18ncmp expect e + test_cmp expect e ' test_expect_success 'Query "main@{May 26 2005 23:32:00}" (exactly history start)' ' test_when_finished "rm -f o e" && @@ -1595,4 +1598,47 @@ test_expect_success 'transaction cannot restart ongoing transaction' ' test_must_fail git show-ref --verify refs/heads/restart ' +test_expect_success PIPE 'transaction flushes status updates' ' + mkfifo in out && + (git update-ref --stdin <in >out &) && + + exec 9>in && + exec 8<out && + test_when_finished "exec 9>&-" && + test_when_finished "exec 8<&-" && + + echo "start" >&9 && + echo "start: ok" >expected && + read line <&8 && + echo "$line" >actual && + test_cmp expected actual && + + echo "create refs/heads/flush $A" >&9 && + + echo prepare >&9 && + echo "prepare: ok" >expected && + read line <&8 && + echo "$line" >actual && + test_cmp expected actual && + + # This must now fail given that we have locked the ref. + test_must_fail git update-ref refs/heads/flush $B 2>stderr && + grep "fatal: update_ref failed for ref ${SQ}refs/heads/flush${SQ}: cannot lock ref" stderr && + + echo commit >&9 && + echo "commit: ok" >expected && + read line <&8 && + echo "$line" >actual && + test_cmp expected actual +' + +test_expect_success 'directory not created deleting packed ref' ' + git branch d1/d2/r1 HEAD && + git pack-refs --all && + test_path_is_missing .git/refs/heads/d1/d2 && + git update-ref -d refs/heads/d1/d2/r1 && + test_path_is_missing .git/refs/heads/d1/d2 && + test_path_is_missing .git/refs/heads/d1 +' + test_done |