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

Re: Some issues working with empty/bare repositories...

From
RDReece Dunn <msclrhd@googlemail.com>
Date
Mar 4, 2008, 21:51 UTC
Message-ID
<3f4fd2640803041351k6debe788xbf5e818951f70146@mail.gmail.com>
In-Reply-To
<20080303081021.GA6578@sigill.intra.peff.net>
On 03/03/2008, Jeff King <peff@peff.net> wrote:
Show 19 quoted lines
> On Sat, Mar 01, 2008 at 07:40:39PM +0000, Reece Dunn wrote:
>
>  > Consider the following workflow:
>  >
>  >     $ mkdir foo
>  >     $ cd foo
>  >     $ git --bare init
>  >
>  >     $ git log
>  >     fatal: bad default revision 'HEAD'
>  >
>  > This message is confusing for a newbie. Displaying "no commits" would
>  > make more sense here.
>
> The tricky thing here is that "git log" doesn't know we have no
>  commits in the repo; it only knows that HEAD is bogus. But it may be
>  that we can just say something like:
>
>   fatal: unable to resolve HEAD; do you have any commits?

That would be better. The current message would indicate something like a corrupt repository (or at least the metadata to the repository).

Show 10 quoted lines
>  >     $ git clone foo bar
>  >     Initialized empty Git repository in /home/reece/bar/.git/
>  >     $ ls -a /home/reece
>  >     . .. foo
>
> As of 1.5.4, this now says "fatal: cannot clone empty repository". There
>  has been work recently on a C version of clone which tries to match the
>  sequence of "init && remote add && fetch && checkout" more closely. I
>  haven't looked closely, but I suspect it may just work (by which I mean
>  create an empty repo with origin config pointing to the parent repo).

I have verified that behaviour with 1.5.4. Having an empty repository (possibly with a warning issued about cloning an empty repository) with the origin pointing to the parent repository is what I would expect to happen.

Show 5 quoted lines
>  > It appears from the git output (with the inconsistently capitalized
>  > git - see --version output above) that the clone succeeded, but it
>  > does not create bar/.git/, even though it said that it did.
>
> It did create it...it just deleted it afterwards without telling you. :)
:)
Thanks,
- Reece
Previous: Jeff KingNext: Jeff King
Message 3 of 9 in “Some issues working with empty/bare repositories...”
  1. Reece DunnMar 1, 2008
  2. Jeff KingMar 3, 2008
  3. Reece DunnMar 4, 2008
  4. [RFC] improve 'bad default revision' message for empty repoJeff King, Mar 5, 2008
  5. Junio C HamanoMar 5, 2008
  6. Jeff KingMar 5, 2008
  7. Junio C HamanoMar 5, 2008
  8. Jeff KingMar 5, 2008
  9. Jeff KingMar 5, 2008

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.