git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/5] Remove --kept-pack-only option and associated infrastructure

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Mar 20, 2009, 03:47 UTC
Message-ID
<t_s5aa51o2kq_ePRWgLTEuhVqJ8uEP2M4mNXlcR5bTOSGntvtmK1-2zwj9VIPyIUzDg3JDg57Nk@cipher.nrlssc.navy.mil>
In-Reply-To
<t_s5aa51o2kq_ePRWgLTEtCnzveAKdblNoXw2p9yc1N22fpuARDjOh9wRXpwEKvultyJoNzUWBY@cipher.nrlssc.navy.mil>
This option to pack-objects/rev-list was created to improve the -A and -a
options of repack.  It was found to be lacking in that it did not provide
the ability to differentiate between local and non-local kept packs, and
found to be unnecessary since objects residing in local kept packs can be
filtered out by the --honor-pack-keep option.
---
 builtin-pack-objects.c |    1 -
 cache.h                |    1 -
 revision.c             |    9 +--------
 revision.h             |    1 -
 sha1_file.c            |   21 +--------------------
 5 files changed, 2 insertions(+), 31 deletions(-)
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 22d69ef..24f96f0 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -2200,7 +2200,6 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 			continue;
 		}
 		if (!strcmp("--unpacked", arg) ||
-		    !strcmp("--kept-pack-only", arg) ||
 		    !strcmp("--reflog", arg) ||
 		    !strcmp("--all", arg)) {
 			use_internal_rev_list = 1;
diff --git a/cache.h b/cache.h
index 39789ee..a94cf67 100644
--- a/cache.h
+++ b/cache.h
@@ -646,7 +646,6 @@ extern int check_sha1_signature(const unsigned char *sha1, void *buf, unsigned l
 extern int move_temp_to_file(const char *tmpfile, const char *filename);
 
 extern int has_sha1_pack(const unsigned char *sha1);
-extern int has_sha1_kept_pack(const unsigned char *sha1);
 extern int has_sha1_file(const unsigned char *sha1);
 extern int has_loose_object_nonlocal(const unsigned char *sha1);
 
diff --git a/revision.c b/revision.c
index f5771c7..b6215cc 100644
--- a/revision.c
+++ b/revision.c
@@ -1106,10 +1106,6 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 		revs->edge_hint = 1;
 	} else if (!strcmp(arg, "--unpacked")) {
 		revs->unpacked = 1;
-		revs->kept_pack_only = 0;
-	} else if (!strcmp(arg, "--kept-pack-only")) {
-		revs->unpacked = 1;
-		revs->kept_pack_only = 1;
 	} else if (!prefixcmp(arg, "--unpacked=")) {
 		die("--unpacked=<packfile> no longer supported.");
 	} else if (!strcmp(arg, "-r")) {
@@ -1679,10 +1675,7 @@ enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)
 {
 	if (commit->object.flags & SHOWN)
 		return commit_ignore;
-	if (revs->unpacked &&
-	    (revs->kept_pack_only
-	     ? has_sha1_kept_pack(commit->object.sha1)
-	     : has_sha1_pack(commit->object.sha1)))
+	if (revs->unpacked && has_sha1_pack(commit->object.sha1))
 		return commit_ignore;
 	if (revs->show_all)
 		return commit_show;
diff --git a/revision.h b/revision.h
index ad123d7..6e98b71 100644
--- a/revision.h
+++ b/revision.h
@@ -50,7 +50,6 @@ struct rev_info {
 			edge_hint:1,
 			limited:1,
 			unpacked:1,
-			kept_pack_only:1,
 			boundary:2,
 			left_right:1,
 			rewrite_parents:1,
diff --git a/sha1_file.c b/sha1_file.c
index 4563173..a354f06 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1919,8 +1919,7 @@ off_t find_pack_entry_one(const unsigned char *sha1,
 	return 0;
 }
 
-static int find_pack_ent(const unsigned char *sha1, struct pack_entry *e,
-			 int kept_pack_only)
+static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
 {
 	static struct packed_git *last_found = (void *)1;
 	struct packed_git *p;
@@ -1932,8 +1931,6 @@ static int find_pack_ent(const unsigned char *sha1, struct pack_entry *e,
 	p = (last_found == (void *)1) ? packed_git : last_found;
 
 	do {
-		if (kept_pack_only && !p->pack_keep)
-			goto next;
 		if (p->num_bad_objects) {
 			unsigned i;
 			for (i = 0; i < p->num_bad_objects; i++)
@@ -1973,16 +1970,6 @@ static int find_pack_ent(const unsigned char *sha1, struct pack_entry *e,
 	return 0;
 }
 
-static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
-{
-	return find_pack_ent(sha1, e, 0);
-}
-
-static int find_kept_pack_entry(const unsigned char *sha1, struct pack_entry *e)
-{
-	return find_pack_ent(sha1, e, 1);
-}
-
 struct packed_git *find_sha1_pack(const unsigned char *sha1,
 				  struct packed_git *packs)
 {
@@ -2456,12 +2443,6 @@ int has_sha1_pack(const unsigned char *sha1)
 	return find_pack_entry(sha1, &e);
 }
 
-int has_sha1_kept_pack(const unsigned char *sha1)
-{
-	struct pack_entry e;
-	return find_kept_pack_entry(sha1, &e);
-}
-
 int has_sha1_file(const unsigned char *sha1)
 {
 	struct pack_entry e;
-- 
1.6.2.16.geb16e
Previous: Brandon CaseyNext: Brandon Casey
Message 16 of 17 in “"git repack -a -d" improvements”
  1. 0/6 "git repack -a -d" improvementsJunio C Hamano, Feb 28, 2009
  2. 1/6 git-repack: resist stray environment variableJunio C Hamano, Feb 28, 2009
  3. 2/6 has_sha1_pack(): refactor "pretend these packs do not exist" interfaceJunio C Hamano, Feb 28, 2009
  4. 3/6 has_sha1_kept_pack(): take "struct rev_info"Junio C Hamano, Feb 28, 2009
  5. 4/6 Consolidate ignore_packed logic moreJunio C Hamano, Feb 28, 2009
  6. 5/6 Simplify is_kept_pack()Junio C Hamano, Feb 28, 2009
  7. 6/6 is_kept_pack(): final clean-upJunio C Hamano, Feb 28, 2009
  8. Kjetil BarvikFeb 28, 2009
  9. Junio C HamanoFeb 28, 2009
  10. Brandon CaseyMar 18, 2009
  11. 0/5 repack improvementsBrandon Casey, Mar 20, 2009
  12. 1/5 t7700-repack: add two new tests demonstrating repacking flawsBrandon Casey, Mar 20, 2009
  13. 2/5 git-repack.sh: don't use --kept-pack-only option to pack-objectsBrandon Casey, Mar 20, 2009
  14. 3/5 pack-objects: only repack or loosen objects residing in "local" packsBrandon Casey, Mar 20, 2009
  15. 4/5 t7700-repack: repack -a now works properly, expect success from testBrandon Casey, Mar 20, 2009
  16. 5/5 Remove --kept-pack-only option and associated infrastructureBrandon Casey, Mar 20, 2009
  17. Brandon CaseyMar 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.