Re: [git-users] Re: Getting git submodule init to work
From: Thomas Ferris Nicolaisen tfn...@gmail.com I get the same behavior here. However, when using the approach described in http://git-scm.com/book/en/Git-Tools-Submodules - with *git submodule add ...*, it works. Reading in the docs about what the init and update commands do, I was also a bit suprised that it didn't work.. But reading further up, it says: When adding a new submodule to the tree, the add subcommand is to be used. However, when pulling a tree containing submodules, these will not be checked out by default; the init and update subcommands will maintain submodules checked out and at appropriate revision in your working tree. [Revised answer:] I overlooked that text and only read the documentation for init. However, my error was enhanced by a subtle error in the documentation of init. The text as it is written suggests that init's behavior is driven by the contents of .submodules. But in fact, its behavior is driven by the existing gitlinks in the file tree, possibly limited by the path arguments. (Which is why git submodule init can't *add* submodules; it only processes *existing* submodules.) A more accurate statement is: --- man12013-04-26 12:02:16.752702146 -0400 +++ man32013-05-02 21:06:00.020353100 -0400 @@ -61,6 +61,8 @@ to exist in the superproject. If path is not given, the humanish part of the source repository is used (repo for /path/to/repo.git and foo for host.xz:foo/.git). + The path is used as the submodule's logical name in its + configuration entries. repository is the URL of the new submodule’s origin repository. This may be either an absolute URL, or (if it begins with ./ or @@ -109,7 +111,9 @@ too (and can also report changes to a submodule’s work tree). init - Initialize the submodules, i.e. register each submodule name and + Initialize the submodules, i.e. register each submodule for which + there is a gitlink recorded (or the specific gitlinks specified by + path ...) by copying the name and url found in .gitmodules into .git/config. The key used in .git/config is submodule.$name.url. This command does not alter existing information in .git/config. You can then customize the @@ -118,6 +122,10 @@ submodule update --init without the explicit init step if you do not intend to customize any submodule locations. + (Because init only operates on existing gitlinks, it cannot + be used to create submodules, regardless of the contents of + .gitmodules. Use the add subcommand to create submodules.) + update Update the registered submodules, i.e. clone missing submodules and checkout the commit specified in the index of the containing I'll send that to the main Git list. Dale -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[git-users] Re: Getting git submodule init to work
On Friday, April 26, 2013 4:52:41 AM UTC+2, Dale Worley wrote: OK, how to I set up a submodule? As far as I can tell from Version Control with Git, I should be able to: 1. Write .gitmodules with the appropriate configuration values. In my case: [submodule T9] path = T9 url = /home/worley/T9 2. Execute git submodule init to copy these config values into .git/config, thus making the submodule known to Git. 3. Execute git submodule update to cause Git to set up the directory ./T9; in this situation, by cloning /home/worley/T9 into it. However, the git submodule commands do nothing and produce no error messages. (Which is crappy coding!) So I'm not doing the right thing, and have no guidance as to where I'm making a mistake. I get the same behavior here. However, when using the approach described in http://git-scm.com/book/en/Git-Tools-Submodules - with *git submodule add ...*, it works. Reading in the docs about what the init and update commands do, I was also a bit suprised that it didn't work.. But reading further up, it says: When adding a new submodule to the tree, the add subcommand is to be used. However, when pulling a tree containing submodules, these will not be checked out by default; the init and update subcommands will maintain submodules checked out and at appropriate revision in your working tree. -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [git-users] Re: Getting git submodule init to work
- Original Message - From: Thomas Ferris Nicolaisen To: git-users@googlegroups.com Sent: Friday, April 26, 2013 7:22 AM Subject: [git-users] Re: Getting git submodule init to work On Friday, April 26, 2013 4:52:41 AM UTC+2, Dale Worley wrote: OK, how to I set up a submodule? As far as I can tell from Version Control with Git, I should be able to: 1. Write .gitmodules with the appropriate configuration values. In my case: [submodule T9] path = T9 url = /home/worley/T9 Is this the right form for the 'URL'. It just looks like a directory path. Try to compare it with the result of the 'submodule add'. Philip 2. Execute git submodule init to copy these config values into .git/config, thus making the submodule known to Git. 3. Execute git submodule update to cause Git to set up the directory ./T9; in this situation, by cloning /home/worley/T9 into it. However, the git submodule commands do nothing and produce no error messages. (Which is crappy coding!) So I'm not doing the right thing, and have no guidance as to where I'm making a mistake. I get the same behavior here. However, when using the approach described in http://git-scm.com/book/en/Git-Tools-Submodules - with git submodule add ..., it works. Reading in the docs about what the init and update commands do, I was also a bit suprised that it didn't work.. But reading further up, it says: When adding a new submodule to the tree, the add subcommand is to be used. However, when pulling a tree containing submodules, these will not be checked out by default; the init and update subcommands will maintain submodules checked out and at appropriate revision in your working tree. -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3272 / Virus Database: 3162/6272 - Release Date: 04/25/13 -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [git-users] Re: Getting git submodule init to work
From: Philip Oakley philipoak...@iee.org 1. Write .gitmodules with the appropriate configuration values. In my case: [submodule T9] path = T9 url = /home/worley/T9 Is this the right form for the 'URL'. It just looks like a directory path. Try to compare it with the result of the 'submodule add'. It's correct in this instance; that is where the master repository of the submodule is. A local file path can be used as the location from which to clone a repository. (I copied this usage from the O'Reilly book, so I'm pretty sure this is correct.) Dale -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [git-users] Re: Getting git submodule init to work
From: Thomas Ferris Nicolaisen tfn...@gmail.com I get the same behavior here. However, when using the approach described in http://git-scm.com/book/en/Git-Tools-Submodules - with *git submodule add ...*, it works. Reading in the docs about what the init and update commands do, I was also a bit suprised that it didn't work.. But reading further up, it says: When adding a new submodule to the tree, the add subcommand is to be used. However, when pulling a tree containing submodules, these will not be checked out by default; the init and update subcommands will maintain submodules checked out and at appropriate revision in your working tree. Ugh, they made a really bad choice for the subcommand name. But you're right. I'm going to suggest that they improve the manual page so people don't make that mistake: --- temp/man1 2013-04-26 12:02:16.752702146 -0400 +++ temp/man2 2013-04-26 12:26:52.061407604 -0400 @@ -61,6 +61,8 @@ to exist in the superproject. If path is not given, the humanish part of the source repository is used (repo for /path/to/repo.git and foo for host.xz:foo/.git). + The path is used as the submodule's logical name in its + configuration entries. repository is the URL of the new submodule’s origin repository. This may be either an absolute URL, or (if it begins with ./ or @@ -109,8 +111,11 @@ too (and can also report changes to a submodule’s work tree). init - Initialize the submodules, i.e. register each submodule name and - url found in .gitmodules into .git/config. The key used in + Initialize the configuration entries for existing + submodules in a tree that has been pulled, i.e. register + each submodule name and url found in .gitmodules into .git/config. + (For adding a new submodule, use the add subcommand.) + The key used in .git/config is submodule.$name.url. This command does not alter existing information in .git/config. You can then customize the submodule clone URLs in .git/config for your local setup and Dale -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.