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

Re: "warning: Updating the currently checked out branch may cause confusion" on bare repositories

From
Jeff King <peff@peff.net>
Date
Jan 19, 2010, 22:43 UTC
Message-ID
<20100119224343.GA11758@coredump.intra.peff.net>
In-Reply-To
<20100119185906.GF23466@spearce.org>
On Tue, Jan 19, 2010 at 10:59:06AM -0800, Shawn O. Pearce wrote:
Show 12 quoted lines
> Adam Megacz <adam@megacz.com> wrote:
> > "Shawn O. Pearce" <spearce@spearce.org> writes:
> > > That should already be the case.  Did you create the bare repository
> > > by taking a copy of a non-bare's .git directory?  Check your bare
> > > repository's config file and see if core.bare = false, if so set
> > > it to true to signal it really is bare.
> > 
> > Hrm, is there a reason why this is explicitly configured rather than
> > detected?
> 
> I don't know why we do this.  I think its because the guessing
> logic can guess wrong sometimes.

Yup, although I am having trouble finding any actual discussion of when it can go wrong. There is some mention here:

  http://article.gmane.org/gmane.comp.version-control.git/35993
and a little bit here in the 1.5.0 release notes:
  http://article.gmane.org/gmane.comp.version-control.git/39612

But the latter talks about the heuristic being "does it end with .git", which I don't think we actually use anymore. So who knows if the heuristic failures are even trigger-able anymore. I tried looking at the setup code for an answer, but my eyes started bleeding from the horrible spaghetti code and I couldn't make out any of the text.

> Its rare to see it fail.  But I think it can fail if you create
> a file called HEAD in the top level of your source code tree.
> (For example.)

I don't think that would do it. When looking for a git dir we check for a well-formed HEAD, as well as objects and refs directories. The is_bare check seems to be more about "did we actually find a workdir" these days.

-Peff
Previous: Shawn O. Pearce
Message 5 of 5 in “"warning: Updating the currently checked out branch may cause confusion" on bare repositories”
  1. Adam MegaczJan 18, 2010
  2. Shawn O. PearceJan 19, 2010
  3. Adam MegaczJan 19, 2010
  4. Shawn O. PearceJan 19, 2010
  5. Jeff KingJan 19, 2010

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.