Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Git clone should be done with the depth flag #176

Closed
dundundun opened this Issue Feb 24, 2011 · 15 comments

Comments

Projects
None yet
8 participants

Since we don't care about the entire history of the repository of a package, and are only concerned with the latest commit, we should use:

git clone --depth 1 <repo>

instead of

git clone <repo>

This can result in significant space and bandwidth savings, especially for projects like org-mode which have a lot of things in the history.

For example, cloning org-mode with depth 1 resulted in a repo of size 31.27 mb whereas cloning org-mode normally results in a repo sized 51.12 mb.

Contributor

dabrahams commented Feb 24, 2011

I agree that would be a great idea for a default option. I'd want to be able to override that for packages that I work on, though.

Owner

dimitri commented Feb 24, 2011

What about :github with tarball support here instead?

baron commented Mar 6, 2011

I would appreciate this feature as well. Some projects have a long history. What about args that can be passed into the version control system. That way people can check out a stable version/branch etc. as well. So the recipe can use a hash that differs by things like say :emacs-major-version, :window-system, etc.

Contributor

dysinger commented Feb 7, 2012

+1

Collaborator

yyr commented Feb 8, 2012

IMO if there is an option to checkout latest tag would also be good

git describe --tags $(git rev-list --tags --max-count=1)

Collaborator

DarwinAwardWinner commented Feb 8, 2012

@yyr, I have a branch that implements a :checkout property for checking out a specific tag, ref, commit, or anything. I (or you) could modify the code such that if the value of the checkout property is a function instead of a string, it is called inside the git repo and expected to return an appropriate string. Then you could write a function to return the latest tag and put it as the checkout property.

https://github.com/DarwinAwardWinner/el-get/tree/git-checkout-property

Collaborator

DarwinAwardWinner commented Feb 8, 2012

Simply adding --depth 1 to the argument list in methods/el-get-git.el would be easy. Does anyone want to try it and then try installing some packages to see if they work? Also try to test updating as well.

Collaborator

DarwinAwardWinner commented Feb 8, 2012

As for dimitri's suggestion of github-tar and github-zip methods, those would be useful as well.

Collaborator

DarwinAwardWinner commented Feb 8, 2012

I wrote code for github-tar and github-zip methods (basing the zip support on mlf176f2's http-zip method). Currently untested and no documentation, but anyone can try it out if they like.

https://github.com/DarwinAwardWinner/el-get/tree/github-archive-methods

Collaborator

DarwinAwardWinner commented Feb 8, 2012

By the way, if we want to implement this, we may have to consider old versions of git that did not support the --depth flag. Does anyone know what version the flag was introduced in?

Also, as dabrahams says, there also needs to be a property name that can be put in a recipe to override the default. Maybe :shallow t and :shallow nil for enabled and disabled?

Owner

dimitri commented Feb 12, 2012

Now that I've included http-zip, please merge in your github-tar and github-zip methods. Is it possible for them to include support for the :checksum property, and if so, did you include support for that?

Owner

dimitri commented Feb 12, 2012

The :shallow git clones support should make it too, in a separate patch, and should default to nil (complete clone, compatible with what el-get used to do). I know several users who use el-get and directly hack into the el-get package's git clone.

Collaborator

DarwinAwardWinner commented Feb 12, 2012

I don't remember if they implement the checksum option, but once my backend improvements are merged (#533), the github archive methods will be defined using el-get-register-derived-method, which will automatically give them the checksum method from the tar and zip methods.

Owner

dimitri commented Feb 12, 2012

Perfect!

DarwinAwardWinner added a commit to DarwinAwardWinner/el-get that referenced this issue Oct 7, 2012

Disable redundant bandwidth-heavy test #200.
Test #176 tests the same thing and uses less bandwidth.
Collaborator

npostavs commented Mar 13, 2014

Should have been closed by #551.

@npostavs npostavs closed this Mar 13, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment