git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: A bug or unhandled case

From
MJMichał Janiszewski <janisozaur@gmail.com>
Date
Mar 11, 2013, 16:39 UTC
Message-ID
<CABB6UqHgcsx9oK2GHhmwpuhv+T3aMAJk_udw8enkGB3OutzbNg@mail.gmail.com>
In-Reply-To
<7vvc8xaoia.fsf@alter.siamese.dyndns.org>

Hmm, indeed it works. Sorry for the confusion then (and a bit mistaken commands, but you got them correct). I wasn't aware of the -r option.

On Mon, Mar 11, 2013 at 5:29 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 53 quoted lines
> Michał Janiszewski <janisozaur@gmail.com> writes:
>
>> 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"
>
> Nothing added, nothing committed, at this point.
> I'd assume there is "git add file" before this 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
>
> error: src refspec test-branch does not match any.
> error: failed to push some refs to '...../bar.git'
>
> I'd assume that is 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:
>
> Correct.
>
>> # remotes/bar/test_branch 8b96ffe evil commit
>> # trying to remove that branch yields no results:
>> $ git branch -D refs/remotes/bar/test_branch
>
> That is not the way to remove the remote tracking branch test_branch
> you have from remote bar, is it?
>
>         git branch -r -D bar/test_branch
>

-- Michal Janiszewski

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “A bug or unhandled case”
  1. Michał JaniszewskiMar 11, 2013
  2. Junio C HamanoMar 11, 2013
  3. Michał JaniszewskiMar 11, 2013
  4. Junio C HamanoMar 11, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.