{"thread":{"id":"41519","subject":"git submodule add --single-branch","startedAt":"2016-02-25T17:54:59Z","lastAt":"2016-02-25T19:05:55Z","messageCount":2,"participants":["Alter Depp","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"279355","messageId":"8e46e2f93895fb33421e7b09ccfe7de5@www.hilie.de","threadId":"41519","inReplyTo":null,"subject":"git submodule add --single-branch","fromName":"Alter Depp","fromEmail":"alter.depp@gmx.de","sentAt":"2016-02-25T17:54:59Z","receivedAt":"2016-02-25T17:54:59Z","isPatch":false,"sender":{"key":"alter.depp@gmx.de","avatar":null},"body":"I would like to do a shallow clone of a submodule like this:\n$ git submodule add --branch master --single-branch --depth 5 repo dir\nbut it doesn't work. I think '--single-branch' is not yet implemented \nfor submodules.\n\nWith the clone command it works:\n$ git clone --branch master --single-branch --depth 5 repo dir\n\nIs it possible to do something like this with a submodule?\n\nStefan\n"},{"id":"279364","messageId":"CAGZ79ka-SAiBC0EHKkESvapS1dvxADOrBvq5ik1r61jjb=jepg@mail.gmail.com","threadId":"41519","inReplyTo":"8e46e2f93895fb33421e7b09ccfe7de5@www.hilie.de","subject":"Re: git submodule add --single-branch","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-02-25T19:05:55Z","receivedAt":"2016-02-25T19:05:55Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Thu, Feb 25, 2016 at 9:54 AM, Alter Depp <Alter.Depp@gmx.de> wrote:\n> I would like to do a shallow clone of a submodule like this:\n> $ git submodule add --branch master --single-branch --depth 5 repo dir\n> but it doesn't work. I think '--single-branch' is not yet implemented for\n> submodules.\n>\n> With the clone command it works:\n> $ git clone --branch master --single-branch --depth 5 repo dir\n>\n> Is it possible to do something like this with a submodule?\n\nShallow submodules are not quite well supported.\nExample:\n\n    $ git clone --depth 2 --recurse-submodules <url>\n\nthe depth argument applies to the main repository,\nand currently it is passed on to the submodules if any.\n\nThe '--depth 2' suggests that you can operate on\nthe 2 topmost revisions of the super project flawlessly,\nso if the submodule pointer in the superproject is advanced\nmore than 2 commits between these 2 commits, you're missing\ncontent.\n\nSo in this case you don't want to pass on the depth literally to\nthe submodule, but rather find out which commits are referenced\nfrom the superproject and make sure those are included in the\nsubmodule.\n\n\nIn your case of adding a submodule as a shallow repo,\nthis problem is not there.  However 'git sub add'\nwill eventually call 'git clone' to get that submodule and\n'--single-branch' is implied by the existance of the '--depth'\nargument there. See the man page of git clone for that.\n\nSo  'git submodule add --depth 5 <url>' should do what\nyou'd expect. Unfortunately you cannot specify\n'--branch=master' though yet.\n\nStefan\n\n>\n> Stefan\n>\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"}]}