summaryrefslogtreecommitdiff
path: root/git-submodule.sh
AgeCommit message (Collapse)AuthorFilesLines
2012-01-24submodule add: fix breakage when re-adding a deep submoduleLibravatar Jens Lehmann1-0/+1
Since recently a submodule with name <name> has its git directory in the .git/modules/<name> directory of the superproject while the work tree contains a gitfile pointing there. When the same submodule is added on a branch where it wasn't present so far (it is not found in the .gitmodules file), the name is not initialized from the path as it should. This leads to a wrong path entered in the gitfile when the .git/modules/<name> directory is found, as this happily uses the - now empty - name. It then always points only a single directory up, even if we have a path deeper in the directory hierarchy. Fix that by initializing the name of the submodule early in module_clone() if module_name() returned an empty name and add a test to catch that bug. Reported-by: Jehan Bing <jehan@orb.com> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-26Merge branch 'tc/submodule-clone-name-detection'Libravatar Junio C Hamano1-4/+4
* tc/submodule-clone-name-detection: submodule::module_clone(): silence die() message from module_name() submodule: whitespace fix
2011-10-21submodule::module_clone(): silence die() message from module_name()Libravatar Tay Ray Chuan1-1/+1
The die() message that may occur in module_name() is not really relevant to the user when called from module_clone(); the latter handles the "failure" (no submodule mapping) anyway. Analysis of other callsites is left to future work. Acked-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21submodule: whitespace fixLibravatar Tay Ray Chuan1-3/+3
Replace SPs with TAB. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-10Merge branch 'fg/submodule-git-file-git-dir'Libravatar Junio C Hamano1-11/+57
* fg/submodule-git-file-git-dir: Move git-dir for submodules rev-parse: add option --resolve-git-dir <path> Conflicts: cache.h git-submodule.sh
2011-08-25Merge branch 'js/i18n-scripts'Libravatar Junio C Hamano1-12/+6
* js/i18n-scripts: submodule: take advantage of gettextln and eval_gettextln. stash: take advantage of eval_gettextln pull: take advantage of eval_gettextln git-am: take advantage of gettextln and eval_gettextln. gettext: add gettextln, eval_gettextln to encode common idiom
2011-08-22Move git-dir for submodulesLibravatar Fredrik Gustafsson1-5/+40
Move git-dir for submodules into $GIT_DIR/modules/[name_of_submodule] of the superproject. This is a step towards being able to delete submodule directories without loosing the information from their .git directory as that is now stored outside the submodules work tree. This is done relying on the already existent .git-file functionality. When adding or updating a submodule whose git directory is found under $GIT_DIR/modules/[name_of_submodule], don't clone it again but simply point the .git-file to it and remove the now stale index file from it. The index will be recreated by the following checkout. This patch will not affect already cloned submodules at all. Tests that rely on .git being a directory have been fixed. Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com> Mentored-by: Jens Lehmann <Jens.Lehmann@web.de> Mentored-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-08Merge branch 'jl/submodule-update-quiet'Libravatar Junio C Hamano1-2/+7
* jl/submodule-update-quiet: submodule: update and add must honor --quiet flag
2011-08-08submodule: take advantage of gettextln and eval_gettextln.Libravatar Jon Seymour1-12/+6
Signed-off-by: Jon Seymour <jon.seymour@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-28submodule: update and add must honor --quiet flagLibravatar Jens Lehmann1-2/+7
When using the --quiet flag "git submodule update" and "git submodule add" didn't behave as the documentation stated. They printed progress output from the clone, even though they should only print error messages. Fix that by passing the -q flag to git clone in module_clone() when the GIT_QUIET variable is set. Two tests in t7400 have been modified to test that behavior. Reported-by: Daniel Holtmann-Rice <flyingtabmow@gmail.com> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-22Merge branch 'jl/submodule-add-relurl-wo-upstream'Libravatar Junio C Hamano1-10/+2
* jl/submodule-add-relurl-wo-upstream: submodule add: clean up duplicated code submodule add: allow relative repository path even when no url is set submodule add: test failure when url is not configured in superproject Conflicts: git-submodule.sh
2011-07-19Merge branch 'jc/submodule-sync-no-auto-vivify'Libravatar Junio C Hamano1-27/+31
* jc/submodule-sync-no-auto-vivify: submodule add: always initialize .git/config entry submodule sync: do not auto-vivify uninteresting submodule Conflicts: git-submodule.sh
2011-07-13Merge branch 'bc/submodule-foreach-stdin-fix-1.7.4'Libravatar Junio C Hamano1-1/+5
* bc/submodule-foreach-stdin-fix-1.7.4: git-submodule.sh: preserve stdin for the command spawned by foreach t/t7407: demonstrate that the command called by 'submodule foreach' loses stdin Conflicts: git-submodule.sh
2011-07-13Merge branch 'fg/submodule-keep-updating'Libravatar Junio C Hamano1-5/+44
* fg/submodule-keep-updating: git-submodule.sh: clarify the "should we die now" logic submodule update: continue when a checkout fails git-sh-setup: add die_with_status Conflicts: git-submodule.sh
2011-06-29git-submodule.sh: preserve stdin for the command spawned by foreachLibravatar Brandon Casey1-1/+5
The user-supplied command spawned by 'submodule foreach' loses its connection to the original standard input. Instead, it is connected to the output of a pipe within the git-submodule script. The user-supplied command supplied to 'submodule foreach' is spawned within a while loop which is being piped into. Due to the way shells implement piping output to a while loop, a subshell is created with its standard input attached to the output of the pipe. This results in all of the commands executed within the while loop to have their stdins modified in the same way, including the user-supplied command. This can cause a problem if the command requires reading from stdin or if it changes its behavior based on whether stdin is a tty or not. For example, this problem was noticed when trying to execute the following: git submodule foreach git shortlog --since=two.weeks.ago which printed a message about entering the first submodule and produced no further output and exited with a status of zero. In this case, shortlog detected that it was not connected to a tty, and since no revision was supplied as an argument, it attempted to read the list of revisions from standard input. Instead, it slurped up the list of submodules that was being piped to the enclosing while loop and caused that loop to end early without processing the remaining submodules. Work around this behavior by saving the original standard input file descriptor before the while loop, and restoring it when spawning the user-supplied command. This fixes the tests in t7407. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-29Merge branch 'ab/i18n-scripts' into nextLibravatar Junio C Hamano1-45/+53
* ab/i18n-scripts: (48 commits) i18n: git-bisect bisect_next_check "You need to" message i18n: git-bisect [Y/n] messages i18n: git-bisect bisect_replay + $1 messages i18n: git-bisect bisect_reset + $1 messages i18n: git-bisect bisect_run + $@ messages i18n: git-bisect die + eval_gettext messages i18n: git-bisect die + gettext messages i18n: git-bisect echo + eval_gettext message i18n: git-bisect echo + gettext messages i18n: git-bisect gettext + echo message i18n: git-bisect add git-sh-i18n i18n: git-stash drop_stash say/die messages i18n: git-stash "unknown option" message i18n: git-stash die + eval_gettext $1 messages i18n: git-stash die + eval_gettext $* messages i18n: git-stash die + eval_gettext messages i18n: git-stash die + gettext messages i18n: git-stash say + gettext messages i18n: git-stash echo + gettext message i18n: git-stash add git-sh-i18n ...
2011-06-26submodule add: always initialize .git/config entryLibravatar Jens Lehmann1-17/+18
When "git submodule add $path" is run to add a subdirectory $path to the superproject, and $path is already the top of the working tree of the submodule repository, the command created submodule.$path.url entry in the configuration file in the superproject. However, when adding a repository $URL that is outside the respository of the superproject to $path that does not exist (yet) with "git submodule add $URL $path", the command forgot to set it up. The user is expressing the interest in the submodule and wants to keep a checkout, the "submodule add" command should consistently set up the submodule.$path.url entry in either case. As a result "git submodule init" can't simply skip the initialization of those submodules for which it finds an url entry in the git./config anymore. That lead to problems when adding a submodule (which now sets the url), add the "update" setting to .gitmodules and expect init to copy that into .git/config like it is done in t7406. So change init to only then copy the "url" and "update" entries when they don't exist yet in the .git/config and do nothing otherwise. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-26submodule sync: do not auto-vivify uninteresting submoduleLibravatar Junio C Hamano1-10/+13
Earlier 33f072f (submodule sync: Update "submodule.<name>.url" for empty directories, 2010-10-08) attempted to fix a bug where "git submodule sync" command does not update the URL if the current superproject does not have a checkout of the submodule. However, it did so by unconditionally registering submodule.$name.url to every submodule in the project, even the ones that the user has never showed interest in at all by running 'git submodule init' command. This caused subsequent 'git submodule update' to start cloning/updating submodules that are not interesting to the user at all. Update the code so that the URL is updated from the .gitmodules file only for submodules that already have submodule.$name.url entries, i.e. the ones the user has showed interested in having a checkout. Acked-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-13git-submodule.sh: clarify the "should we die now" logicLibravatar Junio C Hamano1-9/+8
Earlier the decision to stop or continue was made on the $action variable that was set by inspecting $update_module variable. The former is a redundant variable and will be removed in another topic. Decide upon inspecting $update_module if a failure should cascade up to cause us immediately stop, and use a variable that means just that, to clarify the logic. Incidentally this also makes the merge with the other topic slightly easier and cleaner to understand. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-13submodule update: continue when a checkout failsLibravatar Fredrik Gustafsson1-6/+44
"git submodule update" stops at the first error and gives control back to the user. Only after the user fixes the problematic submodule and runs "git submodule update" again, the second error is found. And the user needs to repeat until all the problems are found and fixed one by one. This is tedious. Instead, the command can remember which submodules it had trouble with, continue updating the ones it can, and report which ones had errors at the end. The user can run "git submodule update", find all the ones that need minor fixing (e.g. working tree was dirty) to fix them in a single pass. Then another "git submodule update" can be run to update all. Note that the problematic submodules are skipped only when they are to be integrated with a safer value of submodule.<name>.update option, namely "checkout". Fixing a failure in a submodule that uses "rebase" or "merge" may need an involved conflict resolution by the user, and leaving too many submodules in states that need resolution would not reduce the mental burden on the user. Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com> Mentored-by: Jens Lehmann <Jens.Lehmann@web.de> Mentored-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-06submodule add: clean up duplicated codeLibravatar Jens Lehmann1-9/+1
In cmd_add() the switch statement used to resolve a relative url was present twice. Remove the second one and use the realrepo variable set by the first one (lines 194 ff.) instead. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-06submodule add: allow relative repository path even when no url is setLibravatar Jens Lehmann1-1/+1
Adding a submodule with a relative repository path did only succeed when the superproject's default remote was set. But when that is unset, the superproject is its own authoritative upstream, so lets use its working directory as upstream instead. This allows users to set up a new superpoject where the submodules urls are configured relative to the superproject's upstream while its default remote can be configured later. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-30Merge branch 'maint'Libravatar Junio C Hamano1-1/+1
* maint: git-submodule.sh: separate parens by a space to avoid confusing some shells Documentation/technical/api-diff.txt: correct name of diff_unmerge() read_gitfile_gently: use ssize_t to hold read result remove tests of always-false condition rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
2011-05-26git-submodule.sh: separate parens by a space to avoid confusing some shellsLibravatar Brandon Casey1-1/+1
Some shells interpret '(( ))' according to the rules for arithmetic expansion. This may not follow POSIX, but is prevalent in commonly used shells. Bash does not have a problem with this particular instance of '((', likely because it is not followed by a '))', but the public domain ksh does, and so does ksh on IRIX 6.5. So, add a space between the parenthesis to avoid confusing these shells. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule "blob" and "submodule" messagesLibravatar Ævar Arnfjörð Bjarmason1-2/+4
Gettextize the words "blob" and "submodule", which will be interpolated in a message emitted by git-submodule. This is explicitly tested for so we need to skip a portion of a test with test_i18ncmp. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule "path not initialized" messageLibravatar Ævar Arnfjörð Bjarmason1-2/+2
Gettextize the "Submodule path '$path' not initialized" message. This is explicitly tested for so we need to skip a portion of a test with test_i18grep. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule "[...] path is ignored" messageLibravatar Ævar Arnfjörð Bjarmason1-3/+6
Gettextize the "The following path is ignored" message. This is explicitly tested for so we need to skip a portion of a test with test_i18ncmp. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule "Entering [...]" messageLibravatar Ævar Arnfjörð Bjarmason1-1/+1
Gettextize the "Entering [...]" message. This is explicitly tested for so we need to skip a portion of a test with test_i18ncmp. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule $errmsg messagesLibravatar Ævar Arnfjörð Bjarmason1-3/+3
Gettextize warning messages stored in the $errmsg variable using eval_gettext interpolation. This is explicitly tested for so we need to skip a portion of a test with test_i18ncmp. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule "Submodule change[...]" messagesLibravatar Ævar Arnfjörð Bjarmason1-2/+2
Gettextize the "Submodules changed but not updated" and "Submodule changes to be committed" messages. This is explicitly tested for so we need to skip a portion of a test with test_i18ncmp. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule "cached cannot be used" messageLibravatar Ævar Arnfjörð Bjarmason1-1/+1
Gettextize the "--cached cannot be used with --files" message. Since this message starts with "--" we have to pass "--" as the first argument. This works with both GNU gettext 0.18.1 (as expected), and the gettext(1) on Solaris 10. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule $update_module say + die messagesLibravatar Ævar Arnfjörð Bjarmason1-9/+8
Gettextize $update_module say and die messages. These messages needed to be split up to make them translatable. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule die + eval_gettext messagesLibravatar Ævar Arnfjörð Bjarmason1-19/+19
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule say + eval_gettext messagesLibravatar Ævar Arnfjörð Bjarmason1-1/+1
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule echo + eval_gettext messagesLibravatar Ævar Arnfjörð Bjarmason1-2/+5
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-submodule add git-sh-i18nLibravatar Ævar Arnfjörð Bjarmason1-0/+1
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-02Merge branch 'nm/submodule-update-force'Libravatar Junio C Hamano1-5/+9
* nm/submodule-update-force: submodule: Add --force option for git submodule update Conflicts: t/t7406-submodule-update.sh
2011-04-04Merge branch 'jl/submodule-fetch-on-demand'Libravatar Junio C Hamano1-1/+4
* jl/submodule-fetch-on-demand: fetch/pull: Describe --recurse-submodule restrictions in the BUGS section submodule update: Don't fetch when the submodule commit is already present fetch/pull: Don't recurse into a submodule when commits are already present Submodules: Add 'on-demand' value for the 'fetchRecurseSubmodule' option config: teach the fetch.recurseSubmodules option the 'on-demand' value fetch/pull: Add the 'on-demand' value to the --recurse-submodules option fetch/pull: recurse into submodules when necessary Conflicts: builtin/fetch.c submodule.c
2011-04-04submodule: Add --force option for git submodule updateLibravatar Nicolas Morey-Chaisemartin1-5/+9
By default git submodule update runs a simple checkout on submodules that are not up-to-date. If the submodules contains modified or untracked files, the command may exit sanely with an error: $ git submodule update error: Your local changes to the following files would be overwritten by checkout: file Please, commit your changes or stash them before you can switch branches. Aborting Unable to checkout '1b69c6e55606b48d3284a3a9efe4b58bfb7e8c9e' in submodule path 'test1' In order to reset a whole git submodule tree, a user has to run first 'git submodule foreach --recursive git checkout -f' and then run 'git submodule update'. This patch adds a --force option for the update command (only used for submodules without --rebase or --merge options). It passes the --force option to git checkout which will throw away the local changes. Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Acked-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-30submodule: process conflicting submodules only onceLibravatar Nicolas Morey-Chaisemartin1-1/+28
During a merge module_list returns conflicting submodules several times (stage 1,2,3) which caused the submodules to be used multiple times in git submodule init, sync, update and status command. There are 5 callers of module_list; they all read (mode, sha1, stage, path) tuple, and most of them care only about path. As a first level approximation, it should be Ok (in the sense that it does not make things worse than it currently is) to filter the duplicate paths from module_list output, but some callers should change their behaviour when the merge in the superproject still has conflicts. Notice the higher-stage entries, and emit only one record from module_list, but while doing so, mark the entry with "U" (not [0-3]) in the $stage field and null out the SHA-1 part, as the object name for the lowest stage does not give any useful information to the caller, and this way any caller that uses the object name would hopefully barf. Then update the codepaths for each subcommands this way: - "update" should not touch the submodule repository, because we do not know what commit should be checked out yet. - "status" reports the conflicting submodules as 'U000...000' and does not recurse into them (we might later want to make it recurse). - The command called by "foreach" may want to do whatever it wants to do by noticing the merged status in the superproject itself, so feed the path to it from module_list as before, but only once per submodule. - "init" and "sync" are unlikely things to do while the superproject is still not merged, but as long as a submodule is there in $path, there is no point skipping it. It might however want to take the merged status of .gitmodules into account, but that is outside of the scope of this topic. Acked-by: Jens Lehmann <Jens.Lehmann@web.de> Thanks-to: Junio C Hamano <gitster@pobox.com> Signed-off-by: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-09submodule update: Don't fetch when the submodule commit is already presentLibravatar Jens Lehmann1-1/+4
If the commit to be checked out on "git submodule update" has already been fetched in the submodule there is no need to run "git fetch" again. Since "git fetch" recently learned recursion (and the new on-demand mode to fetch commits recorded in the superproject is enabled by default) this will happen pretty often, thereby making the unconditional fetch during "git submodule update" unnecessary. If the commit is not present in the submodule (e.g. the user disabled the fetch on-demand mode) the fetch will be run as before. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-17submodule: no [--merge|--rebase] when newly clonedLibravatar Spencer E. Olson1-0/+9
"git submodule update" can be run with either the "--merge" or "--rebase" option, or submodule.<name>.update configuration variable can be set to "merge" or "rebase, to cause local work to get integrated when updating the submodule. When a submodule is newly cloned, however, it does not have a check out when a rebase or merge is attempted, leading to a failure. For newly cloned submodules, simply check out the appropriate revision. There is no local work to integrate with for them. Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Acked-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-13Merge branch 'tr/submodule-relative-scp-url'Libravatar Junio C Hamano1-2/+14
* tr/submodule-relative-scp-url: submodule: fix relative url parsing for scp-style origin
2011-01-10submodule: fix relative url parsing for scp-style originLibravatar Thomas Rast1-2/+14
The function resolve_relative_url was not prepared to deal with an scp-style origin 'user@host:path' in the case where 'path' is only a single component. Fix this by extending the logic that strips one path component from the $remoteurl. Also add tests for both styles of URLs. Noticed-by: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com> Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-16Merge branch 'jn/submodule-b-current'Libravatar Junio C Hamano1-15/+1
* jn/submodule-b-current: git submodule: Remove now obsolete tests before cloning a repo git submodule -b ... of current HEAD fails
2010-12-06git submodule: Remove now obsolete tests before cloning a repoLibravatar Jens Lehmann1-14/+0
Since 55892d23 "git clone" itself checks that the destination path is not a file but an empty directory if it exists, so there is no need anymore for module_clone() to check that too. Two tests have been added to test the behavior of "git submodule add" when path is a file or a directory (A subshell had to be added to the former last test to stay in the right directory). Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-06git submodule -b ... of current HEAD failsLibravatar Jonathan Nieder1-1/+1
git submodule add -b $branch $repository fails when HEAD already points to $branch in $repository. Reported-by: Klaus Ethgen <Klaus@Ethgen.de> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-17Merge branch 'kb/maint-submodule-savearg'Libravatar Junio C Hamano1-12/+9
* kb/maint-submodule-savearg: submodule: only preserve flags across recursive status/update invocations submodule: preserve all arguments exactly when recursing
2010-11-03submodule: only preserve flags across recursive status/update invocationsLibravatar Kevin Ballard1-11/+8
Recursive invocations of submodule update/status preserve all arguments, so executing git submodule update --recursive -- foo attempts to recursively update a submodule named "foo". Naturally, this fails as one cannot have an infinitely-deep stack of submodules each containing a submodule named "foo". The desired behavior is instead to update foo and then recursively update all submodules inside of foo. This commit accomplishes that by only saving the flags for use in the recursive invocation. Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-03submodule: preserve all arguments exactly when recursingLibravatar Kevin Ballard1-4/+4
Shell variables only hold strings, not lists of parameters, so $orig_args after orig_args="$@" fails to remember where each parameter starts and ends, if some include whitespace. So git submodule update \ --reference='/var/lib/common objects.git' \ --recursive --init becomes git submodule update --reference=/var/lib/common \ objects.git --recursive --init in the inner repositories. Use "git rev-parse --sq-quote" to save parameters in quoted form ready for evaluation by the shell, avoiding this problem. Helped-By: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>