Skip to content

nd/shallow-deepen updates

Nguyễn Thái Ngọc Duy git 2 versions New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest27 patches 0 repliesNew
  2. v127 patches 8 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/27remote-curl.c: convert fetch_git() to use argv_arrayremote-curl.c+18 -280 replies
2/27transport-helper.c: refactor set_helper_option()transport-helper.c+23 -140 replies
3/27upload-pack: move shallow deepen code out of receive_needs()upload-pack.c+52 -470 replies
4/27upload-pack: move "shallow" sending code out of deepen()upload-pack.c+15 -100 replies
5/27upload-pack: remove unused variable "backup"upload-pack.c+4 -50 replies
6/27upload-pack: move "unshallow" sending code out of deepen()upload-pack.c+30 -130 replies
7/27upload-pack: use skip_prefix() instead of starts_with()upload-pack.c+18 -140 replies
8/27upload-pack: tighten number parsing at "deepen" linesupload-pack.c+2 -20 replies
9/27upload-pack: make check_non_tip() clean things up on errorupload-pack.c+16 -70 replies
10/27upload-pack: move rev-list code out of check_non_tip()upload-pack.c+23 -130 replies
11/27fetch-pack: use skip_prefix() instead of starts_with()builtin/fetch-pack.c+6 -60 replies
12/27fetch-pack: use a common function for verbose printingfetch-pack.c+42 -460 replies
13/27fetch-pack.c: mark strings for translatingfetch-pack.c+37 -380 replies
14/27fetch-pack: use a separate flag for fetch in deepening modefetch-pack.c fetch-pack.h+9 -60 replies
15/27shallow.c: implement a generic shallow boundary finder based on rev-listcommit.h shallow.c+80 -00 replies
16/27upload-pack: add deepen-since to cut shallow repos based on timeDocumentation/technical/pack-protocol.txt Documentation/technical/protocol-capabilities.txt upload-pack.c+54 -30 replies
17/27fetch: define shallow boundary with --shallow-sinceDocumentation/fetch-options.txt Documentation/git-fetch-pack.txt Documentation/gitremote-helpers.txt +7 more+67 -90 replies
18/27clone: define shallow clone boundary based on time with --shallow-sinceDocumentation/git-clone.txt builtin/clone.c+16 -30 replies
19/27t5500, t5539: tests for shallow depth since a specific datet/t5500-fetch-pack.sh t/t5539-fetch-http-shallow.sh+49 -00 replies
20/27refs: add expand_ref()refs.c refs.h+8 -10 replies
21/27upload-pack: support define shallow boundary by excluding revisionsDocumentation/technical/pack-protocol.txt Documentation/technical/protocol-capabilities.txt upload-pack.c+32 -30 replies
22/27fetch: define shallow boundary with --shallow-excludeDocumentation/fetch-options.txt Documentation/git-fetch-pack.txt Documentation/gitremote-helpers.txt +8 more+89 -40 replies
23/27clone: define shallow clone boundary with --shallow-excludeDocumentation/git-clone.txt builtin/clone.c+14 -10 replies
24/27t5500, t5539: tests for shallow depth excluding a reft/t5500-fetch-pack.sh t/t5539-fetch-http-shallow.sh+43 -00 replies
25/27upload-pack: split check_unreachable() in two, prep for get_reachable_list()upload-pack.c+38 -180 replies
26/27upload-pack: add get_reachable_list()object.h upload-pack.c+50 -40 replies
27/27fetch, upload-pack: --deepen=N extends shallow boundary by N commitsDocumentation/fetch-options.txt Documentation/git-fetch-pack.txt Documentation/gitremote-helpers.txt +12 more+132 -60 replies

Reviews trailers per patch

None of the 27 patches has a Reviewed-by or Acked-by.

PatchDuy NguyenEric SunshineJunio C Hamano
1/27
2/27
3/27
4/27
5/27
6/27
7/27
8/27
9/27
10/27
11/27
12/27
13/27
14/27
15/27
16/27
17/27
18/27
19/27
20/27
21/27
22/27
23/27
24/27
25/27
26/27
27/27Helped-by Helped-by Helped-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/27] nd/shallow-deepen updates

Second update to address Junio comments. Interdiff

upload-pack.c +36 -28
index ef693bd..e40d15a 100644
@@ -453,6 +453,9 @@ static int is_our_ref(struct object *o)
 	return o->flags & ((allow_hidden_ref ? HIDDEN_REF : 0) | OUR_REF);
 }
 
+/*
+ * on successful case, it's up to the caller to close cmd->out
+ */
 static int do_reachable_revlist(struct child_process *cmd,
 				struct object_array *src,
 				struct object_array *reachable)
