mirror of
https://github.com/git/git.git
synced 2026-01-18 06:34:21 +00:00
Merge 'create-empty-bundle'
This was pull request #797 from glhez/master `git bundle create <bundle>` leaks handle the revlist is empty. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
7
bundle.c
7
bundle.c
@@ -457,10 +457,11 @@ int create_bundle(struct bundle_header *header, const char *path,
|
||||
object_array_remove_duplicates(&revs.pending);
|
||||
|
||||
ref_count = write_bundle_refs(bundle_fd, &revs);
|
||||
if (!ref_count)
|
||||
die(_("Refusing to create empty bundle."));
|
||||
else if (ref_count < 0)
|
||||
if (ref_count <= 0) {
|
||||
if (!ref_count)
|
||||
error(_("Refusing to create empty bundle."));
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* write pack */
|
||||
if (write_pack_data(bundle_fd, &revs)) {
|
||||
|
||||
@@ -71,4 +71,8 @@ test_expect_success 'prerequisites with an empty commit message' '
|
||||
git bundle verify bundle
|
||||
'
|
||||
|
||||
test_expect_success 'try to create a bundle with empty ref count' '
|
||||
test_expect_code 1 git bundle create foobar.bundle master..master
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user