threads / patch / 12735

patchFix tag following

Subject: [PATCH] Fix tag following

## tl;dr

2 messages between Mar 18, 2008 and Mar 19, 2008. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Daniel Barkalow· Mar 18, 2008, 02:15 UTC · lore

Before the second fetch-pack connection in the same process, unmark all of the objects marked in the first connection, in order that we'll list them as things we have instead of thinking we've already mentioned them.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
This fixes David Brownell's test case, at least as far as failing to find 
any common commits. There's still some issue I haven't been able to track 
down where it seems to list the same "have" values for refs the second 
time, despite them having been updated, but that's a much much smaller 
issue.
 builtin-fetch-pack.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
Show changes to builtin-fetch-pack.c +16 −0
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 7b28024..65350ca 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -26,6 +26,8 @@ static const char fetch_pack_usage[] =
 #define SEEN		(1U << 3)
 #define POPPED		(1U << 4)
 
+static int marked;
+
 /*
  * After sending this many "have"s if we do not get any new ACK , we
  * give up traversing our history.
@@ -61,6 +63,16 @@ static int rev_list_insert_ref(const char *path, const unsigned char *sha1, int
 	return 0;
 }
 
+static int clear_marks(const char *path, const unsigned char *sha1, int flag, void *cb_data)
+{
+	struct object *o = deref_tag(parse_object(sha1), path, 0);
+
+	if (o && o->type == OBJ_COMMIT)
+		clear_commit_marks((struct commit *)o,
+				   COMMON | COMMON_REF | SEEN | POPPED);
+	return 0;
+}
+
 /*
    This function marks a rev and its ancestors as common.
    In some cases, it is desirable to mark only the ancestors (for example
@@ -153,6 +165,10 @@ static int find_common(int fd[2], unsigned char *result_sha1,
 	unsigned in_vain = 0;
 	int got_continue = 0;
 
+	if (marked)
+		for_each_ref(clear_marks, NULL);
+	marked = 1;
+
 	for_each_ref(rev_list_insert_ref, NULL);
 
 	fetching = 0;
-- 
1.5.4.3.610.gea6cd
Johannes Schindelin· Mar 19, 2008, 00:28 UTC · re: Daniel Barkalow · lore

Re: [PATCH] Fix tag following

Hi,
On Mon, 17 Mar 2008, Daniel Barkalow wrote:
> Before the second fetch-pack connection in the same process, unmark all 
> of the objects marked in the first connection, in order that we'll list 
> them as things we have instead of thinking we've already mentioned them.
This patch is obviously correct, methinks.

Ciao, Dscho

← back to recent threads