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

[PATCH 2/2] send-pack: print "maybe you need to pull" hint

From
Jeff King <peff@peff.net>
Date
Nov 20, 2007, 11:21 UTC
Message-ID
<20071120112146.GB7814@sigill.intra.peff.net>
In-Reply-To
<20071120111317.GA4120@sigill.intra.peff.net>

If there were refs rejected for not being fastforwards, then we used to print a "maybe you are not up-to-date" hint. This was lost in the recent terse-output patches.

Signed-off-by: Jeff King <peff@peff.net>
---
I am slightly negative on this patch, just because I always found that
particular warning a bit ugly (and the new output is so nice and
compact). But for new users, perhaps the extra hint is helpful?
If we do want the warning, then other options include:
  - listing each non-fast forward, as Alex's original patch did; this
    seems kind of pointless given that they are clustered at the bottom
    already
  - possibly cluster non-fast forwards differently from other errors in
    the output
  - tweak the text
 builtin-send-pack.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/builtin-send-pack.c b/builtin-send-pack.c
index f1cdb97..4bfa847 100644
--- a/builtin-send-pack.c
+++ b/builtin-send-pack.c
@@ -341,6 +341,7 @@ static void print_push_status(const char *dest, struct ref *refs)
 {
 	struct ref *ref;
 	int n = 0;
+	int nonff = 0;
 
 	if (args.verbose) {
 		for (ref = refs; ref; ref = ref->next)
@@ -357,7 +358,15 @@ static void print_push_status(const char *dest, struct ref *refs)
 		    ref->status != REF_STATUS_UPTODATE &&
 		    ref->status != REF_STATUS_OK)
 			n += print_one_push_status(ref, dest, n);
+		if (ref->status == REF_STATUS_REJECT_NONFASTFORWARD)
+			nonff++;
 	}
+
+	if (nonff)
+		error("%d remote refs were not ancestors of their "
+		      "corresponding local ref\n"
+		      "Maybe you are not up-to-date and need to pull first?",
+		      nonff);
 }
 
 static int refs_pushed(struct ref *ref)
-- 
1.5.3.6.1784.gd1b1d-dirty
Previous: Jeff KingNext: Alex Riesen
Message 18 of 19 in “! [rejected] master -> master (non-fast forward)”
  1. Jon SmirlNov 18, 2007
  2. Junio C HamanoNov 18, 2007
  3. Jon SmirlNov 18, 2007
  4. Catalin MarinasNov 19, 2007
  5. Jon SmirlNov 19, 2007
  6. Daniel BarkalowNov 20, 2007
  7. Alex RiesenNov 18, 2007
  8. Jeff KingNov 20, 2007
  9. Alex RiesenNov 20, 2007
  10. Jeff KingNov 20, 2007
  11. 1/2 send-pack: cluster ref status reportingJeff King, Nov 20, 2007
  12. Alex RiesenNov 20, 2007
  13. Junio C HamanoNov 21, 2007
  14. Jeff KingNov 21, 2007
  15. Junio C HamanoNov 21, 2007
  16. Jeff KingNov 21, 2007
  17. Jeff KingNov 21, 2007
  18. 2/2 send-pack: print "maybe you need to pull" hintJeff King, Nov 20, 2007
  19. Alex RiesenNov 20, 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.