Skip to content

Commit

Permalink
allow git-bundle to create bottomless bundle
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
gitster committed Aug 11, 2007
1 parent d699676 commit 7fa8254
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion builtin-bundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,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)
Expand Down Expand Up @@ -267,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;
Expand Down
8 changes: 8 additions & 0 deletions t/t5510-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,12 @@ test_expect_success 'bundle does not prerequisite objects' '
test 4 = $(git verify-pack -v bundle.pack | wc -l)
'

test_expect_success 'bundle should be able to create a full history' '
cd "$D" &&
git tag -a -m '1.0' v1.0 master &&
git bundle create bundle4 v1.0
'

test_done

0 comments on commit 7fa8254

Please sign in to comment.