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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 7, 2019 at 7:43 PM SZEDER Gábor <szeder.dev@xxxxxxxxx> wrote:
> [...]
> We could improve the error message, of course, but let's just default
> to HEAD in a bare repository instead, as most likely that is what the
> user wanted anyway (if they wanted to start from an other commit, then
> they would have specified that in the first place).
> [...]
> Signed-off-by: SZEDER Gábor <szeder.dev@xxxxxxxxx>
> ---
> diff --git a/builtin/blame.c b/builtin/blame.c
> @@ -993,6 +994,18 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
> +       if (!revs.pending.nr && is_bare_repository()) {
> +               struct commit *head_commit;
> +               struct object_id head_oid;
> +
> +               if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,
> +                                       &head_oid, NULL) ||
> +                   !(head_commit = lookup_commit_reference_gently(revs.repo,
> +                                                            &head_oid, 1)))
> +                       die("no such ref: HEAD");

This source file is already mostly internationalized, so perhaps:

    die(_("no such ref: %s"), "HEAD");

> +               add_pending_object(&revs, &head_commit->object, "HEAD");
> +       }



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux