Closed sirlucjan closed 2 years ago
A very similar feature exists in gl init
already but it didnt work for me when I tried.
usage: gl init [-h] [-o ONLY [ONLY ...]] [-e EXCLUDE [EXCLUDE ...]] [repo]
...
-o ONLY [ONLY ...], --only ONLY [ONLY ...]
use only branches given from remote repo
-e EXCLUDE [EXCLUDE ...], --exclude EXCLUDE [EXCLUDE ...]
use everything but these branches from remote repo
refs/tags/<tag>
I think commits can be let go, probably not worth it. I am very happy that gitless will get a download feature.
I'm looking at this issue again and seeing how it maps to the official git client. It looks like the related git clone
options would be
--depth <depth>
Create a shallow clone with a history truncated to the specified number of commits. Implies --single-branch unless --no-single-branch is given to fetch the histories near the tips of all branches. If you want to clone
submodules shallowly, also pass --shallow-submodules.
--shallow-since=<date>
Create a shallow clone with a history after the specified time.
--shallow-exclude=<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.
I think gitless can't support these git clone options because of pygit2/libgit2. See https://github.com/goldstar611/gitless/issues/20
All of the history must be in the repo unfortunately so I think the current options (-e
, -o
) are the best we can do currently to keep gl branch
looking clean.
Let me know if you can think of a different way we could approach this, I'll look into it.
In that case, no problem, it is always possible to use git clone for this. Alternatively we can make a wrapper similar to pull and fetch but I don't think it is necessary, git clone is used rather less often than fetch and pull.
@goldstar611 I tried making a wrapper similar to gl pull and gl fetch but without success. I think it is not worth to pursue the topic further and close the topic.
Would it be possible to add a git clone equivalent? A very cool option would be to simplify downloading a single branch or downloading only the tagged version. Something like
gl download --branch=master https://github.com/goldstar611/gitless
or
gl download --tag=0.9.14 https://github.com/goldstar611/gitless
or
gl download --commit=90e197 https://github.com/goldstar611/gitless