From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
Git Mailing List <git@vger.kernel.org>,
Mark Levedahl <mdl123@verizon.net>
Subject: [PATCH] allow git-bundle to create bottomless bundle
Date: Wed, 08 Aug 2007 17:01:49 -0700 [thread overview]
Message-ID: <7vps1xzic2.fsf_-_@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vlkcl4zcw.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Wed, 08 Aug 2007 12:09:51 -0700")
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 <gitster@pobox.com> writes:
> *1* Sheesh. While I was writing this I noticed that the current
> 'git bundle' is suitable only for incremental sneakernet but
> not for this particular use case.
>
> $ git bundle create 2612.bndl v2.6.12
>
> does not work, although
>
> $ git bundle create 2612-2613.bndl v2.6.12..v2.6.13
>
> does. We need to fix this.
Only very lightly tested, but the fix looks obvious enough.
builtin-bundle.c | 10 +++++++++-
t/t5510-fetch.sh | 8 ++++++++
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/builtin-bundle.c b/builtin-bundle.c
index 6ae5ab0..cb439ca 100644
--- a/builtin-bundle.c
+++ b/builtin-bundle.c
@@ -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)
@@ -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;
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 426017e..439430f 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -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
next prev parent reply other threads:[~2007-08-09 0:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-07 13:23 resumable git-clone? Nguyen Thai Ngoc Duy
2007-08-08 3:59 ` Shawn O. Pearce
2007-08-08 9:14 ` Johannes Schindelin
2007-08-08 19:09 ` Junio C Hamano
2007-08-08 19:35 ` Johannes Schindelin
2007-08-09 0:01 ` Junio C Hamano [this message]
2007-08-09 0:28 ` [PATCH] allow git-bundle to create bottomless bundle Johannes Schindelin
2007-08-09 2:48 ` Mark Levedahl
2007-08-09 5:04 ` Junio C Hamano
2007-08-09 12:32 ` Mark Levedahl
2007-08-08 11:20 ` resumable git-clone? Nguyen Thai Ngoc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vps1xzic2.fsf_-_@assigned-by-dhcp.cox.net \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=mdl123@verizon.net \
--cc=pclouds@gmail.com \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).