Skip to content

Commit ef3a4fd

Browse files
committed
Merge branch 'np/maint-sideband-favor-status' into maint
* np/maint-sideband-favor-status: give priority to progress messages
2 parents 59a0a0b + 6b59f51 commit ef3a4fd

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

builtin-upload-archive.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix)
132132

133133
while (1) {
134134
struct pollfd pfd[2];
135-
ssize_t processed[2] = { 0, 0 };
136135
int status;
137136

138137
pfd[0].fd = fd1[0];
@@ -147,15 +146,14 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix)
147146
}
148147
continue;
149148
}
150-
if (pfd[0].revents & POLLIN)
151-
/* Data stream ready */
152-
processed[0] = process_input(pfd[0].fd, 1);
153149
if (pfd[1].revents & POLLIN)
154150
/* Status stream ready */
155-
processed[1] = process_input(pfd[1].fd, 2);
156-
/* Always finish to read data when available */
157-
if (processed[0] || processed[1])
158-
continue;
151+
if (process_input(pfd[1].fd, 2))
152+
continue;
153+
if (pfd[0].revents & POLLIN)
154+
/* Data stream ready */
155+
if (process_input(pfd[0].fd, 1))
156+
continue;
159157

160158
if (waitpid(writer, &status, 0) < 0)
161159
error_clnt("%s", lostchild);

upload-pack.c

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,23 @@ static void create_pack_file(void)
308308
}
309309
continue;
310310
}
311+
if (0 <= pe && (pfd[pe].revents & (POLLIN|POLLHUP))) {
312+
/* Status ready; we ship that in the side-band
313+
* or dump to the standard error.
314+
*/
315+
sz = xread(pack_objects.err, progress,
316+
sizeof(progress));
317+
if (0 < sz)
318+
send_client_data(2, progress, sz);
319+
else if (sz == 0) {
320+
close(pack_objects.err);
321+
pack_objects.err = -1;
322+
}
323+
else
324+
goto fail;
325+
/* give priority to status messages */
326+
continue;
327+
}
311328
if (0 <= pu && (pfd[pu].revents & (POLLIN|POLLHUP))) {
312329
/* Data ready; we keep the last byte to ourselves
313330
* in case we detect broken rev-list, so that we
@@ -345,21 +362,6 @@ static void create_pack_file(void)
345362
if (sz < 0)
346363
goto fail;
347364
}
348-
if (0 <= pe && (pfd[pe].revents & (POLLIN|POLLHUP))) {
349-
/* Status ready; we ship that in the side-band
350-
* or dump to the standard error.
351-
*/
352-
sz = xread(pack_objects.err, progress,
353-
sizeof(progress));
354-
if (0 < sz)
355-
send_client_data(2, progress, sz);
356-
else if (sz == 0) {
357-
close(pack_objects.err);
358-
pack_objects.err = -1;
359-
}
360-
else
361-
goto fail;
362-
}
363365
}
364366

365367
if (finish_command(&pack_objects)) {

0 commit comments

Comments
 (0)