Skip to content

Commit 353a27a

Browse files
committed
Merge branch 'jk/fetch-pack-avoid-sigpipe-to-index-pack'
"git fetch", when received a bad packfile, can fail with SIGPIPE. This wasn't wrong per-se, but we now detect the situation and fail in a more predictable way. * jk/fetch-pack-avoid-sigpipe-to-index-pack: fetch-pack: ignore SIGPIPE when writing to index-pack
2 parents 85ac30f + 2a4aed4 commit 353a27a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fetch-pack.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "shallow.h"
2626
#include "commit-reach.h"
2727
#include "commit-graph.h"
28+
#include "sigchain.h"
2829

2930
static int transfer_unpack_limit = -1;
3031
static int fetch_unpack_limit = -1;
@@ -956,6 +957,8 @@ static int get_pack(struct fetch_pack_args *args,
956957
strvec_push(index_pack_args, cmd.args.v[i]);
957958
}
958959

960+
sigchain_push(SIGPIPE, SIG_IGN);
961+
959962
cmd.in = demux.out;
960963
cmd.git_cmd = 1;
961964
if (start_command(&cmd))
@@ -986,6 +989,8 @@ static int get_pack(struct fetch_pack_args *args,
986989
if (use_sideband && finish_async(&demux))
987990
die(_("error in sideband demultiplexer"));
988991

992+
sigchain_pop(SIGPIPE);
993+
989994
/*
990995
* Now that index-pack has succeeded, write the promisor file using the
991996
* obtained .keep filename if necessary

0 commit comments

Comments
 (0)