]> asedeno.scripts.mit.edu Git - git.git/blobdiff - bundle.c
Merge git://git.kernel.org/pub/scm/gitk/gitk
[git.git] / bundle.c
index 316aa7420d8bd647e304d21c6ca4a9b9cbe5548a..5c95eca07d19a6d3ed4e9000b5bb47eef90ff66e 100644 (file)
--- a/bundle.c
+++ b/bundle.c
@@ -317,6 +317,14 @@ int create_bundle(struct bundle_header *header, const char *path,
        rls.git_cmd = 1;
        if (start_command(&rls))
                return error("Could not spawn pack-objects");
+
+       /*
+        * start_command closed bundle_fd if it was > 1
+        * so set the lock fd to -1 so commit_lock_file()
+        * won't fail trying to close it.
+        */
+       lock.fd = -1;
+
        for (i = 0; i < revs.pending.nr; i++) {
                struct object *object = revs.pending.objects[i].item;
                if (object->flags & UNINTERESTING)
@@ -326,10 +334,8 @@ int create_bundle(struct bundle_header *header, const char *path,
        }
        if (finish_command(&rls))
                return error ("pack-objects died");
-       close(bundle_fd);
-       if (!bundle_to_stdout)
-               commit_lock_file(&lock);
-       return 0;
+
+       return bundle_to_stdout ? close(bundle_fd) : commit_lock_file(&lock);
 }
 
 int unbundle(struct bundle_header *header, int bundle_fd)