git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "warning: Updating the currently checked out branch may cause confusion" on bare repositories
@ 2010-01-18 22:41 Adam Megacz
  2010-01-19  6:29 ` Shawn O. Pearce
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Megacz @ 2010-01-18 22:41 UTC (permalink / raw)
  To: git


It seems that the message "warning: Updating the currently checked out
branch may cause confusion" is unnecessary when pushing to a bare
"myproject.git" repository (instead of a "myproject/.git" repository).

Is this the case?

If so, perhaps the warning should be omitted when the target is a bare
repository.

  - a

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "warning: Updating the currently checked out branch may cause confusion" on bare repositories
  2010-01-18 22:41 "warning: Updating the currently checked out branch may cause confusion" on bare repositories Adam Megacz
@ 2010-01-19  6:29 ` Shawn O. Pearce
  2010-01-19 18:55   ` Adam Megacz
  0 siblings, 1 reply; 5+ messages in thread
From: Shawn O. Pearce @ 2010-01-19  6:29 UTC (permalink / raw)
  To: Adam Megacz; +Cc: git

Adam Megacz <adam@megacz.com> wrote:
> 
> It seems that the message "warning: Updating the currently checked out
> branch may cause confusion" is unnecessary when pushing to a bare
> "myproject.git" repository (instead of a "myproject/.git" repository).
> 
> Is this the case?
> 
> If so, perhaps the warning should be omitted when the target is a bare
> repository.

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.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "warning: Updating the currently checked out branch may cause confusion" on bare repositories
  2010-01-19  6:29 ` Shawn O. Pearce
@ 2010-01-19 18:55   ` Adam Megacz
  2010-01-19 18:59     ` Shawn O. Pearce
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Megacz @ 2010-01-19 18:55 UTC (permalink / raw)
  To: git


"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 was under the impression that you could create a bare repository by
simply throwing away the working tree and renaming ".git" to any other
name, but I guess I was wrong.

  - a

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "warning: Updating the currently checked out branch may cause confusion" on bare repositories
  2010-01-19 18:55   ` Adam Megacz
@ 2010-01-19 18:59     ` Shawn O. Pearce
  2010-01-19 22:43       ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Shawn O. Pearce @ 2010-01-19 18:59 UTC (permalink / raw)
  To: Adam Megacz; +Cc: git

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.
 
> I was under the impression that you could create a bare repository by
> simply throwing away the working tree and renaming ".git" to any other
> name, but I guess I was wrong.

If you delete the setting from the configuration file, Git usually
almost always guesses correctly.  :-)

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.)

-- 
Shawn.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "warning: Updating the currently checked out branch may cause confusion" on bare repositories
  2010-01-19 18:59     ` Shawn O. Pearce
@ 2010-01-19 22:43       ` Jeff King
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff King @ 2010-01-19 22:43 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Adam Megacz, git

On Tue, Jan 19, 2010 at 10:59:06AM -0800, Shawn O. Pearce wrote:

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-01-19 22:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-18 22:41 "warning: Updating the currently checked out branch may cause confusion" on bare repositories Adam Megacz
2010-01-19  6:29 ` Shawn O. Pearce
2010-01-19 18:55   ` Adam Megacz
2010-01-19 18:59     ` Shawn O. Pearce
2010-01-19 22:43       ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).