OSDN Git Service

Merge branch 'nd/upload-pack-shallow'
authorJunio C Hamano <gitster@pobox.com>
Fri, 21 Mar 2014 19:49:08 +0000 (12:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Mar 2014 19:49:08 +0000 (12:49 -0700)
Serving objects from a shallow repository needs to write a
temporary file to be used, but the serving upload-pack may not have
write access to the repository which is meant to be read-only.

Instead feed these temporary shallow bounds from the standard input
of pack-objects so that we do not have to use a temporary file.

* nd/upload-pack-shallow:
  upload-pack: send shallow info over stdin to pack-objects

1  2 
builtin/pack-objects.c
upload-pack.c

@@@ -2458,9 -2370,15 +2461,16 @@@ static void get_object_list(int ac, con
                if (*line == '-') {
                        if (!strcmp(line, "--not")) {
                                flags ^= UNINTERESTING;
 +                              write_bitmap_index = 0;
                                continue;
                        }
+                       if (starts_with(line, "--shallow ")) {
+                               unsigned char sha1[20];
+                               if (get_sha1_hex(line + 10, sha1))
+                                       die("not an SHA-1 '%s'", line + 10);
+                               register_shallow(sha1);
+                               continue;
+                       }
                        die("not a rev '%s'", line);
                }
                if (handle_revision_arg(line, &revs, flags, REVARG_CANNOT_BE_FILENAME))
diff --cc upload-pack.c
Simple merge