aboutsummaryrefslogtreecommitdiff
path: root/git-submodule.sh
Commit message (Collapse)AuthorAge
* git-submodule - Fix bugs in adding an existing repo as a moduleMark Levedahl2008-07-08
| | | | | | | | git-submodule add would trip if path to the submodule included a space, or if its .git was a gitdir: link to a GIT_DIR kept elsewhere. Fix both. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule - Fix errors regarding resolve_relative_urlMark Levedahl2008-06-14
| | | | | | | | | | | | git-submodule was invoking "die" from within resolve-relative-url, but this does not actually cause the script to exit. Fix this by returning the error to the caller and have the caller exit. While we're at it, clean up the quoting on invocation of resolve_relative_url as it was wrong. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Improve sed portabilityChris Ridd2008-06-12
| | | | | | | | | | | | | | | | | | | The behaviour of "sed" on an incomplete line is unspecified by POSIX, and On Solaris it apparently fails to process input that doesn't end in a LF. Consequently constructs like re=$(printf '%s' foo | sed -e 's/bar/BAR/g' $) cause re to be set to the empty string. Such a construct is used in git-submodule.sh. Because the LF at the end of command output are stripped away by the command substitution, it is a safe and sane change to add a LF at the end of the printf format specifier. Signed-off-by: Chris Ridd <chris.ridd@isode.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* submodule update: add convenience option --initJohannes Schindelin2008-05-16
| | | | | | | | | | | | | When a submodule is not initialized and you do not want to change the defaults from .gitmodules anyway, you can now say $ git submodule update --init <name> When "update" is called without --init on an uninitialized submodule, a hint to use --init is printed. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Use '-f' option to point to the .gitmodules fileImran M Yousuf2008-05-16
| | | | | | | | | 'git config' has a '-f' option that takes the file to parse. Using it rather than the environment variable seems more logical and simplified. Signed-off-by: Imran M Yousuf <imyousuf@smartitengineering.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'lh/git-file'Junio C Hamano2008-05-05
|\ | | | | | | | | | | | | | | * lh/git-file: Teach GIT-VERSION-GEN about the .git file Teach git-submodule.sh about the .git file Teach resolve_gitlink_ref() about the .git file Add platform-independent .git "symlink"
| * Teach git-submodule.sh about the .git fileLars Hjemli2008-04-09
| | | | | | | | | | | | | | | | | | | | When git-submodule tries to detect 'active' submodules, it checks for the existence of a directory named '.git'. This isn't good enough now that .git can be a file pointing to the real $GIT_DIR so the tests are changed to reflect this. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'py/submodule'Junio C Hamano2008-04-19
|\ \ | | | | | | | | | | | | | | | | | | * py/submodule: builtin-status: Add tests for submodule summary builtin-status: submodule summary support git-submodule summary: --for-status option
| * | git-submodule summary: --for-status optionPing Yin2008-04-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | The --for-status option is mainly used by builtin-status/commit. It adds 'Modified submodules:' line at top and '# ' prefix to all following lines. Signed-off-by: Ping Yin <pkufranky@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | git-submodule - possibly use branch name to describe a moduleMark Levedahl2008-04-14
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the search logic for describing a submodule from: - annotated tag - any tag - tag on a subsequent commit - commit id to - annotated tag - any tag - tag on a subsequent commit - local or remote branch - commit id The change is describing with respect to a branch before falling back to the commit id. By itself, git-submodule will maintain submodules as headless checkouts without ever making a local branch. In general, such heads can always be described relative to the remote branch regardless of existence of tags, and so provides a better fallback summary than just the commit id. This requires inserting an extra describe step as --contains is incompatible with --all, but the latter can be used with --always to fall back to a commit ID. Also, --contains implies --tags, so the latter is not needed. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-submodule: Avoid 'fatal: cannot describe' messagePing Yin2008-04-11
|/ | | | | | | | | | When "git submodule status" command tries to show the name of the submodule HEAD revision more descriptively, but the submodule repository lacked a suitable tag to do so, it leaked "fatal: cannot describe" message to the UI. Squelch it by using '--always'. Signed-off-by: Ping Yin <pkufranky@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jk/portable'Junio C Hamano2008-03-15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jk/portable: t6000lib: re-fix tr portability t7505: use SHELL_PATH in hook t9112: add missing #!/bin/sh header filter-branch: use $SHELL_PATH instead of 'sh' filter-branch: don't use xargs -0 add NO_EXTERNAL_GREP build option t6000lib: tr portability fix t4020: don't use grep -a add test_cmp function for test scripts remove use of "tail -n 1" and "tail -1" grep portability fix: don't use "-e" or "-q" more tr portability test script fixes t0050: perl portability fix tr portability fixes
| * grep portability fix: don't use "-e" or "-q"Jeff King2008-03-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | System V versions of grep (such as Solaris /usr/bin/grep) don't understand either of these options. git's usage of "grep -e pattern" fell into one of two categories: 1. equivalent to "grep pattern". -e is only useful here if the pattern begins with a "-", but all of the patterns are hardcoded and do not begin with a dash. 2. stripping comments and blank lines with grep -v -e "^$" -e "^#" We can fortunately do this in the affirmative as grep '^[^#]' Uses of "-q" can be replaced with redirection to /dev/null. In many tests, however, "grep -q" is used as "if this string is in the expected output, we are OK". In this case, it is fine to just remove the "-q" entirely; it simply makes the "verbose" mode of the test slightly more verbose. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'py/submodule'Junio C Hamano2008-03-15
|\ \ | |/ |/| | | | | | | | | | | | | | | * py/submodule: git-submodule summary: fix that some "wc" flavors produce leading spaces git-submodule summary: test git-submodule summary: documentation git-submodule summary: limit summary size git-submodule summary: show commit summary git-submodule summary: code framework
| * git-submodule summary: fix that some "wc" flavors produce leading spacesJohannes Sixt2008-03-12
| | | | | | | | | | | | | | | | | | | | We print the number of commits in parentheses, but without this change we would get an oddly looking line like this: * sm1 4c8d358...41fbea9 ( 4): Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git-submodule summary: limit summary sizePing Yin2008-03-11
| | | | | | | | | | | | | | | | | | | | | | | | This patch teaches git-submodule an option '--summary-limit|-n <number>' to limit number of commits in total for the summary of each submodule in the modified case (only a single commit is shown in other cases). Giving 0 will disable the summary; a negative number means unlimted, which is the default. Signed-off-by: Ping Yin <pkufranky@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git-submodule summary: show commit summaryPing Yin2008-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does the hard work to show submodule commit summary. For a modified submodule, a series of commits will be shown with the following command: git log --pretty='format:%m %s' \ --first-parent sha1_src...sha1_dst where the sha1_src is from the given super project commit and the sha1_dst is from the index or working tree (switched by --cached). For a deleted, added, or typechanged (blob<->submodule) submodule, only one single newest commit from the existing end (for example, src end for submodule deleted or type changed from submodule to blob) will be shown. If the src/dst sha1 for a submodule is missing in the submodule directory, a warning will be issued except in two cases where the submodule directory is deleted (type 'D') or typechanged to blob (one case of type 'T'). In the title line for a submodule, the src/dst sha1 and the number of commits (--first-parent) between the two commits will be shown. The following example demonstrates most cases. Example: commit summary for modified submodules sm1-sm5. -------------------------------------------- $ git submodule summary * sm1 354cd45...3f751e5 (4): < one line message for C < one line message for B > one line message for D > one line message for E * sm2 5c8bfb5...000000 (3): < one line message for F * sm3 354cd45...3f751e5: Warn: sm3 doesn't contain commit 354cd45 * sm4 354cd34(submodule)-> 235efa(blob) (1): < one line message for G * sm5 354cd34(blob)-> 235efa(submodule) (5): > one line message for H -------------------------------------------- Signed-off-by: Ping Yin <pkufranky@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git-submodule summary: code frameworkPing Yin2008-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These patches teach git-submodule a new subcommand 'summary' to show commit summary of checked out submodules between a given super project commit (defaults to HEAD) and working tree (or index, when --cached is given). This patch just introduces the framework to find submodules which have summary to show. A submodule will have summary if it falls into these cases: - type 'M': modified and checked out (1) - type 'A': added and checked out (2) - type 'D': deleted - type 'T': typechanged (blob <-> submodule) Notes: 1. There may be modified but not checked out cases. In the case of a merge conflict, even if the submodule is not checked out, there may be still a diff between index and HEAD on the submodule entry (i.e. modified). The summary will not be show for such a submodule. 2. A similar explanation applies to the added but not checked out case. Signed-off-by: Ping Yin <pkufranky@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-submodule - Allow adding a submodule in-placeMark Levedahl2008-03-05
|/ | | | | | | | | | | | | | | | | | | | When working in the top-level project, it is useful to create a new submodule as a git repo in a subdirectory, then add that submodule to the top-level in place. This patch allows "git submodule add <intended url> subdir" to add the existing subdir to the current project. The presumption is the user will later push / clone the subdir to the <intended url> so that future submodule init / updates will work. Absent this patch, "git submodule add" insists upon cloning the subdir from a repository at the given url, which is fine for adding an existing project in, but less useful when adding a new submodule from scratch to an existing project. The former functionality remains, and the clone is attempted if the subdir does not already exist as a valid git repo. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: Fix typo 'url' which should be '$url'Ping Yin2008-03-02
| | | | | | | | Fix typo in 'test -z "url"' when checking whether a submodule url is empty. "url" should be "$url". Signed-off-by: Ping Yin <pkufranky@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: fix subcommand parserJunio C Hamano2008-01-20
| | | | | | | | | | | | | | | | | | | | | | | | The subcommand parser of "git submodule" made its subcommand names reserved words. As a consequence, a command like this: $ git submodule add init update which is meant to add a submodule called 'init' at path 'update' was misinterpreted as a request to invoke more than one mutually incompatible subcommands and incorrectly rejected. This patch fixes the issue by stopping the subcommand parsing at the first subcommand word, to allow the sample command line above to work as expected. It also introduces the usual -- option disambiguator, so that a submodule at path '-foo' can be updated with $ git submodule update -- -foo without triggering an "unrecognized option -foo" error. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: rename shell functions for consistencyJunio C Hamano2008-01-20
| | | | | | | | | | | This renames the shell functions used in git-submodule that implement top-level subcommands. The rule is that the subcommand $foo is implemented by cmd_$foo function. A noteworthy change is that modules_list() is now known as cmd_status(). There is no "submodule list" command. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Do not rely on the exit status of "unset" for unset variablesH.Merijn Brand2007-12-04
| | | | | | | | | | | | | | | POSIX says that exit status "0" means that "unset" successfully unset the variable. However, it is kind of ambiguous if an environment variable which was not set could be successfully unset. At least the default shell on HP-UX insists on reporting an error in such a case, so just ignore the exit status of "unset". [Dscho: extended the patch to git-submodule.sh, as Junio realized that this is the only other place where we check the exit status of "unset".] Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'ph/parseopt-sh'Junio C Hamano2007-11-17
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ph/parseopt-sh: git-quiltimport.sh fix --patches handling git-am: -i does not take a string parameter. sh-setup: don't let eval output to be shell-expanded. git-sh-setup: fix parseopt `eval` string underquoting Give git-am back the ability to add Signed-off-by lines. git-rev-parse --parseopt scripts: Add placeholders for OPTIONS_SPEC Migrate git-repack.sh to use git-rev-parse --parseopt Migrate git-quiltimport.sh to use git-rev-parse --parseopt Migrate git-checkout.sh to use git-rev-parse --parseopt --keep-dashdash Migrate git-instaweb.sh to use git-rev-parse --parseopt Migrate git-merge.sh to use git-rev-parse --parseopt Migrate git-am.sh to use git-rev-parse --parseopt Migrate git-clone to use git-rev-parse --parseopt Migrate git-clean.sh to use git-rev-parse --parseopt. Update git-sh-setup(1) to allow transparent use of git-rev-parse --parseopt Add a parseopt mode to git-rev-parse to bring parse-options to shell scripts.
| * scripts: Add placeholders for OPTIONS_SPECJunio C Hamano2007-11-06
| | | | | | | | | | | | | | | | | | --text follows this line-- These commands currently lack OPTIONS_SPEC; allow people to easily list with "git grep 'OPTIONS_SPEC=$'" what they can help improving. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'maint'Junio C Hamano2007-11-09
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | * maint: Start preparing for 1.5.3.6 git-send-email: Change the prompt for the subject of the initial message. SubmittingPatches: improve the 'Patch:' section of the checklist instaweb: Minor cleanups and fixes for potential problems stop t1400 hiding errors in tests Makefile: add missing dependency on wt-status.h refresh_index_quietly(): express "optional" nature of index writing better Fix sed string regex escaping in module_name. Avoid a few unportable, needlessly nested "...`...". git-mailsplit: with maildirs not only process cur/, but also new/ Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Fix sed string regex escaping in module_name.Ralf Wildenhues2007-11-08
| | | | | | | | | | | | | | | | | | | | When escaping a string to be used as a sed regex, it is important to only escape active characters. Escaping other characters is undefined according to POSIX, and in practice leads to issues with extensions such as GNU sed's \+. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Fix adding a submodule with a remote urlDaniel Barkalow2007-09-29
| | | | | | | | | | | | | | Without this, a non-path URL gets lost before the clone. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-submodule - allow a relative path as the subproject urlMark Levedahl2007-09-25
|/ | | | | | | | | | | | | | This allows a subproject's location to be specified and stored as relative to the parent project's location (e.g., ./foo, or ../foo). This url is stored in .gitmodules as given. It is resolved into an absolute url by appending it to the parent project's url when the information is written to .git/config (i.e., during submodule add for the originator, and submodule init for a downstream recipient). This allows cloning of the project to work "as expected" if the project is hosted on a different server than when the subprojects were added. Signed-off-by: Mark Levedahl <mdl123@verizon.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Supplant the "while case ... break ;; esac" idiomDavid Kastrup2007-09-23
| | | | | | | | | | | | | | | | | | | | | | A lot of shell scripts contained stuff starting with while case "$#" in 0) break ;; esac and similar. I consider breaking out of the condition instead of the body od the loop ugly, and the implied "true" value of the non-matching case is not really obvious to humans at first glance. It happens not to be obvious to some BSD shells, either, but that's because they are not POSIX-compliant. In most cases, this has been replaced by a straight condition using "test". "case" has the advantage of being faster than "test" on vintage shells where "test" is not a builtin. Since none of them is likely to run the git scripts, anyway, the added readability should be worth the change. A few loops have had their termination condition expressed differently. Signed-off-by: David Kastrup <dak@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: re-enable 'status' as the default subcommandLars Hjemli2007-08-17
| | | | | | | | This was broken as part of ecda072380. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Acked-by: Sven Verdoolaege <skimo@kotnet.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: remove redundant call to git-describeJunio C Hamano2007-07-25
| | | | | | | | The code to find a more descriptive name given a commit in a submodule were improved in bffe71f, but it forgot to remove the older logic the patch replaced. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule module_name: avoid using unwieldy "value_regexp" feature.Junio C Hamano2007-07-25
| | | | | | | | | | | | | | | | "module_name $path" function wants to look up a configuration variable "submodule.<modulename>.path" whose value is $path, and return the <modulename> found. "git-config --get-regexp" is the natural thing to use for this, but (1) its value matching has an unfortunate "feature" that takes leading '!' specially, and (2) its output needs to be parsed with sed to extract <modulename> part anyway. This changes the call to "git-config --get-regexp" not to use the value-regexp part, and moves the "pick the one whose value is $path" part to the downstream sed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: Fix two instances of the same typoCJ van den Berg2007-07-04
| | | | | | They break the output of git submodule status. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Rewrite "git-frotz" to "git frotz"Junio C Hamano2007-07-02
| | | | | | This uses the remove-dashes target to replace "git-frotz" to "git frotz". Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: Instead of using only annotated tags, use any tags.Emil Medve2007-07-02
| | | | | | | | | | | Some repositories might not use/have annotated tags (for example the ones created with git-cvsimport) and git-submodule status might fail because git-describe might fail to find a tag. This change allows the status of a submodule to be described/displayed relative to lightweight tags as well. Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: provide easy way of adding new submodulesSven Verdoolaege2007-07-02
| | | | | | | | | | | | | To make a submodule effectively usable, the path and a URL where the submodule can be cloned need to be stored in .gitmodules. This subcommand takes care of setting this information after cloning the new submodule. Only the index is updated, so, if needed, the user may still change the URL or switch to a different branch of the submodule before committing. Signed-off-by: Sven Verdoolaege <skimo@kotnet.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: give submodules proper namesLars Hjemli2007-06-12
| | | | | | | | | | | | | This changes the way git-submodule uses .gitmodules: Subsections no longer specify the submodule path, they now specify the submodule name. The submodule path is found under the new key "submodule.<name>.path", which is a required key. With this change a submodule can be moved between different 'checkout paths' without upsetting git-submodule. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Rename sections from "module" to "submodule" in .gitmodulesLars Hjemli2007-06-12
| | | | | | | | | Rename [module] to [submodule], so that it would be more forward compatible with the proposed extension by harmonizing the section names used in .gitmodules and .git/config. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: remember to checkout after cloneLars Hjemli2007-06-12
| | | | | | | | | | After the initial clone of a submodule, no files would be checked out in the submodule directory if the submodule HEAD was equal to the SHA-1 specified in the index of the containing repository. This fixes the problem by simply ignoring submodule HEAD for a fresh clone. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: clone during update, not during initLars Hjemli2007-06-06
| | | | | | | | | | | | This teaches 'git-submodule init' to register submodule paths and urls in .git/config instead of actually cloning them. The cloning is now handled as part of 'git-submodule update'. With this change it is possible to specify preferred/alternate urls for the submodules in .git/config before the submodules are cloned. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-submodule: move cloning into a separate functionLars Hjemli2007-06-06
| | | | | | | | This is just a simple refactoring of modules_init() with no change in functionality. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add git-submodule commandLars Hjemli2007-05-26
This command can be used to initialize, update and inspect submodules. It uses a .gitmodules file, readable by git-config, in the top level directory of the 'superproject' to specify a mapping between submodule paths and repository url. Example .gitmodules layout: [module "git"] url = git://git.kernel.org/pub/scm/git/git.git With this entry in .gitmodules (and a commit reference in the index entry for the path "git"), the command 'git submodule init' will clone the repository at kernel.org into the directory "git". Known issues ============ There is currently no way to override the url found in the .gitmodules file, except by manually creating the subproject repository. The place to fix this in the script has a rather long comment about a possible plan. Funny paths will be quoted in the output from git-ls-files, but git-submodule does not attempt to unquote (or even detect the presence of) such paths. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>