From: John Keeping <john@keeping.me.uk>
To: git@vger.kernel.org
Cc: Jens Lehmann <Jens.Lehmann@web.de>,
Heiko Voigt <hvoigt@hvoigt.net>,
John Keeping <john@keeping.me.uk>
Subject: [PATCH 2/2] submodule: drop the top-level requirement
Date: Sun, 7 Apr 2013 20:55:21 +0100 [thread overview]
Message-ID: <da121bcc33e63b7f33318ef920e85a77bb304d44.1365364193.git.john@keeping.me.uk> (raw)
In-Reply-To: <cover.1365364193.git.john@keeping.me.uk>
In-Reply-To: <cover.1365364193.git.john@keeping.me.uk>
Use the new rev-parse --filename-prefix option to process all paths
given to the submodule command, dropping the requirement that it be run
from the top-level of the repository.
Signed-off-by: John Keeping <john@keeping.me.uk>
---
git-submodule.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/git-submodule.sh b/git-submodule.sh
index 79bfaac..10216aa 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -14,10 +14,13 @@ USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <re
or: $dashless [--quiet] foreach [--recursive] <command>
or: $dashless [--quiet] sync [--recursive] [--] [<path>...]"
OPTIONS_SPEC=
+SUBDIRECTORY_OK=Yes
. git-sh-setup
. git-sh-i18n
. git-parse-remote
require_work_tree
+wt_prefix=$(git rev-parse --show-prefix)
+cd_to_toplevel
command=
branch=
@@ -112,6 +115,7 @@ resolve_relative_url ()
#
module_list()
{
+ eval "set $(git rev-parse --sq --filename-prefix "$wt_prefix" -- "$@")"
(
git ls-files --error-unmatch --stage -- "$@" ||
echo "unmatched pathspec exists"
@@ -335,6 +339,8 @@ cmd_add()
usage
fi
+ sm_path="$wt_prefix$sm_path"
+
# assure repo is absolute or relative to parent
case "$repo" in
./*|../*)
@@ -942,6 +948,7 @@ cmd_summary() {
fi
cd_to_toplevel
+ eval "set $(git rev-parse --sq --filename-prefix "$wt_prefix" -- "$@")"
# Get modified modules cared by user
modules=$(git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- "$@" |
sane_egrep '^:([0-7]* )?160000' |
--
1.8.2.694.ga76e9c3.dirty
next prev parent reply other threads:[~2013-04-08 6:45 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-07 19:55 [RFC/PATCH 0/2] submodule: drop the top-level requirement John Keeping
2013-04-07 19:55 ` [PATCH 1/2] rev-parse: add --filename-prefix option John Keeping
2013-04-07 22:14 ` Jonathan Nieder
2013-04-08 8:31 ` John Keeping
2013-04-08 15:07 ` Junio C Hamano
2013-04-08 17:36 ` John Keeping
2013-04-08 18:11 ` Junio C Hamano
2013-04-07 19:55 ` John Keeping [this message]
2013-04-07 20:15 ` [RFC/PATCH 0/2] submodule: drop the top-level requirement Jens Lehmann
2013-04-09 20:29 ` [PATCH v2 " John Keeping
2013-04-09 20:29 ` [PATCH v2 1/2] rev-parse: add --filename-prefix option John Keeping
2013-04-09 20:57 ` Junio C Hamano
2013-04-09 21:28 ` John Keeping
2013-04-09 21:33 ` Junio C Hamano
2013-04-18 14:28 ` Ramkumar Ramachandra
2013-04-18 14:42 ` John Keeping
2013-04-09 20:29 ` [PATCH v2 2/2] submodule: drop the top-level requirement John Keeping
2013-04-09 21:00 ` Junio C Hamano
2013-04-09 21:29 ` John Keeping
2013-04-18 14:46 ` Ramkumar Ramachandra
2013-04-18 14:56 ` John Keeping
2013-04-18 19:50 ` [PATCH v3 0/2] " John Keeping
2013-04-18 19:50 ` [PATCH v3 1/2] rev-parse: add --prefix option John Keeping
2013-04-19 9:53 ` Ramkumar Ramachandra
2013-04-19 10:22 ` John Keeping
2013-04-19 11:15 ` Ramkumar Ramachandra
2013-04-19 11:25 ` John Keeping
2013-04-19 11:29 ` Ramkumar Ramachandra
2013-04-18 19:50 ` [PATCH v3 2/2] submodule: drop the top-level requirement John Keeping
2013-04-18 22:40 ` Junio C Hamano
2013-04-19 7:46 ` John Keeping
2013-04-19 16:45 ` Junio C Hamano
2013-04-19 19:23 ` Johannes Sixt
2013-04-19 21:03 ` Junio C Hamano
2013-04-24 8:15 ` [PATCH] submodule: fix quoting in relative_path() John Keeping
2013-04-24 16:21 ` Junio C Hamano
2013-04-24 16:28 ` John Keeping
2013-04-24 19:12 ` Johannes Sixt
2013-04-18 23:54 ` [PATCH v3 2/2] submodule: drop the top-level requirement Eric Sunshine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=da121bcc33e63b7f33318ef920e85a77bb304d44.1365364193.git.john@keeping.me.uk \
--to=john@keeping.me.uk \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=hvoigt@hvoigt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).