git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug: Branch Deletion Doesn't Clean Up
@ 2016-01-07 19:24 Karl Moskowski
  2016-02-04  7:54 ` Jeff King
  2016-02-04  7:55 ` Jeff King
  0 siblings, 2 replies; 7+ messages in thread
From: Karl Moskowski @ 2016-01-07 19:24 UTC (permalink / raw)
  To: git

Apologies if this is a known issue; I was unable to find anything similar in the archive.

The problem is, deleting a branch whose name contains slashes doesn’t delete the directories in .git/refs/heads/.

I’ve tried both git 2.5.4 and 2.6.4 on OS X 10.11 with HFS+ (case-insensitive, case-preserving). Here’s the sequence of commands:

% mkdir Foobar
% cd Foobar/
% git init
% git checkout -b master
% touch file.txt
% git add file.txt
% git commit -m "add a file"
% git checkout -b another/branch

At this point, there's file .git/refs/heads/another/branch

% git checkout master
% git branch -d another/branch

At this point, there's an empty directory .git/refs/heads/another/. Only the “leaf” file noted above is deleted, not the directory above it.

% git checkout -b Another/branch

At this point, the file .git/refs/heads/another/branch is re-created. Note the case of its enclosing directory.

% git status
On branch Another/branch
nothing to commit, working directory clean

% git branch -l
  another/branch
  master

Note the difference in case between the last two commands' output. In addition, there's no asterisk next to another/branch indicating it's current.

Because the first branch deletion didn't also delete the enclosing directory tree below .git/refs/heads/, the new branch gets created beneath it. However, there's inconsistent info between the file system and the git database.

It seems like git branch -d ascend the hierarchy (up to .git/refs/heads/), deleting any empty directories.

----
Karl Moskowski <kmoskowski@me.com>
<https://about.me/kolpanic>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-04  8:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-07 19:24 Bug: Branch Deletion Doesn't Clean Up Karl Moskowski
2016-02-04  7:54 ` Jeff King
2016-02-04  7:55 ` Jeff King
2016-02-04  8:12   ` Mike Hommey
2016-02-04  8:17     ` Jeff King
2016-02-04  8:26       ` Mike Hommey
2016-02-04  8:29         ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).