summaryrefslogtreecommitdiff
path: root/git-submodule.sh
AgeCommit message (Collapse)Author
2008-09-29Merge branch 'maint' into bc/master-diff-hunk-header-fixShawn O. Pearce
* maint: (41 commits) Clarify commit error message for unmerged files Use strchrnul() instead of strchr() plus manual workaround Use remove_path from dir.c instead of own implementation Add remove_path: a function to remove as much as possible of a path git-submodule: Fix "Unable to checkout" for the initial 'update' Clarify how the user can satisfy stash's 'dirty state' check. Remove empty directories in recursive merge Documentation: clarify the details of overriding LESS via core.pager Update release notes for 1.6.0.3 checkout: Do not show local changes when in quiet mode for-each-ref: Fix --format=%(subject) for log message without newlines git-stash.sh: don't default to refs/stash if invalid ref supplied maint: check return of split_cmdline to avoid bad config strings builtin-prune.c: prune temporary packs in <object_dir>/pack directory Do not perform cross-directory renames when creating packs Use dashless git commands in setgitperms.perl git-remote: do not use user input in a printf format string make "git remote" report multiple URLs Start draft release notes for 1.6.0.3 git-repack uses --no-repack-object, not --no-repack-delta. ... Conflicts: RelNotes
2008-09-29git-submodule: Fix "Unable to checkout" for the initial 'update'Ping Yin
Since commit 55218("checkout: do not lose staged removal"), in cmd_add/cmd_update, "git checkout <commit>" following "git clone -n" may fail if <commit> is different from HEAD. So Use "git checkout -f <commit>" to fix this. Signed-off-by: Ping Yin <pkufranky@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-25Fix submodule sync with relative submodule URLsJohan Herland
Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-28Merge branch 'ml/submodule'Junio C Hamano
* ml/submodule: git-submodule.sh - Remove trailing / from URL if found git-submodule.sh - Remove trailing / from URL if found
2008-08-26git-submodule: add "sync" commandDavid Aguilar
When a submodule's URL changes upstream, existing submodules will be out of sync since their remote."$origin".url will still be set to the old value. This adds a "git submodule sync" command that reads submodules' URLs from .gitmodules and updates them accordingly. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-24git-submodule - Use "get_default_remote" from git-parse-remoteMark Levedahl
Resolve_relative_url was using its own code for this function, but this is duplication with the best result that this continues to work. Replace with the common function provided by git-parse-remote. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-23git-submodule: replace duplicated code with a module_list functionDavid Aguilar
Several call sites in git-submodule.sh used the same idiom for getting submodule information: git ls-files --stage -- "$@" | grep '^160000 ' This patch removes this duplication by introducing a module_list function. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-22git-submodule.sh - Remove trailing / from URL if foundMark Levedahl
git clone does not complain if a trailing '/' is included in the origin URL, but doing so causes resolution of a submodule's URL relative to the superproject to fail. Trailing /'s are likely when cloning locally using tab-completion, so the slash may appear in either superproject or submodule URL. So, ignore the trailing slash if it already exists in the superproject's URL, and don't record one for the submodule (which could itself have submodules...). The problem I'm trying to fix is that a number of folks have superprojects checked out where the recorded origin URL has a trailing /, and a submodule has its origin in a directory sitting right next to the superproject on the server. Thus, we have: superproject url = server:/public/super submodoule url = server:/public/sub1 However, in the checked out superproject's .git/config [remote "origin"] url = server:/public/super/ and for similar reasons, the submodule has its URL recorded in .gitmodules as [submodule "sub"] path = submodule1 url = ../sub1/ resolve_relative_url gets the submodule's recorded url as $1, which the caller retrieved from .gitmodules, and retrieves the superprojects origin from .git/config. So in this case resolve_relative_url has that: url = ../sub1/ remoteurl = server:/public/super/ So, without any patch, resolve_relative_url computes the submodule's URL as: server:/public/super/sub1/ rather than server:/public/sub1 In summary, it is essential that resolve_relative_url strip the trailing / from the superproject's url before starting, and beneficial if it assures that the result does not contain a trailing / as the submodule may itself also be a superproject. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-21git-submodule.sh - Remove trailing / from URL if foundMark Levedahl
git clone does not complain if a trailing '/' is included in the origin URL, but doing so causes resolution of a submodule's URL relative to the superproject to fail. Regardless of whether git is changed to remove the trailing / before recording the URL, we should avoid this issue in submodule as existing repositories can have this problem. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-17git-submodule - Add 'foreach' subcommandMark Levedahl
submodule foreach <command-list> will execute the list of commands in each currently checked out submodule directory. The list of commands is arbitrary as long as it is acceptable to sh. The variables '$path' and '$sha1' are availble to the command-list, defining the submodule path relative to the superproject and the submodules's commitID as recorded in the superproject (this may be different than HEAD in the submodule). This utility is inspired by a number of threads on the mailing list looking for ways to better integrate submodules in a tree and work with them as a unit. This could include fetching a new branch in each from a given source, or possibly checking out a given named branch in each. Currently, there is no consensus as to what additional commands should be implemented in the porcelain, requiring all users whose needs exceed that of git-submodule to do their own scripting. The foreach command is intended to support such scripting, and in particular does no error checking and produces no output, thus allowing end users complete control over any information printed out and over what constitutes an error. The processing does terminate if the command-list returns an error, but processing can easily be forced for all submodules be terminating the list with ';true'. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-22git-submodule: move ill placed shift.Pierre Habouzit
When running git submodule update -i, the "-i" is shifted before recursing into cmd_init and then again outside of the loop. This causes some /bin/sh to complain about shifting when there are no arguments left (and would discard anything written after -i too). Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15git-submodule - register submodule URL if adding in placeMark Levedahl
When adding a new submodule in place, meaning the user created the submodule as a git repo in the superproject's tree first, we don't go through "git submodule init" to register the module. Thus, the submodule's origin repository URL is not stored in .git/config, and no subsequent submodule operation will ever do so. In this case, assume the URL the user supplies to "submodule add" is the one that should be registered, and do so. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15git-submodule - make "submodule add" more strict, and document itMark Levedahl
This change makes "submodule add" much more strict in the arguments it takes, and is intended to address confusion as recently noted on the git-list. With this change, the required syntax is: $ git submodule add URL path Specifically, this eliminates the form $ git submodule add URL which was confused by more than one person as $ git submodule add path With this patch, the URL locating the submodule's origin repository can be either an absolute URL, or (if it begins with ./ or ../) can express the submodule's repository location relative to the superproject's origin. This patch also eliminates a third form of URL, which was relative to the superproject's top-level directory (not its repository). Any URL that was neither absolute nor matched ./*|../* was assumed to point to a subdirectory of the superproject as the location of the submodule's origin repository. This URL form was confusing and does not seem to correspond to an important use-case. Specifically, no-one has identified the need to clone from a repository already in the superproject's tree, but if this is needed it is easily done using an absolute URL: $(pwd)/relative-path. So, no functionality is lost with this patch. (t6008-rev-list-submodule.sh did rely upon this relative URL, fixed by using $(pwd).) Following this change, there are exactly four variants of submodule-add, as both arguments have two flavors: URL can be absolute, or can begin with ./|../ and thus names the submodule's origin relative to the superproject's origin. Note: With this patch, "submodule add" discerns an absolute URL as matching /*|*:*: e.g., URL begins with /, or it contains a :. This works for all valid URLs, an absolute path in POSIX, as well as an absolute path on Windows). path can either already exist as a valid git repo, or will be cloned from the given URL. The first form here eases creation of a new submodule in an existing superproject as the submodule can be added and tested in-tree before pushing to the public repository. However, the more usual form is the second, where the repo is cloned from the given URL. This specifically addresses the issue of $ git submodule add a/b/c attempting to clone from a repository at "a/b/c" to create a new module in "c". This also simplifies description of "relative URL" as there is now exactly *one* form: a URL relative to the parent's origin repo. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-08git-submodule - Fix bugs in adding an existing repo as a moduleMark Levedahl
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>
2008-06-14git-submodule - Fix errors regarding resolve_relative_urlMark Levedahl
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>
2008-06-13Improve sed portabilityChris Ridd
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>
2008-05-16submodule update: add convenience option --initJohannes Schindelin
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>
2008-05-16Use '-f' option to point to the .gitmodules fileImran M Yousuf
'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>
2008-05-06Merge branch 'lh/git-file'Junio C Hamano
* 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"
2008-04-20Merge branch 'py/submodule'Junio C Hamano
* py/submodule: builtin-status: Add tests for submodule summary builtin-status: submodule summary support git-submodule summary: --for-status option
2008-04-15git-submodule - possibly use branch name to describe a moduleMark Levedahl
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>
2008-04-13git-submodule summary: --for-status optionPing Yin
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>
2008-04-12git-submodule: Avoid 'fatal: cannot describe' messagePing Yin
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>
2008-04-09Teach git-submodule.sh about the .git fileLars Hjemli
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>
2008-03-15Merge branch 'jk/portable'Junio C Hamano
* 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
2008-03-15Merge branch 'py/submodule'Junio C Hamano
* 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
2008-03-13grep portability fix: don't use "-e" or "-q"Jeff King
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>
2008-03-12git-submodule summary: fix that some "wc" flavors produce leading spacesJohannes Sixt
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>
2008-03-12git-submodule summary: limit summary sizePing Yin
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>
2008-03-12git-submodule summary: show commit summaryPing Yin
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>
2008-03-12git-submodule summary: code frameworkPing Yin
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>
2008-03-05git-submodule - Allow adding a submodule in-placeMark Levedahl
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>
2008-03-03git-submodule: Fix typo 'url' which should be '$url'Ping Yin
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>
2008-01-21git-submodule: fix subcommand parserJunio C Hamano
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>
2008-01-21git-submodule: rename shell functions for consistencyJunio C Hamano
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>
2007-12-04Do not rely on the exit status of "unset" for unset variablesH.Merijn Brand
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>
2007-11-18Merge branch 'ph/parseopt-sh'Junio C Hamano
* 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.
2007-11-09Merge branch 'maint'Junio C Hamano
* 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>
2007-11-08Fix sed string regex escaping in module_name.Ralf Wildenhues
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>
2007-11-06scripts: Add placeholders for OPTIONS_SPECJunio C Hamano
--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>
2007-09-30Fix adding a submodule with a remote urlDaniel Barkalow
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>
2007-09-25git-submodule - allow a relative path as the subproject urlMark Levedahl
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>
2007-09-23Supplant the "while case ... break ;; esac" idiomDavid Kastrup
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>
2007-08-17git-submodule: re-enable 'status' as the default subcommandLars Hjemli
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>
2007-07-25git-submodule: remove redundant call to git-describeJunio C Hamano
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>
2007-07-25git-submodule module_name: avoid using unwieldy "value_regexp" feature.Junio C Hamano
"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>
2007-07-04git-submodule: Fix two instances of the same typoCJ van den Berg
They break the output of git submodule status. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-03Rewrite "git-frotz" to "git frotz"Junio C Hamano
This uses the remove-dashes target to replace "git-frotz" to "git frotz". Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-02git-submodule: Instead of using only annotated tags, use any tags.Emil Medve
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>
2007-07-02git-submodule: provide easy way of adding new submodulesSven Verdoolaege
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>