diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-03-01 14:02:57 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-03-01 14:02:57 -0800 |
commit | 6ee353d42f389ec9454161b64ffbeb4167edebaa (patch) | |
tree | 408986aa58c00c86025845ff01d7475a9333f933 /pack-write.c | |
parent | Merge branch 'ds/chunked-file-api' (diff) | |
parent | fetch-pack: print and use dangling .gitmodules (diff) | |
download | tgif-6ee353d42f389ec9454161b64ffbeb4167edebaa.tar.xz |
Merge branch 'jt/transfer-fsck-across-packs'
The approach to "fsck" the incoming objects in "index-pack" is
attractive for performance reasons (we have them already in core,
inflated and ready to be inspected), but fundamentally cannot be
applied fully when we receive more than one pack stream, as a tree
object in one pack may refer to a blob object in another pack as
".gitmodules", when we want to inspect blobs that are used as
".gitmodules" file, for example. Teach "index-pack" to emit
objects that must be inspected later and check them in the calling
"fetch-pack" process.
* jt/transfer-fsck-across-packs:
fetch-pack: print and use dangling .gitmodules
fetch-pack: with packfile URIs, use index-pack arg
http-fetch: allow custom index-pack args
http: allow custom index-pack args
Diffstat (limited to 'pack-write.c')
-rw-r--r-- | pack-write.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pack-write.c b/pack-write.c index 680c36755d..2ca85a9d16 100644 --- a/pack-write.c +++ b/pack-write.c @@ -380,7 +380,7 @@ void fixup_pack_header_footer(int pack_fd, fsync_or_die(pack_fd, pack_name); } -char *index_pack_lockfile(int ip_out) +char *index_pack_lockfile(int ip_out, int *is_well_formed) { char packname[GIT_MAX_HEXSZ + 6]; const int len = the_hash_algo->hexsz + 6; @@ -394,11 +394,17 @@ char *index_pack_lockfile(int ip_out) */ if (read_in_full(ip_out, packname, len) == len && packname[len-1] == '\n') { const char *name; + + if (is_well_formed) + *is_well_formed = 1; packname[len-1] = 0; if (skip_prefix(packname, "keep\t", &name)) return xstrfmt("%s/pack/pack-%s.keep", get_object_directory(), name); + return NULL; } + if (is_well_formed) + *is_well_formed = 0; return NULL; } |