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

Subsystems: the rest

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:09

Johannes Sixt [off-list ref] 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.

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>";
 }
 
 static void print_ok_ref_status(struct ref *ref)

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

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:44:09

Junio C Hamano schrieb:
Johannes Sixt [off-list ref] writes:
quoted
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.
quoted hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help