Re: [PATCH] revision.c: Clarify error message for missing objects

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

 



Jakob Pfender <jpfender@xxxxxxxxxxxxx> writes:

> This patch introduces a check to see whether an object exists (with the
> appropriate error message if it doesn't) and removes the unnecessary and
> misleading original error message if parse_object() fails.

How does this interact with object replacement?

I suspect the real issue is in read_sha1_file_repl() that says:

    /*
     * This function dies on corrupt objects; the callers who want to
     * deal with them should arrange to call read_object() and give error
     * messages themselves.
     */

without giving sufficient support for the callers that wish to use
read_object() themselves to implement the object replacement logic.


> Signed-off-by: Jakob Pfender <jpfender@xxxxxxxxxxxxx>
> ---
>  revision.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/revision.c b/revision.c
> index 86d2470..085aac2 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -173,9 +173,9 @@ static struct object *get_reference(struct
> rev_info *revs, const char *name, con
>  {
>      struct object *object;
>
> +    if (sha1_object_info(sha1, NULL) < 0)
> +        die("Not a valid object name %s", name);
>      object = parse_object(sha1);
> -    if (!object)
> -        die("bad object %s", name);
>      object->flags |= flags;
>      return object;
>  }
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]