send-pack: cluster ref status reporting
Instead of intermingling success and failure, we now print: 1. all uptodate refs (if args.verbose is enabled) 2. successfully pushed refs 3. failed refs with the assumption that the user is most likely to see the ones at the end, and therefore we order them from "least interesting" to "most interesting." Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
73fa0b44ac
commit
07f507155d
@ -298,21 +298,10 @@ static void print_ok_ref_status(struct ref *ref)
|
||||
}
|
||||
}
|
||||
|
||||
static void print_push_status(const char *dest, struct ref *refs)
|
||||
static int print_one_push_status(struct ref *ref, const char *dest, int count)
|
||||
{
|
||||
struct ref *ref;
|
||||
int shown_dest = 0;
|
||||
|
||||
for (ref = refs; ref; ref = ref->next) {
|
||||
if (!ref->status)
|
||||
continue;
|
||||
if (ref->status == REF_STATUS_UPTODATE && !args.verbose)
|
||||
continue;
|
||||
|
||||
if (!shown_dest) {
|
||||
if (!count)
|
||||
fprintf(stderr, "To %s\n", dest);
|
||||
shown_dest = 1;
|
||||
}
|
||||
|
||||
switch(ref->status) {
|
||||
case REF_STATUS_NONE:
|
||||
@ -344,6 +333,30 @@ static void print_push_status(const char *dest, struct ref *refs)
|
||||
print_ok_ref_status(ref);
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void print_push_status(const char *dest, struct ref *refs)
|
||||
{
|
||||
struct ref *ref;
|
||||
int n = 0;
|
||||
|
||||
if (args.verbose) {
|
||||
for (ref = refs; ref; ref = ref->next)
|
||||
if (ref->status == REF_STATUS_UPTODATE)
|
||||
n += print_one_push_status(ref, dest, n);
|
||||
}
|
||||
|
||||
for (ref = refs; ref; ref = ref->next)
|
||||
if (ref->status == REF_STATUS_OK)
|
||||
n += print_one_push_status(ref, dest, n);
|
||||
|
||||
for (ref = refs; ref; ref = ref->next) {
|
||||
if (ref->status != REF_STATUS_NONE &&
|
||||
ref->status != REF_STATUS_UPTODATE &&
|
||||
ref->status != REF_STATUS_OK)
|
||||
n += print_one_push_status(ref, dest, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user