Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH] Add --no-reuse-delta, --window, and --depth options to

From: Nicolas Pitre <hidden>
Date: 2016-06-15 22:43:09

On Tue, 8 May 2007, Junio C Hamano wrote:
Nicolas Pitre [off-list ref] writes:
quoted
@@ -65,7 +65,20 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 	if (run_command_v_opt(argv_reflog, RUN_GIT_CMD))
 		return error(FAILED_RUN, argv_reflog[0]);
 
-	if (run_command_v_opt(argv_repack, RUN_GIT_CMD))
+	if (num_loose_objects() > 0) {
+		do_repack = 1;
+	} else {
+		struct packed_git *p;
+		unsigned long num_pack = 0;
+		if (!packed_git)
+			prepare_packed_git();
+		for (p = packed_git; p; p = p->next)
+			if (p->pack_local)
+				num_pack++;
+		if (num_pack > 1)
+			do_repack = 1;
+	}
+	if (do_repack && run_command_v_opt(argv_repack, RUN_GIT_CMD))
 		return error(FAILED_RUN, argv_repack[0]);
 
 	if (prune && run_command_v_opt(argv_prune, RUN_GIT_CMD))
Is this even correct?

When your repository is fully packed, if you decided to discard
one of your topic branches with "git branch -D", what does this
code do?  We see no loose objects, we see only one pack, so the
unreachable objects are left in the pack?
Right.  OK, scrap that.


Nicolas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help