send-pack: fix "everything up-to-date" message
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Nov 18, 2007 at 03:08 UTC
73fa0b44ac1ed3b0b34ea6bcdca7d9b76886b903
1 file changed
+15
-1
builtin-send-pack.c
+15
-1
@@ -347,6 +347,20 @@ static void print_push_status(const char *dest, struct ref *refs)
347
}
348
}
349
350
+static int refs_pushed(struct ref *ref)
351
+{
352
+ for (; ref; ref = ref->next) {
353
+ switch(ref->status) {
354
+ case REF_STATUS_NONE:
355
+ case REF_STATUS_UPTODATE:
356
+ break;
357
+ default:
358
+ return 1;
359
+ }
360
+ }
361
+ return 0;
362
+}
363
+
364
static int do_send_pack(int in, int out, struct remote *remote, const char *dest, int nr_refspec, const char **refspec)
365
{
366
struct ref *ref;
@@ -487,7 +501,7 @@ static int do_send_pack(int in, int out, struct remote *remote, const char *dest
501
update_tracking_ref(remote, ref);
502
}
503
490
- if (!new_refs)
504
+ if (!refs_pushed(remote_refs))
505
fprintf(stderr, "Everything up-to-date\n");
506
if (ret < 0)
507
return ret;