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

Re: Git *accepts* a branch name, it can't identity in the future?

From
Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Date
Aug 20, 2017, 10:00 UTC
Message-ID
<1503223257.2116.2.camel@gmail.com>
In-Reply-To
<20170820083347.mi3bmczkpvy6qwys@sigill.intra.peff.net>

Thanks, but Johannes has already found the issue and given a solution. Regardless, replying to the questions just for the note.

On Sun, 2017-08-20 at 04:33 -0400, Jeff King wrote:
> What does "git for-each-ref" say about which branches you _do_ have?
> 
> Also, what platform are you on?
> 
I use a "Debian GNU/Linux buster/sid 64-bit"
Show 8 quoted lines
> I'm wondering specifically if you have a filesystem (like HFS+ on MacOS)
> that silently rewrites invalid unicode in filenames we create. That
> would mean your branches are still there, but probably with some funny
> filename like "done/%xxdoc-fix". Git wouldn't know that name because the
> filesystem rewriting happened behinds its back (though I'd think that a
> further open() call would find the same file, so maybe this is barking
> up the wrong tree).
> 
That sounds dangerous!
Show 6 quoted lines
> Another line of thinking: are you sure the � you are writing on the
> command line is identical to the one generated by the corruption (and if
> you cut and paste, is perhaps a generic glyph placed in the buffer by
> your terminal to replace an invalid codepoint, rather than the actual
> bytes)?
> 

This was the issue. I wasn't providing git with the actual bytes that resulted as a consequence of the sloppy script.

>   [you didn't say how your script works, so let's use git to rename]
I know of no other way to rename a branch, so I didn't mention it :)
Show 5 quoted lines
>   $ broken=$(printf '\223')
> 
>   [and we can rename it using that knowledge]
>   $ git branch ${broken}doc-fix doc-fix
> 
Johannes has already given a solution, this one works too.
-- 
Kaartic
Previous: Jeff King
Message 5 of 5 in “Git *accepts* a branch name, it can't identity in the future?”
  1. Kaartic SivaraamAug 20, 2017
  2. Johannes SixtAug 20, 2017
  3. Kaartic SivaraamAug 20, 2017
  4. Jeff KingAug 20, 2017
  5. Kaartic SivaraamAug 20, 2017

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.