@matheusbsbs / matheus-bagliano / commits / 7fa8254f94
Fork 0

allow git-bundle to create bottomless bundle

While "git bundle" was a useful way to sneakernet incremental changes, we did not allow: $ git bundle create v2.6.20.bndl v2.6.20 to create a bundle that contains the whole history to a well-known good revision. Such a bundle can be mirrored everywhere, and people can prime their repository with it to reduce the load on the repository that serves near the tip of the development. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Aug 8, 2007 at 17:01 UTC 7fa8254f9476de24661e93b2a90c6ce30dc10006
2 files changed +17 -1
builtin-bundle.c
+9 -1
@@ -208,6 +208,10 @@ static int create_bundle(struct bundle_header *header, const char *path,
208 struct rev_info revs;
209 struct child_process rls;
210
211 + /*
212 + * NEEDSWORK: this should use something like lock-file
213 + * to create temporary that is cleaned up upon error.
214 + */
215 bundle_fd = (!strcmp(path, "-") ? 1 :
216 open(path, O_CREAT | O_EXCL | O_WRONLY, 0666));
217 if (bundle_fd < 0)
@@ -267,8 +271,12 @@ static int create_bundle(struct bundle_header *header, const char *path,
271 * Make sure the refs we wrote out is correct; --max-count and
272 * other limiting options could have prevented all the tips
273 * from getting output.
274 + *
275 + * Non commit objects such as tags and blobs do not have
276 + * this issue as they are not affected by those extra
277 + * constraints.
278 */
271 - if (!(e->item->flags & SHOWN)) {
279 + if (!(e->item->flags & SHOWN) && e->item->type == OBJ_COMMIT) {
280 warning("ref '%s' is excluded by the rev-list options",
281 e->name);
282 continue;
t/t5510-fetch.sh
+8
@@ -145,4 +145,12 @@ test_expect_success 'bundle does not prerequisite objects' '
145 test 4 = $(git verify-pack -v bundle.pack | wc -l)
146 '
147
148 +test_expect_success 'bundle should be able to create a full history' '
149 +
150 + cd "$D" &&
151 + git tag -a -m '1.0' v1.0 master &&
152 + git bundle create bundle4 v1.0
153 +
154 +'
155 +
156 test_done