Merge branch 'tl/pack-bitmap-absolute-paths'
The pack-bitmap machinery is taught to log the paths of redundant bitmap(s) to trace2 instead of stderr. * tl/pack-bitmap-absolute-paths: pack-bitmap.c: trace bitmap ignore logs when midx-bitmap is found pack-bitmap.c: break out of the bitmap loop early if not tracing pack-bitmap.c: avoid exposing absolute paths pack-bitmap.c: remove unnecessary "open_pack_index()" calls
This commit is contained in:
commit
a1b8e5ec28
@ -354,8 +354,8 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
|
|||||||
if (bitmap_git->pack || bitmap_git->midx) {
|
if (bitmap_git->pack || bitmap_git->midx) {
|
||||||
struct strbuf buf = STRBUF_INIT;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
get_midx_filename(&buf, midx->object_dir);
|
get_midx_filename(&buf, midx->object_dir);
|
||||||
/* ignore extra bitmap file; we can only handle one */
|
trace2_data_string("bitmap", the_repository,
|
||||||
warning(_("ignoring extra bitmap file: '%s'"), buf.buf);
|
"ignoring extra midx bitmap file", buf.buf);
|
||||||
close(fd);
|
close(fd);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
return -1;
|
return -1;
|
||||||
@ -411,9 +411,6 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
char *bitmap_name;
|
char *bitmap_name;
|
||||||
|
|
||||||
if (open_pack_index(packfile))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
bitmap_name = pack_bitmap_filename(packfile);
|
bitmap_name = pack_bitmap_filename(packfile);
|
||||||
fd = git_open(bitmap_name);
|
fd = git_open(bitmap_name);
|
||||||
|
|
||||||
@ -432,8 +429,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bitmap_git->pack || bitmap_git->midx) {
|
if (bitmap_git->pack || bitmap_git->midx) {
|
||||||
/* ignore extra bitmap file; we can only handle one */
|
trace2_data_string("bitmap", the_repository,
|
||||||
warning(_("ignoring extra bitmap file: '%s'"), packfile->pack_name);
|
"ignoring extra bitmap file", packfile->pack_name);
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -458,6 +455,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trace2_data_string("bitmap", the_repository, "opened bitmap file",
|
||||||
|
packfile->pack_name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,11 +524,16 @@ static int open_pack_bitmap(struct repository *r,
|
|||||||
struct packed_git *p;
|
struct packed_git *p;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
assert(!bitmap_git->map);
|
|
||||||
|
|
||||||
for (p = get_all_packs(r); p; p = p->next) {
|
for (p = get_all_packs(r); p; p = p->next) {
|
||||||
if (open_pack_bitmap_1(bitmap_git, p) == 0)
|
if (open_pack_bitmap_1(bitmap_git, p) == 0) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
/*
|
||||||
|
* The only reason to keep looking is to report
|
||||||
|
* duplicates.
|
||||||
|
*/
|
||||||
|
if (!trace2_is_enabled())
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -553,11 +557,20 @@ static int open_midx_bitmap(struct repository *r,
|
|||||||
static int open_bitmap(struct repository *r,
|
static int open_bitmap(struct repository *r,
|
||||||
struct bitmap_index *bitmap_git)
|
struct bitmap_index *bitmap_git)
|
||||||
{
|
{
|
||||||
|
int found;
|
||||||
|
|
||||||
assert(!bitmap_git->map);
|
assert(!bitmap_git->map);
|
||||||
|
|
||||||
if (!open_midx_bitmap(r, bitmap_git))
|
found = !open_midx_bitmap(r, bitmap_git);
|
||||||
return 0;
|
|
||||||
return open_pack_bitmap(r, bitmap_git);
|
/*
|
||||||
|
* these will all be skipped if we opened a midx bitmap; but run it
|
||||||
|
* anyway if tracing is enabled to report the duplicates
|
||||||
|
*/
|
||||||
|
if (!found || trace2_is_enabled())
|
||||||
|
found |= !open_pack_bitmap(r, bitmap_git);
|
||||||
|
|
||||||
|
return found ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bitmap_index *prepare_bitmap_git(struct repository *r)
|
struct bitmap_index *prepare_bitmap_git(struct repository *r)
|
||||||
|
@ -428,8 +428,9 @@ test_bitmap_cases () {
|
|||||||
test_line_count = 2 packs &&
|
test_line_count = 2 packs &&
|
||||||
test_line_count = 2 bitmaps &&
|
test_line_count = 2 bitmaps &&
|
||||||
|
|
||||||
git rev-list --use-bitmap-index HEAD 2>err &&
|
GIT_TRACE2_EVENT=$(pwd)/trace2.txt git rev-list --use-bitmap-index HEAD &&
|
||||||
grep "ignoring extra bitmap file" err
|
grep "opened bitmap" trace2.txt &&
|
||||||
|
grep "ignoring extra bitmap" trace2.txt
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user