Git fork

Merge branch 'cb/plug-leaks-in-alloca-emu-users'

Leakfix.

* cb/plug-leaks-in-alloca-emu-users:
t0000: avoid masking git exit value through pipes
tree-diff: fix leak when not HAVE_ALLOCA_H

+15 -12
+12 -11
t/t0000-basic.sh
··· 1271 1271 1272 1272 test_expect_success 'git commit-tree records the correct tree in a commit' ' 1273 1273 commit0=$(echo NO | git commit-tree $P) && 1274 - tree=$(git show --pretty=raw $commit0 | 1275 - sed -n -e "s/^tree //p" -e "/^author /q") && 1274 + git show --pretty=raw $commit0 >out && 1275 + tree=$(sed -n -e "s/^tree //p" -e "/^author /q" out) && 1276 1276 test "z$tree" = "z$P" 1277 1277 ' 1278 1278 1279 1279 test_expect_success 'git commit-tree records the correct parent in a commit' ' 1280 1280 commit1=$(echo NO | git commit-tree $P -p $commit0) && 1281 - parent=$(git show --pretty=raw $commit1 | 1282 - sed -n -e "s/^parent //p" -e "/^author /q") && 1281 + git show --pretty=raw $commit1 >out && 1282 + parent=$(sed -n -e "s/^parent //p" -e "/^author /q" out) && 1283 1283 test "z$commit0" = "z$parent" 1284 1284 ' 1285 1285 1286 1286 test_expect_success 'git commit-tree omits duplicated parent in a commit' ' 1287 1287 commit2=$(echo NO | git commit-tree $P -p $commit0 -p $commit0) && 1288 - parent=$(git show --pretty=raw $commit2 | 1289 - sed -n -e "s/^parent //p" -e "/^author /q" | 1290 - sort -u) && 1288 + git show --pretty=raw $commit2 >out && 1289 + cat >match.sed <<-\EOF && 1290 + s/^parent //p 1291 + /^author /q 1292 + EOF 1293 + parent=$(sed -n -f match.sed out | sort -u) && 1291 1294 test "z$commit0" = "z$parent" && 1292 - numparent=$(git show --pretty=raw $commit2 | 1293 - sed -n -e "s/^parent //p" -e "/^author /q" | 1294 - wc -l) && 1295 - test $numparent = 1 1295 + git show --pretty=raw $commit2 >out && 1296 + test_stdout_line_count = 1 sed -n -f match.sed out 1296 1297 ' 1297 1298 1298 1299 test_expect_success 'update-index D/F conflict' '
+3 -1
tree-diff.c
··· 21 21 ALLOC_ARRAY((x), nr); \ 22 22 } while(0) 23 23 #define FAST_ARRAY_FREE(x, nr) do { \ 24 - if ((nr) > 2) \ 24 + if ((nr) <= 2) \ 25 + xalloca_free((x)); \ 26 + else \ 25 27 free((x)); \ 26 28 } while(0) 27 29