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

Re: git-push: forced update of tag shows unabbreviated SHA1

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Jan 31, 2008, 10:01 UTC
Message-ID
<47A19C7F.1060204@viscovery.net>
In-Reply-To
<7vsl0ecp3i.fsf@gitster.siamese.dyndns.org>
Junio C Hamano schrieb:
Show 12 quoted lines
> Johannes Sixt <j.sixt@viscovery.net> writes:
> 
>> This is just a cosmetical flaw:
>> ...
>> To file:///home/jsixt/tmp/foo/B/../A
>>  + 639669ce44f84417f30842c622064827dda01461...475e55f T -> T (forced update)
>>
>> Notice that the original SHA1 is not abbreviated.
> 
> I suspect that is because you do not _have_ the original object,
> so there is no uniquely usable abbreviation to name the object
> in your repository.
Yes, you are right. This also happens for a commit.
Show 18 quoted lines
> This obviously is not tested at all (not even compile tested),
> but I think it would show you what is going on.
> 
> ---
>  builtin-send-pack.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/builtin-send-pack.c b/builtin-send-pack.c
> index 8afb1d0..9c558ee 100644
> --- a/builtin-send-pack.c
> +++ b/builtin-send-pack.c
> @@ -265,7 +265,7 @@ static const char *status_abbrev(unsigned char sha1[20])
>  {
>  	const char *abbrev;
>  	abbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);
> -	return abbrev ? abbrev : sha1_to_hex(sha1);
> +	return abbrev ? abbrev : "<you do not have it>";
>  }

No, that would be information hiding. I prefer an unabbreviated name. Nevertheless, if we know the name, we could be able to find a suitable abbreviation. But it's really not *that* important...

-- Hannes
Previous: Junio C HamanoNext: Jeff King
Message 3 of 9 in “git-push: forced update of tag shows unabbreviated SHA1”
  1. Johannes SixtJan 31, 2008
  2. Junio C HamanoJan 31, 2008
  3. Johannes SixtJan 31, 2008
  4. Jeff KingJan 31, 2008
  5. Junio C HamanoJan 31, 2008
  6. Jeff KingJan 31, 2008
  7. Jeff KingJan 31, 2008
  8. Junio C HamanoJan 31, 2008
  9. Jeff KingJan 31, 2008

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.