threads / discuss / 50543

Feature Request git clone shallow-include

Subject: Feature Request git clone shallow-include

## tl;dr

6 messages between Feb 20, 2019 and Mar 30, 2019.

replies: 5people: 2as markdown or json

Joe Enzminger· Feb 20, 2019, 00:05 UTC · lore

Currently, git clone supports shallow-exclude=<tag-name>. The client will clone up to, but not including, the commit with the tag.

It would be useful to have the ability to include the commit with the tag. The suggestion would be to add a "shallow-include" options to clone to support this behavior.

I have tried to use shallow-exclude with a follow on git fetch --deepen=1, but it always returns "fatal: error in object; unshallow <sha1>"

Duy Nguyen· Feb 20, 2019, 01:22 UTC · re: Joe Enzminger · lore

Re: Feature Request git clone shallow-include

On Wed, Feb 20, 2019 at 7:07 AM Joe Enzminger <joe.enzminger@exactasystems.com> wrote:

Show 7 quoted lines
>
> Currently, git clone supports shallow-exclude=<tag-name>.  The client
> will clone up to, but not including, the commit with the tag.
>
> It would be useful to have the ability to include the commit with the
> tag.  The suggestion would be to add a "shallow-include" options to
> clone to support this behavior.
So exclude the tag's parents and everything before, but keep the tag, correct?

I think if we support --shallow-exclude=<tag>^ then it should work the way you want (if the tag is a normal merge you may need to add --shallow-exclude=<tag>^2 as well). And you can do even fancier thing like --shallow-exclude=<tag>~3 (i.e. exclude the grand grand parent of the tag, but keep the tag and grand parents). We will need to restrict extended SHA-1 syntax to a safe subset of course.

> I have tried to use shallow-exclude with a follow on git fetch
> --deepen=1, but it always returns "fatal: error in object; unshallow
> <sha1>"
-- 
Duy
Joe Enzminger· Feb 20, 2019, 18:06 UTC · re: Duy Nguyen · lore

Re: Feature Request git clone shallow-include

That is correct. What you suggest is actually what I tried (using sha-1 syntax). For my purposes, excluding the tag's parent's but including the tag is sufficient, but if is fairly straightforward to extend support to the other use cases I'm sure someone would find is useful.

Joe
On Tue, Feb 19, 2019 at 7:22 PM Duy Nguyen <pclouds@gmail.com> wrote:
Show 25 quoted lines
>
> On Wed, Feb 20, 2019 at 7:07 AM Joe Enzminger
> <joe.enzminger@exactasystems.com> wrote:
> >
> > Currently, git clone supports shallow-exclude=<tag-name>.  The client
> > will clone up to, but not including, the commit with the tag.
> >
> > It would be useful to have the ability to include the commit with the
> > tag.  The suggestion would be to add a "shallow-include" options to
> > clone to support this behavior.
>
> So exclude the tag's parents and everything before, but keep the tag, correct?
>
> I think if we support --shallow-exclude=<tag>^ then it should work the
> way you want (if the tag is a normal merge you may need to add
> --shallow-exclude=<tag>^2 as well). And you can do even fancier thing
> like --shallow-exclude=<tag>~3 (i.e. exclude the  grand grand parent
> of the tag, but keep the tag and grand parents). We will need to
> restrict extended SHA-1 syntax to a safe subset of course.
>
> > I have tried to use shallow-exclude with a follow on git fetch
> > --deepen=1, but it always returns "fatal: error in object; unshallow
> > <sha1>"
> --
> Duy
Duy Nguyen· Feb 21, 2019, 13:06 UTC · re: Joe Enzminger · lore

Re: Feature Request git clone shallow-include

On Thu, Feb 21, 2019 at 1:07 AM Joe Enzminger <joe.enzminger@exactasystems.com> wrote:

Show 6 quoted lines
>
> That is correct.  What you suggest is actually what I tried (using
> sha-1 syntax).  For my purposes, excluding the tag's parent's but
> including the tag is sufficient, but if is fairly straightforward to
> extend support to the other use cases I'm sure someone would find is
> useful.

It's not hard to do. I hope I will find some time to do it soon. My only concern is whether reuse the current code or write new. The former makes it easy to accidentally accept some extended sha-1 syntax that should not run on the server side. On the other hand, the latter will not be as thoroughly tested because it only runs by shallow code. That's my problem though. I think I might be able to find a third option somewhere in between.

Show 30 quoted lines
>
> Joe
>
>
> On Tue, Feb 19, 2019 at 7:22 PM Duy Nguyen <pclouds@gmail.com> wrote:
> >
> > On Wed, Feb 20, 2019 at 7:07 AM Joe Enzminger
> > <joe.enzminger@exactasystems.com> wrote:
> > >
> > > Currently, git clone supports shallow-exclude=<tag-name>.  The client
> > > will clone up to, but not including, the commit with the tag.
> > >
> > > It would be useful to have the ability to include the commit with the
> > > tag.  The suggestion would be to add a "shallow-include" options to
> > > clone to support this behavior.
> >
> > So exclude the tag's parents and everything before, but keep the tag, correct?
> >
> > I think if we support --shallow-exclude=<tag>^ then it should work the
> > way you want (if the tag is a normal merge you may need to add
> > --shallow-exclude=<tag>^2 as well). And you can do even fancier thing
> > like --shallow-exclude=<tag>~3 (i.e. exclude the  grand grand parent
> > of the tag, but keep the tag and grand parents). We will need to
> > restrict extended SHA-1 syntax to a safe subset of course.
> >
> > > I have tried to use shallow-exclude with a follow on git fetch
> > > --deepen=1, but it always returns "fatal: error in object; unshallow
> > > <sha1>"
> > --
> > Duy
-- 
Duy
Joe Enzminger· Mar 29, 2019, 22:02 UTC · re: Duy Nguyen · lore

