Gmane
Favicon Gravatar
From: Michael J Gruber <git <at> drmicha.warpmail.net>
Subject: Re: [PATCH] for-each-ref: fix objectname:short bug
Newsgroups: gmane.comp.version-control.git
Date: 2010-08-27 07:08:02 GMT (1 year, 23 weeks, 5 days, 10 hours and 4 minutes ago)
Jay Soffian venit, vidit, dixit 26.08.2010 23:34:
> When objectname:short was introduced, it forgot to copy the result of
> find_unique_abbrev. Because the result of find_unique_abbrev is a
> pointer to static buffer, this resulted in the same value being
> substituted in for each ref.
> 
> Signed-off-by: Jay Soffian <jaysoffian <at> gmail.com>
> ---
>  builtin/for-each-ref.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
> index a2b28c6..89e75c6 100644
> --- a/builtin/for-each-ref.c
> +++ b/builtin/for-each-ref.c
> @@ -228,7 +228,8 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
>  			v->s = s;
>  		}
>  		else if (!strcmp(name, "objectname:short")) {
> -			v->s = find_unique_abbrev(obj->sha1, DEFAULT_ABBREV);
> +			v->s = xstrdup(find_unique_abbrev(obj->sha1,
> +							  DEFAULT_ABBREV));
>  		}
>  	}
>  }

3 words:

embarrassing - sorry - thanks!

Michael