794
}
795
796
static int get_pack(struct fetch_pack_args *args,
797
- int xd[2], char **pack_lockfile,
797
+ int xd[2], struct string_list *pack_lockfiles,
798
struct ref **sought, int nr_sought)
799
{
800
struct async demux;
838
}
839
840
if (do_keep || args->from_promisor) {
841
- if (pack_lockfile)
841
+ if (pack_lockfiles)
842
cmd.out = -1;
843
cmd_name = "index-pack";
844
argv_array_push(&cmd.args, cmd_name);
863
* information below. If not, we need index-pack to do it for
864
* us.
865
*/
866
- if (!(do_keep && pack_lockfile) && args->from_promisor)
866
+ if (!(do_keep && pack_lockfiles) && args->from_promisor)
867
argv_array_push(&cmd.args, "--promisor");
868
}
869
else {
899
cmd.git_cmd = 1;
900
if (start_command(&cmd))
901
die(_("fetch-pack: unable to fork off %s"), cmd_name);
902
- if (do_keep && pack_lockfile) {
903
- *pack_lockfile = index_pack_lockfile(cmd.out);
902
+ if (do_keep && pack_lockfiles) {
903
+ string_list_append_nodup(pack_lockfiles,
904
+ index_pack_lockfile(cmd.out));
905
close(cmd.out);
906
}
907
923
* Now that index-pack has succeeded, write the promisor file using the
924
* obtained .keep filename if necessary
925
*/
925
- if (do_keep && pack_lockfile && args->from_promisor)
926
- write_promisor_file(*pack_lockfile, sought, nr_sought);
926
+ if (do_keep && pack_lockfiles && pack_lockfiles->nr && args->from_promisor)
927
+ write_promisor_file(pack_lockfiles->items[0].string, sought, nr_sought);
928
929
return 0;
930
}
941
const struct ref *orig_ref,
942
struct ref **sought, int nr_sought,
943
struct shallow_info *si,
943
- char **pack_lockfile)
944
+ struct string_list *pack_lockfiles)
945
{
946
struct repository *r = the_repository;
947
struct ref *ref = copy_ref_list(orig_ref);
1068
alternate_shallow_file = setup_temporary_shallow(si->shallow);
1069
else
1070
alternate_shallow_file = NULL;
1070
- if (get_pack(args, fd, pack_lockfile, sought, nr_sought))
1071
+ if (get_pack(args, fd, pack_lockfiles, sought, nr_sought))
1072
die(_("git fetch-pack: fetch failed."));
1073
1074
all_done:
1458
struct ref **sought, int nr_sought,
1459
struct oid_array *shallows,
1460
struct shallow_info *si,
1460
- char **pack_lockfile)
1461
+ struct string_list *pack_lockfiles)
1462
{
1463
struct repository *r = the_repository;
1464
struct ref *ref = copy_ref_list(orig_ref);
1560
1561
/* get the pack */
1562
process_section_header(&reader, "packfile", 0);
1562
- if (get_pack(args, fd, pack_lockfile, sought, nr_sought))
1563
+ if (get_pack(args, fd, pack_lockfiles, sought, nr_sought))
1564
die(_("git fetch-pack: fetch failed."));
1565
1566
state = FETCH_DONE;
1760
const struct ref *ref,
1761
struct ref **sought, int nr_sought,
1762
struct oid_array *shallow,
1762
- char **pack_lockfile,
1763
+ struct string_list *pack_lockfiles,
1764
enum protocol_version version)
1765
{
1766
struct ref *ref_cpy;
1795
memset(&si, 0, sizeof(si));
1796
ref_cpy = do_fetch_pack_v2(args, fd, ref, sought, nr_sought,
1797
&shallows_scratch, &si,
1797
- pack_lockfile);
1798
+ pack_lockfiles);
1799
} else {
1800
prepare_shallow_info(&si, shallow);
1801
ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,
1801
- &si, pack_lockfile);
1802
+ &si, pack_lockfiles);
1803
}
1804
reprepare_packed_git(the_repository);
1805