Re: [PATCH 7/9] treewide: use get_all_packs

2018-08-21 Thread Derrick Stolee

On 8/20/2018 6:01 PM, Stefan Beller wrote:

On Mon, Aug 20, 2018 at 9:52 AM Derrick Stolee  wrote:

There are many places in the codebase that want to iterate over
all packfiles known to Git. The purposes are wide-ranging, and
those that can take advantage of the multi-pack-index already
do. So, use get_all_packs() instead of get_packed_git() to be
sure we are iterating over all packfiles.

So get_packed_git shouold not be used any further?
Do we want to annotate it as deprecated, to be deleted
in the future? Or even remove it as part of this series
(that might be an issue with other series in flight).


Perhaps the right thing to do would be to put a big warning over the 
definition to say "only use this if you really don't want 
get_all_packs()" or something. The reason I didn't remove it from 
packfile.h is that it is used in sha1-name.c alongside 
get_multi_pack_index() (so making it 'static' would be incorrect).




Re: [PATCH 7/9] treewide: use get_all_packs

2018-08-20 Thread Stefan Beller
On Mon, Aug 20, 2018 at 9:52 AM Derrick Stolee  wrote:
>
> There are many places in the codebase that want to iterate over
> all packfiles known to Git. The purposes are wide-ranging, and
> those that can take advantage of the multi-pack-index already
> do. So, use get_all_packs() instead of get_packed_git() to be
> sure we are iterating over all packfiles.

So get_packed_git shouold not be used any further?
Do we want to annotate it as deprecated, to be deleted
in the future? Or even remove it as part of this series
(that might be an issue with other series in flight).


[PATCH 7/9] treewide: use get_all_packs

2018-08-20 Thread Derrick Stolee
There are many places in the codebase that want to iterate over
all packfiles known to Git. The purposes are wide-ranging, and
those that can take advantage of the multi-pack-index already
do. So, use get_all_packs() instead of get_packed_git() to be
sure we are iterating over all packfiles.

Signed-off-by: Derrick Stolee 
---
 builtin/count-objects.c  |  2 +-
 builtin/fsck.c   |  4 ++--
 builtin/gc.c |  4 ++--
 builtin/pack-objects.c   | 14 +++---
 builtin/pack-redundant.c |  4 ++--
 fast-import.c|  4 ++--
 http-backend.c   |  4 ++--
 pack-bitmap.c|  2 +-
 pack-objects.c   |  2 +-
 packfile.c   |  2 +-
 server-info.c|  4 ++--
 11 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index d51e2ce1ec..a7cad052c6 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -123,7 +123,7 @@ int cmd_count_objects(int argc, const char **argv, const 
char *prefix)
struct strbuf pack_buf = STRBUF_INIT;
struct strbuf garbage_buf = STRBUF_INIT;
 
-   for (p = get_packed_git(the_repository); p; p = p->next) {
+   for (p = get_all_packs(the_repository); p; p = p->next) {
if (!p->pack_local)
continue;
if (open_pack_index(p))
diff --git a/builtin/fsck.c b/builtin/fsck.c
index c96f3f4fcc..184d8e7f4e 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -740,7 +740,7 @@ int cmd_fsck(int argc, const char **argv, const char 
*prefix)
struct progress *progress = NULL;
 
if (show_progress) {
-   for (p = get_packed_git(the_repository); p;
+   for (p = get_all_packs(the_repository); p;
 p = p->next) {
if (open_pack_index(p))
continue;
@@ -749,7 +749,7 @@ int cmd_fsck(int argc, const char **argv, const char 
*prefix)
 
progress = start_progress(_("Checking 
objects"), total);
}
-   for (p = get_packed_git(the_repository); p;
+   for (p = get_all_packs(the_repository); p;
 p = p->next) {
/* verify gives error messages itself */
if (verify_pack(p, fsck_obj_buffer,
diff --git a/builtin/gc.c b/builtin/gc.c
index 57069442b0..2b592260e9 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -183,7 +183,7 @@ static struct packed_git *find_base_packs(struct 
string_list *packs,
 {
struct packed_git *p, *base = NULL;
 
-   for (p = get_packed_git(the_repository); p; p = p->next) {
+   for (p = get_all_packs(the_repository); p; p = p->next) {
if (!p->pack_local)
continue;
if (limit) {
@@ -208,7 +208,7 @@ static int too_many_packs(void)
if (gc_auto_pack_limit <= 0)
return 0;
 
-   for (cnt = 0, p = get_packed_git(the_repository); p; p = p->next) {
+   for (cnt = 0, p = get_all_packs(the_repository); p; p = p->next) {
if (!p->pack_local)
continue;
if (p->pack_keep)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 4391504a91..1a896d7810 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2784,7 +2784,7 @@ static void add_objects_in_unpacked_packs(struct rev_info 
*revs)
 
memset(&in_pack, 0, sizeof(in_pack));
 
-   for (p = get_packed_git(the_repository); p; p = p->next) {
+   for (p = get_all_packs(the_repository); p; p = p->next) {
struct object_id oid;
struct object *o;
 
@@ -2848,7 +2848,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct 
object_id *oid)
struct packed_git *p;
 
p = (last_found != (void *)1) ? last_found :
-   get_packed_git(the_repository);
+   get_all_packs(the_repository);
 
while (p) {
if ((!p->pack_local || p->pack_keep ||
@@ -2858,7 +2858,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct 
object_id *oid)
return 1;
}
if (p == last_found)
-   p = get_packed_git(the_repository);
+   p = get_all_packs(the_repository);
else
p = p->next;
if (p == last_found)
@@ -2894,7 +2894,7 @@ static void loosen_unused_packed_objects(struct rev_info 
*revs)
uint32_t i;
struct object_id oid;
 
-   for (p = get_packed_git(the_repository); p; p = p->next) {
+   for (p = get_all_packs(the_repository); p; p =