git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Petr Baudis <pasky@suse.cz>
Cc: git@vger.kernel.org
Subject: Re: How to clone-pack the HEAD?
Date: Wed, 14 Dec 2005 21:29:10 -0800	[thread overview]
Message-ID: <7vpsnzq66x.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vlkynrurh.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Wed, 14 Dec 2005 17:53:06 -0800")

Junio C Hamano <junkio@cox.net> writes:

> Not really.  I take this back.  What you want to do I did not
> understand well enough.
>
> HEAD is kinda special.  A hack I can think of is to do ls-remote
> first and do the guess clone-pack does for full clone case, and
> then give a specific branch name to clone.  That might work.

... and another way would be to do this; I'll put this (with
fixes if there is some needed) in "master" tonight.

Also I might want to give --keep option to fetch-pack as well;
clone-pack has some static functions that we can extract out to
a common file to link to both.

-- >8 --
Subject: [PATCH] clone-pack: make it usable for partial branch cloning.

clone-pack had some logic to accept subset of remote refs from
the command line and clone from there.  However, it was never
used in practice and its problems were not found out so far.

This commit changes the command to output the object names of
refs to the standard output instead of making a clone of the
remote repository when explicit <head> parameters are given; the
output format is the same as fetch-pack.

The traditional behaviour of cloning the whole repository by
giving no explicit <head> parameters stays the same.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 Documentation/git-clone-pack.txt |    6 +++++-
 clone-pack.c                     |   13 +++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

31ec6abf887ec95642cbe82fe61076e975494ab0
diff --git a/Documentation/git-clone-pack.txt b/Documentation/git-clone-pack.txt
index cfc7b62..39906fc 100644
--- a/Documentation/git-clone-pack.txt
+++ b/Documentation/git-clone-pack.txt
@@ -43,7 +43,11 @@ OPTIONS
 	The heads to update.  This is relative to $GIT_DIR
 	(e.g. "HEAD", "refs/heads/master").  When unspecified,
 	all heads are updated to match the remote repository.
-
++
+Usually all the refs from existing repository are stored
+under the same name in the new repository.  Giving explicit
+<head> arguments instead writes the object names and refs to
+the standard output, just like get-fetch-pack does.
 
 Author
 ------
diff --git a/clone-pack.c b/clone-pack.c
index a99a95c..b5ce5d3 100644
--- a/clone-pack.c
+++ b/clone-pack.c
@@ -259,8 +259,17 @@ static int clone_pack(int fd[2], int nr_
 
 	status = clone_without_unpack(fd);
 
-	if (!status)
-		write_refs(refs);
+	if (!status) {
+		if (nr_match == 0)
+			write_refs(refs);
+		else
+			while (refs) {
+				printf("%s %s\n",
+				       sha1_to_hex(refs->old_sha1),
+				       refs->name);
+				refs = refs->next;
+			}
+	}
 	return status;
 }
 
-- 
0.99.9n

  reply	other threads:[~2005-12-15  5:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-15  0:44 How to clone-pack the HEAD? Petr Baudis
2005-12-15  1:20 ` Junio C Hamano
2005-12-15  1:32   ` Petr Baudis
2005-12-15  1:45     ` Junio C Hamano
2005-12-15  1:53       ` Junio C Hamano
2005-12-15  5:29         ` Junio C Hamano [this message]
2005-12-15  6:21           ` Junio C Hamano
2005-12-18  0:53             ` Petr Baudis
2005-12-18  0:38           ` Petr Baudis
2005-12-15  1:59       ` Petr Baudis

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vpsnzq66x.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=pasky@suse.cz \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).