]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-bundle.c
allow git-bundle to create bottomless bundle
[git.git] / builtin-bundle.c
index d1635a0a6b009ecb6706084828abd0e3928f2b8d..cb439ca4656d53228e34d342f681bdcc645a158d 100644 (file)
@@ -1,3 +1,4 @@
+#include "builtin.h"
 #include "cache.h"
 #include "object.h"
 #include "commit.h"
@@ -48,7 +49,7 @@ static int read_string(int fd, char *buffer, int size)
 {
        int i;
        for (i = 0; i < size - 1; i++) {
-               int count = xread(fd, buffer + i, 1);
+               ssize_t count = xread(fd, buffer + i, 1);
                if (count < 0)
                        return error("Read error: %s", strerror(errno));
                if (count == 0) {
@@ -207,6 +208,10 @@ static int create_bundle(struct bundle_header *header, const char *path,
        struct rev_info revs;
        struct child_process rls;
 
+       /*
+        * NEEDSWORK: this should use something like lock-file
+        * to create temporary that is cleaned up upon error.
+        */
        bundle_fd = (!strcmp(path, "-") ? 1 :
                        open(path, O_CREAT | O_EXCL | O_WRONLY, 0666));
        if (bundle_fd < 0)
@@ -266,8 +271,12 @@ static int create_bundle(struct bundle_header *header, const char *path,
                 * Make sure the refs we wrote out is correct; --max-count and
                 * other limiting options could have prevented all the tips
                 * from getting output.
+                *
+                * Non commit objects such as tags and blobs do not have
+                * this issue as they are not affected by those extra
+                * constraints.
                 */
-               if (!(e->item->flags & SHOWN)) {
+               if (!(e->item->flags & SHOWN) && e->item->type == OBJ_COMMIT) {
                        warning("ref '%s' is excluded by the rev-list options",
                                e->name);
                        continue;