summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2018-06-14 22:54:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-06-15 15:44:24 (GMT)
commitd093bc7582fc60b51b42d2edf32b3ce68cd283eb (patch)
tree3f9c629aa1b82d5dd78ad880fbae602469c14619
parentd30fe89c37b746ac2f3419ae0e3990a9984fb4cf (diff)
downloadgit-d093bc7582fc60b51b42d2edf32b3ce68cd283eb.zip
git-d093bc7582fc60b51b42d2edf32b3ce68cd283eb.tar.gz
git-d093bc7582fc60b51b42d2edf32b3ce68cd283eb.tar.bz2
fetch-pack: move common check and marking together
When receiving 'ACK <object-id> continue' for a common commit, check if the commit was already known to be common and mark it as such if not up front. This should make future refactoring of how the information about common commits is stored more straightforward. No visible change intended. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--fetch-pack.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 86252e1..d076465 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -505,11 +505,14 @@ static int find_common(struct negotiation_state *ns,
case ACK_continue: {
struct commit *commit =
lookup_commit(result_oid);
+ int was_common;
if (!commit)
die(_("invalid commit %s"), oid_to_hex(result_oid));
+ was_common = commit->object.flags & COMMON;
+ mark_common(ns, commit, 0, 1);
if (args->stateless_rpc
&& ack == ACK_common
- && !(commit->object.flags & COMMON)) {
+ && !was_common) {
/* We need to replay the have for this object
* on the next RPC request so the peer knows
* it is in common with us.
@@ -526,7 +529,6 @@ static int find_common(struct negotiation_state *ns,
} else if (!args->stateless_rpc
|| ack != ACK_common)
in_vain = 0;
- mark_common(ns, commit, 0, 1);
retval = 0;
got_continue = 1;
if (ack == ACK_ready)