@@ -470,16 +473,16 @@ static int do_reachable_revlist(struct child_process *cmd,
 	cmd->in = -1;
 	cmd->out = -1;
 
-	if (start_command(cmd))
-		goto error;
-
 	/*
-	 * If rev-list --stdin encounters an unknown commit, it
-	 * terminates, which will cause SIGPIPE in the write loop
+	 * If the next rev-list --stdin encounters an unknown commit,
+	 * it terminates, which will cause SIGPIPE in the write loop
 	 * below.
 	 */
 	sigchain_push(SIGPIPE, SIG_IGN);
 
+	if (start_command(cmd))
+		goto error;
+
 	namebuf[0] = '^';
 	namebuf[41] = '\n';
 	for (i = get_max_object_index(); 0 < i; ) {
@@ -491,10 +494,8 @@ static int do_reachable_revlist(struct child_process *cmd,
 		if (!is_our_ref(o))
 			continue;
 		memcpy(namebuf + 1, oid_to_hex(&o->oid), GIT_SHA1_HEXSZ);
-		if (write_in_full(cmd->in, namebuf, 42) < 0) {
-			sigchain_pop(SIGPIPE);
+		if (write_in_full(cmd->in, namebuf, 42) < 0)
 			goto error;
-		}
 	}
 	namebuf[40] = '\n';
 	for (i = 0; i < src->nr; i++) {
@@ -507,18 +508,18 @@ static int do_reachable_revlist(struct child_process *cmd,
 		if (reachable && o->type == OBJ_COMMIT)
 			o->flags |= TMP_MARK;
 		memcpy(namebuf, oid_to_hex(&o->oid), GIT_SHA1_HEXSZ);
-		if (write_in_full(cmd->in, namebuf, 41) < 0) {
-			sigchain_pop(SIGPIPE);
+		if (write_in_full(cmd->in, namebuf, 41) < 0)
 			goto error;
-		}
 	}
 	close(cmd->in);
 	cmd->in = -1;
-
 	sigchain_pop(SIGPIPE);
+
 	return 0;
 
 error:
+	sigchain_pop(SIGPIPE);
+
 	if (cmd->in >= 0)
 		close(cmd->in);
 	if (cmd->out >= 0)
@@ -530,11 +531,11 @@ static int get_reachable_list(struct object_array *src,
 			      struct object_array *reachable)
 {
 	struct child_process cmd = CHILD_PROCESS_INIT;
-	int i, ret = do_reachable_revlist(&cmd, src, reachable);
+	int i;
 	struct object *o;
 	char namebuf[42]; /* ^ + SHA-1 + LF */
 
-	if (ret < 0)
+	if (do_reachable_revlist(&cmd, src, reachable) < 0)
 		return -1;
 
 	while ((i = read_in_full(cmd.out, namebuf, 41)) == 41) {
@@ -564,14 +565,14 @@ static int get_reachable_list(struct object_array *src,
 	return 0;
 }
 
-static int check_unreachable(struct object_array *src)
+static int has_unreachable(struct object_array *src)
 {
 	struct child_process cmd = CHILD_PROCESS_INIT;
 	char buf[1];
 	int i;
 
 	if (do_reachable_revlist(&cmd, src, NULL) < 0)
-		return 0;
+		return 1;
 
 	/*
 	 * The commits out of the rev-list are not ancestors of
@@ -592,14 +593,13 @@ static int check_unreachable(struct object_array *src)
 		goto error;
 
 	/* All the non-tip ones are ancestors of what we advertised */
-	return 1;
+	return 0;
 
 error:
-	if (cmd.in >= 0)
-		close(cmd.in);
+	sigchain_pop(SIGPIPE);
 	if (cmd.out >= 0)
 		close(cmd.out);
-	return 0;
+	return 1;
 }
 
 static void check_non_tip(void)
@@ -613,7 +613,7 @@ static void check_non_tip(void)
 	 */
 	if (!stateless_rpc && !(allow_unadvertised_object_request & ALLOW_REACHABLE_SHA1))
 		goto error;
-	if (check_unreachable(&want_obj))
+	if (!has_unreachable(&want_obj))
 		/* All the non-tip ones are ancestors of what we advertised */
 		return;
 
@@ -678,25 +678,33 @@ static void send_unshallow(const struct object_array *shallows)
 static void deepen(int depth, int deepen_relative,
 		   struct object_array *shallows)
 {
-	struct commit_list *result = NULL;
-	int i;
-	if (depth == INFINITE_DEPTH && !is_repository_shallow())
+	if (depth == INFINITE_DEPTH && !is_repository_shallow()) {
+		int i;
+
 		for (i = 0; i < shallows->nr; i++) {
 			struct object *object = shallows->objects[i].item;
 			object->flags |= NOT_SHALLOW;
 		}
-	else if (deepen_relative) {
+	} else if (deepen_relative) {
 		struct object_array reachable_shallows = OBJECT_ARRAY_INIT;
+		struct commit_list *result;
+
 		get_reachable_list(shallows, &reachable_shallows);
 		result = get_shallow_commits(&reachable_shallows,
 					     depth + 1,
 					     SHALLOW, NOT_SHALLOW);
+		send_shallow(result);
+		free_commit_list(result);
 		object_array_clear(&reachable_shallows);
-	} else
+	} else {
+		struct commit_list *result;
+
 		result = get_shallow_commits(&want_obj, depth,
 					     SHALLOW, NOT_SHALLOW);
-	send_shallow(result);
-	free_commit_list(result);
+		send_shallow(result);
+		free_commit_list(result);
+	}
+
 	send_unshallow(shallows);
 	packet_flush(1);
 }
Signature · 1 line
2.8.2.524.g6ff3d78