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

Re: [PATCH] blame: default to HEAD in a bare repo when no start commit is given

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 9, 2019, 08:13 UTC
Message-ID
<xmqqmukz7fzy.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<878swkacok.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> There was the explicit decision not to fall back to HEAD in 1cfe77333f
> ("git-blame: no rev means start from the working tree file.",
> 2007-01-30). This change makes sense to me, but perhaps some discussion
> or reference to the previous commit is warranted?

Yes. That is a good suggestion. I do not think the original meant to say that no rev should error out in a bare repository because no rev must mean 'start from te working tree' and there is no way to satisify it in a bare repository.

> Both are bad & misleading, perhaps we can instead say something like:
>
>     die(_("in a bare repository you must specify a ref to blame from, we tried and failed to implicitly use HEAD"));
Sounds like an easy-to-understand message, albeit way too looong.
> Along with a test for what we do in bare repos without a HEAD....?
> ...
> ....just 'git update-ref -d HEAD` after this and a test for 'git blame
> <file>' here would test bare without HEAD.

That's a cute way to bring us on an unborn branch, but let's not promote it too much. Doing so while on detached HEAD will render your repository corrupt.

Previous: Ævar Arnfjörð Bjarmason
Message 6 of 6 in “blame: default to HEAD in a bare repo when no start commit is given”
  1. blame: default to HEAD in a bare repo when no start commit is givenSZEDER Gábor, Apr 7, 2019
  2. Eric SunshineApr 8, 2019
  3. Ævar Arnfjörð BjarmasonApr 8, 2019
  4. SZEDER GáborApr 8, 2019
  5. Ævar Arnfjörð BjarmasonApr 8, 2019
  6. Junio C HamanoApr 9, 2019

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.