Ævar Arnfjörð Bjarmason <[email protected]> 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.