Hi, On Mon, 13 Nov 2006, Junio C Hamano wrote: > Johannes Schindelin <Johannes.Schindelin@xxxxxx> 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@xxxxxx> > > --- > > 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. You are probably right, how about has_sha1_file()? > I think register_shallow() can take commits that are already shallow() > so maybe we can remove this "if() continue"? Yes, it can, but that is not necessarily correct: since .git/shallow is constructed from the registered shallow commits, we would make a commit shallow which is really not shallow. So, how about > > + if (lookup_object(sha1) || has_sha1_file(sha1)) > > + continue; Ciao, Dscho - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html