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

[PATCH 3/2] send-pack: fix "everything up-to-date" message

From
Jeff King <peff@peff.net>
Date
Nov 18, 2007, 08:08 UTC
Message-ID
<20071118080820.GA25358@sigill.intra.peff.net>
In-Reply-To
<20071118055804.GA19313@sigill.intra.peff.net>

This has always been slightly inaccurate, since it used the new_refs counter, which really meant "did we send any objects," so deletions were not counted.

It has gotten even worse with recent patches, since we no longer look at the 'ret' value, meaning we would say "up to date" if non-ff pushes were rejected.

Instead, we now claim up to date iff every ref is either unmatched or up to date. Any other case should already have generated a status line.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin-send-pack.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/builtin-send-pack.c b/builtin-send-pack.c
index 14447bb..3aab89c 100644
--- a/builtin-send-pack.c
+++ b/builtin-send-pack.c
@@ -347,6 +347,20 @@ static void print_push_status(const char *dest, struct ref *refs)
 	}
 }
 
+static int refs_pushed(struct ref *ref)
+{
+	for (; ref; ref = ref->next) {
+		switch(ref->status) {
+		case REF_STATUS_NONE:
+		case REF_STATUS_UPTODATE:
+			break;
+		default:
+			return 1;
+		}
+	}
+	return 0;
+}
+
 static int do_send_pack(int in, int out, struct remote *remote, const char *dest, int nr_refspec, const char **refspec)
 {
 	struct ref *ref;
@@ -487,7 +501,7 @@ static int do_send_pack(int in, int out, struct remote *remote, const char *dest
 			update_tracking_ref(remote, ref);
 	}
 
-	if (!new_refs)
+	if (!refs_pushed(remote_refs))
 		fprintf(stderr, "Everything up-to-date\n");
 	if (ret < 0)
 		return ret;
-- 
1.5.3.5.1817.gd2b4b-dirty
Previous: Jeff King
Message 7 of 7 in “send-pack: improve error reporting for total remote unpack”
  1. send-pack: improve error reporting for total remote unpackJeff King, Nov 18, 2007
  2. Jeff KingNov 18, 2007
  3. Jeff KingNov 18, 2007
  4. 1/2 make "find_ref_by_name" a public functionJeff King, Nov 18, 2007
  5. 2/2 send-pack: tighten remote error reportingJeff King, Nov 18, 2007
  6. Jeff KingNov 18, 2007
  7. 3/2 send-pack: fix "everything up-to-date" messageJeff King, Nov 18, 2007

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.