Skip to content

Commit 476e424

Browse files
committed
Merge branch 'jk/maint-upload-pack-shallow' into maint
* jk/maint-upload-pack-shallow: upload-pack: start pack-objects before async rev-list
2 parents e9f1878 + b961219 commit 476e424

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

upload-pack.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,8 @@ static void create_pack_file(void)
157157
const char *argv[10];
158158
int arg = 0;
159159

160-
if (shallow_nr) {
161-
memset(&rev_list, 0, sizeof(rev_list));
162-
rev_list.proc = do_rev_list;
163-
rev_list.out = -1;
164-
if (start_async(&rev_list))
165-
die("git upload-pack: unable to fork git-rev-list");
166-
argv[arg++] = "pack-objects";
167-
} else {
168-
argv[arg++] = "pack-objects";
160+
argv[arg++] = "pack-objects";
161+
if (!shallow_nr) {
169162
argv[arg++] = "--revs";
170163
if (create_full_pack)
171164
argv[arg++] = "--all";
@@ -183,7 +176,7 @@ static void create_pack_file(void)
183176
argv[arg++] = NULL;
184177

185178
memset(&pack_objects, 0, sizeof(pack_objects));
186-
pack_objects.in = shallow_nr ? rev_list.out : -1;
179+
pack_objects.in = -1;
187180
pack_objects.out = -1;
188181
pack_objects.err = -1;
189182
pack_objects.git_cmd = 1;
@@ -192,8 +185,14 @@ static void create_pack_file(void)
192185
if (start_command(&pack_objects))
193186
die("git upload-pack: unable to fork git-pack-objects");
194187

195-
/* pass on revisions we (don't) want */
196-
if (!shallow_nr) {
188+
if (shallow_nr) {
189+
memset(&rev_list, 0, sizeof(rev_list));
190+
rev_list.proc = do_rev_list;
191+
rev_list.out = pack_objects.in;
192+
if (start_async(&rev_list))
193+
die("git upload-pack: unable to fork git-rev-list");
194+
}
195+
else {
197196
FILE *pipe_fd = xfdopen(pack_objects.in, "w");
198197
if (!create_full_pack) {
199198
int i;

0 commit comments

Comments
 (0)