When reviewing a change that also updates a submodule in Gerrit, a common review practice is to download and cherry-pick the patch locally to test it. (Merged by Junio C Hamano - gitster - in commit 9671a76, ) submodule: try harder to fetch needed sha1 by direct fetching sha1 See commit fb43e31 () by Stefan Beller ( stefanbeller). With 2.8, the submodule update -depth has one more chance to succeed, even if the SHA1 is directly reachable from one of the remote repo HEADs. Otherwise you get " fatal: reference is not a tree". If you set depth 1, then submodule update can only ever succeed if the submodule commit you want is the latest master. This option is valid for add and update commands.Ĭreate a 'shallow' clone with a history truncated to the specified number of revisions.Īs far as I can tell this option isn't usable for submodules which don't track master very closely. The next time someone runs git clone -recursive it will pull in the whole history of, but it will only shallow-clone the submodule as expected. Git submodule add -depth 1 path/to/submodule gitmodules submodule.path/to/submodule.shallow true The following results in the same thing too (opposite order): git config -f. The commands may look like like the following: git submodule add -depth 1 path/to/submodule And the git config commands make the option permanent for other people who will clone the repo recursively later.Īs an example, suppose you have the repo and you want to add as a submodule, in your repo at path/to/submodule. The git submodule command perform the actual clone (using depth 1 this time). That means this works: # add shallow submodule Tests are added and some indention adjustments were made to conform to the rest of the testfile on "submodule update can handle symbolic links in pwd". This is useful when the submodule(s) are huge and you're not really interested in anything but the latest commit. See commit 275cd184d52b5b81cb89e4ec33e540fb2ae61c1f:Īdd the -depth option to the add and update commands of "git submodule", which is then passed on to the clone command. (And git 2.10 Q3 2016 allows to record that with git config -f. " git submodule update" can optionally clone the submodule repositories shallowly. New in the upcoming Git 1.8.4 (July 2013): What follows is the evolution of git submodule/ git clone when it comes to shallow clones, starting (in 2013) with Git 1.8.4, and going from there. Which means the next git clone -recurse-submodules will shallow clone the submodule ' ' (depth 1), even without the -shallow-submodules. Or: record that a submodule should be shallow cloned: git config -f. (But see caveat with Ciro Santilli answer) TLDR git clone -recurse-submodules -shallow-submodules
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |