Junio C Hamano <gitster@xxxxxxxxx> writes: > I wonder if generate_push_cert() can be told about atomicity of the > push, though. There is this loop in the function: > > int update_seen = 0; > > ... > for (ref = remote_refs; ref; ref = ref->next) { > if (check_to_send_update(ref, args) < 0) > continue; > update_seen = 1; > strbuf_addf(&cert, "%s %s %s\n", > oid_to_hex(&ref->old_oid), > oid_to_hex(&ref->new_oid), > ref->name); > } > if (!update_seen) > goto free_return; > > that makes it a no-op without invoking GPG if no update is needed. > Perhaps we can extend it to > > int failure_seen = 0; > int update_seen = 0; > > ... > for (ref = remote_refs; ref; ref = ref->next) { > switch (check_to_send_update(ref, args)) { > case CHECK_REF_STATUS_REJECTED: > failure_seen = 1; > break; This "break" should be "continue" here. We want to exclude the ones that we are not going to send to the other side from the push certificate (in non-atomic case). > case 0: > update_seen = 1; > break; > case REF_STATUS_UPTODATE: > break; /* OK */ > default: > BUG("should not happen"); > } > strbuf_addf(&cert, "%s %s %s\n", > oid_to_hex(&ref->old_oid), > oid_to_hex(&ref->new_oid), > ref->name); > } > if (!update_seen || (use_atomic && failure_seen)) > goto free_return; > > to make it also a no-op when any local rejection under atomic mode? > > Thanks.