Subject: Re: [RFH] GSoC 2015 application

From: Duy Nguyen <[email-masked]>
Date: Fri, 6 Mar 2015 18:24:34 +0700

On Wed, Mar 04, 2015 at 10:19:16PM -0800, Junio C Hamano wrote:
> But we would need some way to say a set-based cut-off; I do not
> think using --since for that purpose is a good idea, though, because
> that is already taken for date-based cut-off, and mixing them
> together will introduce confusion.

I agree. Although I look at this from the implementation perspective:
mixing the two would make it really hard to detect which is which.
Speaking of implementation..

On Thu, Mar 5, 2015 at 5:28 PM, Nguyễn Thái Ngọc Duy <[email-masked]> wrote:
> I do have plenty of topics to finish up. But I wanted to see how this
> feature would look like. I needed to write some code for that and for
> straightening my thoughts. Totally untested, but I think it looks cool :)
>
> I think this feature is feasible. The protocol and UI are still up in
> the air. Plenty of work for any student who wants to pick this up.

I think students are losing the chance to have this fun now. A rough
implementation is available at

    https://github.com/pclouds/git/tree/shallow-since

if anybody wants to try out. I don't post it here yet because while it
seems to be working in my limited tests, there could be some corner
cases to sort out, bugs and style violations. Also tests to be added.

Documentation changes below. --not and --since can be mixed. Neither
of them can be used with --depth though, but I'd consider it a
temporary limitation.

diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
index b09a783..ec68374 100644
--- a/Documentation/fetch-options.txt
+++ b/Documentation/fetch-options.txt
@@ -13,6 +13,15 @@
 	to the specified number of commits from the tip of each remote
 	branch history. Tags for the deepened commits are not fetched.
 
+--since=<date>::
+	Deepen or shorten the history of a 'shallow' repository to
+	include all reachable commits that are after <date>.
+
+--not=<revision>::
+	Deepen or shorten the history of a 'shallow' repository to
+	exclude commits reachable from a specified remote branch or tag.
+	This option can be specified multiple times.
+
 --unshallow::
 	If the source repository is complete, convert a shallow
 	repository to a complete one, removing all the limitations
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index f1f2a3f..fc094c6 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -187,6 +187,14 @@ objects from the source repository into a pack in the cloned repository.
 	Create a 'shallow' clone with a history truncated to the
 	specified number of revisions.
 
+--since=<date>::
+	Create a 'shallow' clone with a history after the specified time.
+
+--not=<revision>::
+	Create a 'shallow' clone with a history, excluding commits
+	reachable from a specified remote branch or tag.  This option
+	can be specified multiple times.
+
 --[no-]single-branch::
 	Clone only the history leading to the tip of a single branch,
 	either specified by the `--branch` option or the primary
diff --git a/Documentation/technical/protocol-capabilities.txt b/Documentation/technical/protocol-capabilities.txt
index 4f8a7bf..3649301 100644
--- a/Documentation/technical/protocol-capabilities.txt
+++ b/Documentation/technical/protocol-capabilities.txt
@@ -179,6 +179,24 @@ This capability adds "deepen", "shallow" and "unshallow" commands to
 the  fetch-pack/upload-pack protocol so clients can request shallow
 clones.
 
+deepen-since
+------------
+
+This capability adds "deepen-since" command to fetch-pack/upload-pack
+protocol so the client can request shallow clones that are cut at a
+specific time, instead of depth. Internally it's equivalent of doing
+"rev-list --since=<time>" on the server side. "deepen-since" cannot be
+used with "deepen".
+
+deepen-not
+----------
+
+This capability adds "deepen-not" command to fetch-pack/upload-pack
+protocol so the client can request shallow clones that are cut at a
+specific revision, instead of depth. Internally it's equivalent of
+doing "rev-list --not <rev>" on the server side. "deepen-not"
+cannot be used with "deepen", but can be used with "deepen-since".
+
 no-progress
 -----------