Skip to content

Commit 0f5cdf6

Browse files
csabahenkgitster
authored andcommitted
bundle: detect if bundle file cannot be created
bundle command silently died with no sign of failure if it could not create the bundle file. (Eg.: its path resovles to a directory, or the parent dir is sticky while file already exists and is owned by someone else.) Signed-off-by: Csaba Henk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 64fdc08 commit 0f5cdf6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

bundle.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,10 @@ int create_bundle(struct bundle_header *header, const char *path,
372372
close(rls.in);
373373
if (finish_command(&rls))
374374
return error ("pack-objects died");
375-
if (!bundle_to_stdout)
376-
commit_lock_file(&lock);
375+
if (!bundle_to_stdout) {
376+
if (commit_lock_file(&lock))
377+
die_errno("cannot create '%s'", path);
378+
}
377379
return 0;
378380
}
379381

t/t5704-bundle.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ test_expect_success 'tags can be excluded by rev-list options' '
3030
3131
'
3232

33+
test_expect_success 'die if bundle file cannot be created' '
34+
35+
mkdir adir &&
36+
test_must_fail git bundle create adir --all
37+
38+
'
39+
3340
test_expect_failure 'bundle --stdin' '
3441
3542
echo master | git bundle create stdin-bundle.bdl --stdin &&

0 commit comments

Comments
 (0)