Bug: Branch Deletion Doesn't Clean Up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
<https://about.me/kolpanic>

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]