A bug or unhandled case

From: Michał Janiszewski <hidden>
Date: 2016-06-15 22:56:21

Hi,
I think I've found a bug in git or at least a use case that is not handled.
In few words it can be described like this: if you push a remote
branch to another remote, which is bare repository, you cannot remove
that branch from said bare repository.
Here is a recipe how to reproduce that with git 1.8.0:
git init foo
git init --bare bar.git
git init --bare baz.git
cd foo
echo test > file
git commit -am "initial commit"
git remote add bar ../bar.git
git remote add baz ../baz.git
git push bar master
cd ..
git clone bar.git bax
cd bax
git checkout -b "test_branch"
echo evil > file
git commit -am "evil commit"
git push origin test-branch
cd ../foo
git fetch bar
git push baz bar/test_branch
cd ../baz.git

###
# on that point in baz.git there is only one branch:
# remotes/bar/test_branch 8b96ffe evil commit
# trying to remove that branch yields no results:
$ git branch -D refs/remotes/bar/test_branch
error: branch 'refs/remotes/bar/test_branch' not found.
$ git branch -D remotes/bar/test_branch
error: branch 'remotes/bar/test_branch' not found.
$ git branch -D bar/test_branch
error: branch 'bar/test_branch' not found.
$ git branch -D test_branch
error: branch 'test_branch' not found.

git gc --prune=now
# also does nothing

The only way to remove that branch is to:
cd ../foo
git push baz :bar/test_branch

Shouldn't someone who owns bare repository be able to delete that kind
of branches as he is able to do with "regular" branches?

--
Michal Janiszewski
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help