Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/5] allow cloning a repository "shallowly"
Date: Mon, 13 Nov 2006 23:24:46 -0800	[thread overview]
Message-ID: <7v4pt21oe9.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: Pine.LNX.4.63.0610302009160.26682@wbgn013.biozentrum.uni-wuerzburg.de

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> By specifying a depth, you can now clone a repository such that
> all fetched ancestor-chains' length is at most "depth". For example,
> if the upstream repository has only 2 branches ("A" and "B"), which
> are linear, and you specify depth 3, you will get A, A~1, A~2, A~3,
> B, B~1, B~2, and B~3. The ends are automatically made shallow
> commits.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  fetch-pack.c  |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  git-clone.sh  |   19 +++++++++++++++--
>  upload-pack.c |   21 ++++++++++++++++++-
>  3 files changed, 96 insertions(+), 5 deletions(-)
>
> diff --git a/fetch-pack.c b/fetch-pack.c
> index 488adc9..9619d6e 100644
> --- a/fetch-pack.c
> +++ b/fetch-pack.c
>...
> +		while ((len = packet_read_line(fd[0], line, sizeof(line)))) {
> +			if (!strncmp("shallow ", line, 8)) {
> +				if (get_sha1_hex(line + 8, sha1))
> +					die("invalid shallow line: %s", line);
> +				/* no need making it shallow if we have it already */
> +				if (lookup_object(sha1))
> +					continue;
> +				register_shallow(sha1);
> +			}
> +		}
> +	}

I understand "no need making it shallow", but I am not sure if a
non-NULL return from lookup_object() tells us that.

Before this part of the code, we have scanned the local refs in
everything_local (which parses their refs).

I think register_shallow() can take commits that are already
shallow() so maybe we can remove this "if() continue"?

  reply	other threads:[~2006-11-14  7:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-30 19:09 [PATCH 3/5] allow cloning a repository "shallowly" Johannes Schindelin
2006-11-14  7:24 ` Junio C Hamano [this message]
2006-11-14 10:49   ` Johannes Schindelin
2006-11-14 17:46     ` Junio C Hamano
2006-11-15 10:57       ` Johannes Schindelin

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=7v4pt21oe9.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.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