Re: Feature Request git clone shallow-include

Duy -
Any updates on this feature request?
Joe
On Thu, Feb 21, 2019 at 7:06 AM Duy Nguyen <pclouds@gmail.com> wrote:
Show 53 quoted lines
>
> On Thu, Feb 21, 2019 at 1:07 AM Joe Enzminger
> <joe.enzminger@exactasystems.com> wrote:
> >
> > That is correct.  What you suggest is actually what I tried (using
> > sha-1 syntax).  For my purposes, excluding the tag's parent's but
> > including the tag is sufficient, but if is fairly straightforward to
> > extend support to the other use cases I'm sure someone would find is
> > useful.
>
> It's not hard to do. I hope I will find some time to do it soon. My
> only concern is whether reuse the current code or write new. The
> former makes it easy to accidentally accept some extended sha-1 syntax
> that should not run on the server side. On the other hand, the latter
> will not be as thoroughly tested because it only runs by shallow code.
> That's my problem though. I think I might be able to find a third
> option somewhere in between.
>
> >
> > Joe
> >
> >
> > On Tue, Feb 19, 2019 at 7:22 PM Duy Nguyen <pclouds@gmail.com> wrote:
> > >
> > > On Wed, Feb 20, 2019 at 7:07 AM Joe Enzminger
> > > <joe.enzminger@exactasystems.com> wrote:
> > > >
> > > > Currently, git clone supports shallow-exclude=<tag-name>.  The client
> > > > will clone up to, but not including, the commit with the tag.
> > > >
> > > > It would be useful to have the ability to include the commit with the
> > > > tag.  The suggestion would be to add a "shallow-include" options to
> > > > clone to support this behavior.
> > >
> > > So exclude the tag's parents and everything before, but keep the tag, correct?
> > >
> > > I think if we support --shallow-exclude=<tag>^ then it should work the
> > > way you want (if the tag is a normal merge you may need to add
> > > --shallow-exclude=<tag>^2 as well). And you can do even fancier thing
> > > like --shallow-exclude=<tag>~3 (i.e. exclude the  grand grand parent
> > > of the tag, but keep the tag and grand parents). We will need to
> > > restrict extended SHA-1 syntax to a safe subset of course.
> > >
> > > > I have tried to use shallow-exclude with a follow on git fetch
> > > > --deepen=1, but it always returns "fatal: error in object; unshallow
> > > > <sha1>"
> > > --
> > > Duy
>
>
>
> --
> Duy
Duy Nguyen· Mar 30, 2019, 11:38 UTC · re: Joe Enzminger · lore

Re: Feature Request git clone shallow-include

On Sat, Mar 30, 2019 at 5:02 AM Joe Enzminger <joe.enzminger@exactasystems.com> wrote:

>
> Duy -
>
> Any updates on this feature request?

Nope. I've been busy with other stuff. I did have a look at the possibility of reusing code in sha1-name.c and concluded that it's not quite safe.

Show 56 quoted lines
> Joe
>
> On Thu, Feb 21, 2019 at 7:06 AM Duy Nguyen <pclouds@gmail.com> wrote:
> >
> > On Thu, Feb 21, 2019 at 1:07 AM Joe Enzminger
> > <joe.enzminger@exactasystems.com> wrote:
> > >
> > > That is correct.  What you suggest is actually what I tried (using
> > > sha-1 syntax).  For my purposes, excluding the tag's parent's but
> > > including the tag is sufficient, but if is fairly straightforward to
> > > extend support to the other use cases I'm sure someone would find is
> > > useful.
> >
> > It's not hard to do. I hope I will find some time to do it soon. My
> > only concern is whether reuse the current code or write new. The
> > former makes it easy to accidentally accept some extended sha-1 syntax
> > that should not run on the server side. On the other hand, the latter
> > will not be as thoroughly tested because it only runs by shallow code.
> > That's my problem though. I think I might be able to find a third
> > option somewhere in between.
> >
> > >
> > > Joe
> > >
> > >
> > > On Tue, Feb 19, 2019 at 7:22 PM Duy Nguyen <pclouds@gmail.com> wrote:
> > > >
> > > > On Wed, Feb 20, 2019 at 7:07 AM Joe Enzminger
> > > > <joe.enzminger@exactasystems.com> wrote:
> > > > >
> > > > > Currently, git clone supports shallow-exclude=<tag-name>.  The client
> > > > > will clone up to, but not including, the commit with the tag.
> > > > >
> > > > > It would be useful to have the ability to include the commit with the
> > > > > tag.  The suggestion would be to add a "shallow-include" options to
> > > > > clone to support this behavior.
> > > >
> > > > So exclude the tag's parents and everything before, but keep the tag, correct?
> > > >
> > > > I think if we support --shallow-exclude=<tag>^ then it should work the
> > > > way you want (if the tag is a normal merge you may need to add
> > > > --shallow-exclude=<tag>^2 as well). And you can do even fancier thing
> > > > like --shallow-exclude=<tag>~3 (i.e. exclude the  grand grand parent
> > > > of the tag, but keep the tag and grand parents). We will need to
> > > > restrict extended SHA-1 syntax to a safe subset of course.
> > > >
> > > > > I have tried to use shallow-exclude with a follow on git fetch
> > > > > --deepen=1, but it always returns "fatal: error in object; unshallow
> > > > > <sha1>"
> > > > --
> > > > Duy
> >
> >
> >
> > --
> > Duy
-- 
Duy

← back to recent threads