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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jeff King
Date: Tuesday, November 20, 2007 - 4:21 am

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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
! [rejected] master -&gt; master (non-fast forward), Jon Smirl, (Sun Nov 18, 8:12 am)
Re: ! [rejected] master -&gt; master (non-fast forward), Junio C Hamano, (Sun Nov 18, 11:10 am)
Re: ! [rejected] master -&gt; master (non-fast forward), Alex Riesen, (Sun Nov 18, 11:29 am)
Re: ! [rejected] master -&gt; master (non-fast forward), Catalin Marinas, (Mon Nov 19, 10:47 am)
Re: ! [rejected] master -&gt; master (non-fast forward), Daniel Barkalow, (Mon Nov 19, 5:03 pm)
Re: ! [rejected] master -&gt; master (non-fast forward), Alex Riesen, (Mon Nov 19, 11:50 pm)
[PATCH 1/2] send-pack: cluster ref status reporting, Jeff King, (Tue Nov 20, 4:18 am)
[PATCH 2/2] send-pack: print "maybe you need to pull" hint, Jeff King, (Tue Nov 20, 4:21 am)
Re: [PATCH 1/2] send-pack: cluster ref status reporting, Alex Riesen, (Tue Nov 20, 11:22 am)
Re: [PATCH 1/2] send-pack: cluster ref status reporting, Junio C Hamano, (Wed Nov 21, 12:24 am)
Re: [PATCH 1/2] send-pack: cluster ref status reporting, Junio C Hamano, (Wed Nov 21, 12:36 am)