From: Csaba Henk Date: Fri, 27 Aug 2010 20:31:47 +0000 (+0000) Subject: bundle: detect if bundle file cannot be created X-Git-Tag: v1.7.3-rc2~5^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0f5cdf653b8be5b8fad3fb2a3eaecfb9da80d215;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/bundle.c b/bundle.c index ff97adcb8..65ea26bdb 100644 --- a/bundle.c +++ b/bundle.c @@ -372,8 +372,10 @@ int create_bundle(struct bundle_header *header, const char *path, close(rls.in); if (finish_command(&rls)) return error ("pack-objects died"); - if (!bundle_to_stdout) - commit_lock_file(&lock); + if (!bundle_to_stdout) { + if (commit_lock_file(&lock)) + die_errno("cannot create '%s'", path); + } return 0; } diff --git a/t/t5704-bundle.sh b/t/t5704-bundle.sh index ddc3dc52f..728ccd88c 100755 --- a/t/t5704-bundle.sh +++ b/t/t5704-bundle.sh @@ -30,6 +30,13 @@ test_expect_success 'tags can be excluded by rev-list options' ' ' +test_expect_success 'die if bundle file cannot be created' ' + + mkdir adir && + test_must_fail git bundle create adir --all + +' + test_expect_failure 'bundle --stdin' ' echo master | git bundle create stdin-bundle.bdl --stdin &&