Thread (1 message) 1 message, 1 author, 2016-06-15

Re: "git gc" removes ".git/refs/heads/master".

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:03

Bernd Lommerzheim [off-list ref] writes:
Hi,

maybe I found a bug in git. When I execute "git gc" in my local repository,
git removes the file ".git/refs/heads/master". Is this an intended behavior
(but why?) or is that a bug?

Some commands to reproduce:
~ $ mkdir tmp; cd tmp
~/tmp $ git init
Initialized empty Git repository in /home/myuser/tmp/.git/
~/tmp $ echo "content" > a
~/tmp $ git add .
~/tmp $ git commit -a -m "first commit"
Created initial commit 0b67f33: first commit
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a
~/tmp $ cat .git/refs/heads/master
0b67f33fff4152a912fdbe8819480b8fc1f2e990
~/tmp $ git gc
Counting objects: 3, done.
Writing objects: 100% (3/3), done.
Total 3 (delta 0), reused 0 (delta 0)
~/tmp $ cat .git/refs/heads/master
cat: .git/refs/heads/master: No such file or directory
~/tmp $ cat .git/HEAD
ref: refs/heads/master
~/tmp $ 
$ grep master .git/packed-refs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help