From b8431b033f9e60f87a75b864612873307a3e5966 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 27 Feb 2009 23:30:38 -0800 Subject: has_sha1_kept_pack(): take "struct rev_info" Its "ignore_packed" parameter always comes from struct rev_info. This patch makes the function take a pointer to the surrounding structure, so that the refactoring in the next patch becomes easier to review. There is an unfortunate header file dependency and the easiest workaround is to temporarily move the function declaration from cache.h to revision.h; this will be moved back to cache.h once the function loses this "ignore_packed" parameter altogether in the later part of the series. Signed-off-by: Junio C Hamano --- revision.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'revision.h') diff --git a/revision.h b/revision.h index 91f194478b..930429625f 100644 --- a/revision.h +++ b/revision.h @@ -158,4 +158,6 @@ enum commit_action { extern enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit); +extern int has_sha1_kept_pack(const unsigned char *sha1, const struct rev_info *); + #endif -- cgit v1.2.3 From 386cb77210cdb09cd808698d21d0e796cd77f26f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 27 Feb 2009 23:43:37 -0800 Subject: Consolidate ignore_packed logic more This refactors three loops that check if a given packfile is on the ignore_packed list into a function is_kept_pack(). The function returns false for a pack on the list, and true for a pack not on the list, because this list is solely used by "git repack" to pass list of packfiles that do not have corresponding .keep files, i.e. a packfile not on the list is "kept". Signed-off-by: Junio C Hamano --- revision.h | 1 + 1 file changed, 1 insertion(+) (limited to 'revision.h') diff --git a/revision.h b/revision.h index 930429625f..af414e5d94 100644 --- a/revision.h +++ b/revision.h @@ -159,5 +159,6 @@ enum commit_action { extern enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit); extern int has_sha1_kept_pack(const unsigned char *sha1, const struct rev_info *); +extern int is_kept_pack(const struct packed_git *, const struct rev_info *); #endif -- cgit v1.2.3 From 03a9683d22eca52bc2b2b9b09258a143e76416f6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 28 Feb 2009 00:00:21 -0800 Subject: Simplify is_kept_pack() This removes --unpacked= parameter from the revision parser, and rewrites its use in git-repack to pass a single --kept-pack-only option instead. The new --kept-pack-only option means just that. When this option is given, is_kept_pack() that used to say "not on the --unpacked= list" now says "the packfile has corresponding .keep file". Signed-off-by: Junio C Hamano --- revision.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'revision.h') diff --git a/revision.h b/revision.h index af414e5d94..f63596ff45 100644 --- a/revision.h +++ b/revision.h @@ -47,7 +47,8 @@ struct rev_info { blob_objects:1, edge_hint:1, limited:1, - unpacked:1, /* see also ignore_packed below */ + unpacked:1, + kept_pack_only:1, boundary:2, left_right:1, rewrite_parents:1, @@ -75,9 +76,6 @@ struct rev_info { missing_newline:1; enum date_mode date_mode; - const char **ignore_packed; /* pretend objects in these are unpacked */ - int num_ignore_packed; - unsigned int abbrev; enum cmit_fmt commit_format; struct log_info *loginfo; @@ -159,6 +157,6 @@ enum commit_action { extern enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit); extern int has_sha1_kept_pack(const unsigned char *sha1, const struct rev_info *); -extern int is_kept_pack(const struct packed_git *, const struct rev_info *); +extern int is_kept_pack(const struct packed_git *); #endif -- cgit v1.2.3 From 69e020ae00ebd3f7ae3c2f35acb139361417ef64 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 28 Feb 2009 00:37:19 -0800 Subject: is_kept_pack(): final clean-up Now is_kept_pack() is just a member lookup into a structure, we can write it as such. Also rewrite the sole caller of has_sha1_kept_pack() to switch on the criteria the callee uses (namely, revs->kept_pack_only) between calling has_sha1_kept_pack() and has_sha1_pack(), so that these two callees do not have to take a pointer to struct rev_info as an argument. This removes the header file dependency issue temporarily introduced by the earlier commit, so we revert changes associated to that as well. Signed-off-by: Junio C Hamano --- revision.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'revision.h') diff --git a/revision.h b/revision.h index f63596ff45..b9fa9c2a67 100644 --- a/revision.h +++ b/revision.h @@ -156,7 +156,4 @@ enum commit_action { extern enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit); -extern int has_sha1_kept_pack(const unsigned char *sha1, const struct rev_info *); -extern int is_kept_pack(const struct packed_git *); - #endif -- cgit v1.2.3