diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-08-29 09:44:37 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-08-29 09:44:37 -0700 |
| commit | fea9d18c534a445ef6e488d8ee711fa92fa0e6bd (patch) | |
| tree | 56fd0f9b7dc3c75e9b03bf024d5bff239977f5cc /t/t1400-update-ref.sh | |
| parent | 040f05e824b9683799148609ff0a77d468e97182 (diff) | |
| parent | 450fc2bace48ce7ba07a2431175923bf2d610635 (diff) | |
| download | git-fea9d18c534a445ef6e488d8ee711fa92fa0e6bd.tar.xz | |
Merge branch 'jk/no-clobber-dangling-symref-with-fetch'
"git fetch" can clobber a symref that is dangling when the
remote-tracking HEAD is set to auto update, which has been
corrected.
* jk/no-clobber-dangling-symref-with-fetch:
refs: do not clobber dangling symrefs
t5510: prefer "git -C" to subshell for followRemoteHEAD tests
t5510: stop changing top-level working directory
t5510: make confusing config cleanup more explicit
Diffstat (limited to 't/t1400-update-ref.sh')
| -rwxr-xr-x | t/t1400-update-ref.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 96648a6e5d..b7415ec9d5 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -2368,4 +2368,25 @@ test_expect_success REFFILES 'empty directories are pruned when not committing' test_path_is_missing .git/refs/heads/nested ' +test_expect_success 'dangling symref not overwritten by creation' ' + test_when_finished "git update-ref -d refs/heads/dangling" && + git symbolic-ref refs/heads/dangling refs/heads/does-not-exist && + test_must_fail git update-ref --no-deref --stdin 2>err <<-\EOF && + create refs/heads/dangling HEAD + EOF + test_grep "cannot lock.*dangling symref already exists" err && + test_must_fail git rev-parse --verify refs/heads/dangling && + test_must_fail git rev-parse --verify refs/heads/does-not-exist +' + +test_expect_success 'dangling symref overwritten without old oid' ' + test_when_finished "git update-ref -d refs/heads/dangling" && + git symbolic-ref refs/heads/dangling refs/heads/does-not-exist && + git update-ref --no-deref --stdin <<-\EOF && + update refs/heads/dangling HEAD + EOF + git rev-parse --verify refs/heads/dangling && + test_must_fail git rev-parse --verify refs/heads/does-not-exist +' + test_done |
