Skip to contentSkip to conversation

Fix 'git remote show' regression on empty repository in 1.5.4

PATCH In review Shawn O. Pearce 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix 'git remote show' regression on empty repository in 1.5.4

Back in 18f7c51c we switched git-ls-remote/git-peek-remote to use the transport backend, rather than do everything itself.

As part of that switch we started to produce a non-zero exit status if no refs were received from the remote peer, which happens when the remote peer has no commits pushed to it yet. (E.g. "git --git-dir=foo.git init; git ls-remote foo.git")

---

This patch is built against maint.

It will cause a merge conflict against master as there is a change there to invoke transport_disconnect(transport) before displaying the refs.

Since the disconnect patch is not in maint, but this is a current regression in 1.5.4.3, I'm sending you a conflicting patch. :)

As far as resolving this when it merges to master, the return value of transport_disconnect() is probably what should be checked to signal a non-zero exit status to the caller, not the empty ref list.

 builtin-ls-remote.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
builtin-ls-remote.c +0 -3
index 6dd31d1..720280e 100644
@@ -94,10 +94,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 		transport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack);
 
 	ref = transport_get_remote_refs(transport);
-
-	if (!ref)
-		return 1;
#1 lore raw
Quoted 6 lines · Shawn O. Pearce

It will cause a merge conflict against master as there is a change there to invoke transport_disconnect(transport) before displaying the refs.

Since the disconnect patch is not in maint, but this is a current regression in 1.5.4.3, I'm sending you a conflicting patch. :)

That's perfectly fine. Merging is what maintainers do.