Merge branch 'ds/midx-normalize-pathname-before-comparison'
The path taken by "git multi-pack-index" command from the end user was compared with path internally prepared by the tool withut first normalizing, which lead to duplicated paths not being noticed, which has been corrected. * ds/midx-normalize-pathname-before-comparison: cache: use const char * for get_object_directory() multi-pack-index: use --object-dir real path midx: use real paths in lookup_multi_pack_index()
This commit is contained in:
17
midx.c
17
midx.c
@ -1132,17 +1132,26 @@ cleanup:
|
||||
static struct multi_pack_index *lookup_multi_pack_index(struct repository *r,
|
||||
const char *object_dir)
|
||||
{
|
||||
struct multi_pack_index *result = NULL;
|
||||
struct multi_pack_index *cur;
|
||||
char *obj_dir_real = real_pathdup(object_dir, 1);
|
||||
struct strbuf cur_path_real = STRBUF_INIT;
|
||||
|
||||
/* Ensure the given object_dir is local, or a known alternate. */
|
||||
find_odb(r, object_dir);
|
||||
find_odb(r, obj_dir_real);
|
||||
|
||||
for (cur = get_multi_pack_index(r); cur; cur = cur->next) {
|
||||
if (!strcmp(object_dir, cur->object_dir))
|
||||
return cur;
|
||||
strbuf_realpath(&cur_path_real, cur->object_dir, 1);
|
||||
if (!strcmp(obj_dir_real, cur_path_real.buf)) {
|
||||
result = cur;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
cleanup:
|
||||
free(obj_dir_real);
|
||||
strbuf_release(&cur_path_real);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int write_midx_internal(const char *object_dir,
|
||||
|
Reference in New Issue
Block a user