Re: [PATCH] fix hang in git fetch if pointed at a 0 length bundle
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Jan 3, 2012, 08:35 UTC
- Message-ID
- <4F02BDEC.9060407@kdbg.org>
- In-Reply-To
- <20120103011352.GA13825@localhost>
Am 03.01.2012 02:13, schrieb Brian Harring:
> git-repo if interupted at the exact wrong time will generate zero > length bundles- literal empty files. git-repo is wrong here, but > git fetch shouldn't effectively spin loop if pointed at a zero > length bundle.
Adding a test case is very much appreciated.
> +test_expect_success 'die if bundle file is empty' '
How about 'empty bundle file is rejected'?
> + > + echo -n > empty-bundle
'echo -n' is not portable; use simply
>empty-bundle &&
(note the style: no blank after >). Also chain commands using &&.
> + timeout 5 git fetch empty-bundle
Yes, there was an infinite loop. But we do not specifically protect our git invocations in the test suite against this sort of failure. Just write
test_must_fail git fetch empty-bundle
and end the test case here.
Show 5 quoted lines
> + ret=$? > + [ $ret == 128 ] && return 0 > + return $ret > + > +'
Furthermore, indentation should be one tabstop, not blanks.
-- Hannes