diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-02-27 13:57:18 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-02-27 13:57:18 -0800 |
commit | c13c783c9d3d7d3eff937b7bf3642d2a7fe32644 (patch) | |
tree | c650be76225f1b73aa5df51bcba519c532ebf437 /t | |
parent | Merge branch 'jk/tempfile-ferror-fclose-confusion' (diff) | |
parent | branch: record creation of renamed branch in HEAD's log (diff) | |
download | tgif-c13c783c9d3d7d3eff937b7bf3642d2a7fe32644.tar.xz |
Merge branch 'km/delete-ref-reflog-message'
"git update-ref -d" and other operations to delete references did
not leave any entry in HEAD's reflog when the reference being
deleted was the current branch. This is not a problem in practice
because you do not want to delete the branch you are currently on,
but caused renaming of the current branch to something else not to
be logged in a useful way.
* km/delete-ref-reflog-message:
branch: record creation of renamed branch in HEAD's log
rename_ref: replace empty message in HEAD's log
update-ref: pass reflog message to delete_ref()
delete_ref: accept a reflog message argument
Diffstat (limited to 't')
-rwxr-xr-x | t/t1400-update-ref.sh | 18 | ||||
-rwxr-xr-x | t/t3200-branch.sh | 6 |
2 files changed, 24 insertions, 0 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index e208009906..825422341d 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -85,6 +85,24 @@ test_expect_success "delete $m (by HEAD)" ' ' rm -f .git/$m +test_expect_success "deleting current branch adds message to HEAD's log" ' + git update-ref $m $A && + git symbolic-ref HEAD $m && + git update-ref -m delete-$m -d $m && + ! test -f .git/$m && + grep "delete-$m$" .git/logs/HEAD +' +rm -f .git/$m + +test_expect_success "deleting by HEAD adds message to HEAD's log" ' + git update-ref $m $A && + git symbolic-ref HEAD $m && + git update-ref -m delete-by-head -d HEAD && + ! test -f .git/$m && + grep "delete-by-head$" .git/logs/HEAD +' +rm -f .git/$m + test_expect_success 'update-ref does not create reflogs by default' ' test_when_finished "git update-ref -d $outside" && git update-ref $outside $A && diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 8a833f354e..e36ed3b4e1 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -139,6 +139,12 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou test $(git rev-parse --abbrev-ref HEAD) = bam ' +test_expect_success 'git branch -M baz bam should add entries to .git/logs/HEAD' ' + msg="Branch: renamed refs/heads/baz to refs/heads/bam" && + grep " 0\{40\}.*$msg$" .git/logs/HEAD && + grep "^0\{40\}.*$msg$" .git/logs/HEAD +' + test_expect_success 'git branch -M baz bam should succeed when baz is checked out as linked working tree' ' git checkout master && git worktree add -b baz bazdir && |