@matheusbsbs / matheus-bagliano / commits / 0f5cdf653b
Fork 0

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 <csaba@gluster.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Csaba Henk committed Aug 27, 2010 at 20:31 UTC 0f5cdf653b8be5b8fad3fb2a3eaecfb9da80d215
2 files changed +11 -2
bundle.c
+4 -2
@@ -372,8 +372,10 @@ int create_bundle(struct bundle_header *header, const char *path,
372 close(rls.in);
373 if (finish_command(&rls))
374 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 + }
379 return 0;
380 }
381
t/t5704-bundle.sh
+7
@@ -30,6 +30,13 @@ test_expect_success 'tags can be excluded by rev-list options' '
30
31 '
32
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 +
40 test_expect_failure 'bundle --stdin' '
41
42 echo master | git bundle create stdin-bundle.bdl --stdin &&