* [PATCH] submodule update: when using recursion, show full path
@ 2013-02-22 4:25 Will Entriken
2013-02-22 19:17 ` Jens Lehmann
0 siblings, 1 reply; 5+ messages in thread
From: Will Entriken @ 2013-02-22 4:25 UTC (permalink / raw)
To: git; +Cc: Phil Hord, Jens Lehmann, Stefan Zager
>From d3fe2c76e6fa53e4cfa6f81600685c21bdadd4e3 Mon Sep 17 00:00:00 2001
From: William Entriken <github.com@phor.net>
Date: Thu, 21 Feb 2013 23:10:07 -0500
Subject: [PATCH] submodule update: when using recursion, show full path
Previously when using update with recursion, only the path for the
inner-most module was printed. Now the path is printed from GIT_DIR.
This now matches the behavior of submodule foreach
---
First patch. Several tests failed, but they were failing before I
started. This is against maint, I would consider this a (low priority)
bug.
How does it look? Please let me know next steps.
Signed-off-by: William Entriken <github.com@phor.net>
git-submodule.sh | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 2365149..f2c53c9 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -588,7 +588,7 @@ cmd_update()
die_if_unmatched "$mode"
if test "$stage" = U
then
- echo >&2 "Skipping unmerged submodule $sm_path"
+ echo >&2 "Skipping unmerged submodule $prefix$sm_path"
continue
fi
name=$(module_name "$sm_path") || exit
@@ -602,7 +602,7 @@ cmd_update()
if test "$update_module" = "none"
then
- echo "Skipping submodule '$sm_path'"
+ echo "Skipping submodule '$prefix$sm_path'"
continue
fi
@@ -611,7 +611,7 @@ cmd_update()
# Only mention uninitialized submodules when its
# path have been specified
test "$#" != "0" &&
- say "$(eval_gettext "Submodule path '\$sm_path' not initialized
+ say "$(eval_gettext "Submodule path '\$prefix\$sm_path' not initialized
Maybe you want to use 'update --init'?")"
continue
fi
@@ -624,7 +624,7 @@ Maybe you want to use 'update --init'?")"
else
subsha1=$(clear_local_git_env; cd "$sm_path" &&
git rev-parse --verify HEAD) ||
- die "$(eval_gettext "Unable to find current revision in submodule
path '\$sm_path'")"
+ die "$(eval_gettext "Unable to find current revision in submodule
path '\$prefix\$sm_path'")"
fi
if test "$subsha1" != "$sha1" -o -n "$force"
@@ -643,7 +643,7 @@ Maybe you want to use 'update --init'?")"
(clear_local_git_env; cd "$sm_path" &&
( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
test -z "$rev") || git-fetch)) ||
- die "$(eval_gettext "Unable to fetch in submodule path '\$sm_path'")"
+ die "$(eval_gettext "Unable to fetch in submodule path '\$prefix\$sm_path'")"
fi
# Is this something we just cloned?
@@ -657,20 +657,20 @@ Maybe you want to use 'update --init'?")"
case "$update_module" in
rebase)
command="git rebase"
- die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path
'\$sm_path'")"
- say_msg="$(eval_gettext "Submodule path '\$sm_path': rebased into '\$sha1'")"
+ die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path
'\$prefix\$sm_path'")"
+ say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': rebased
into '\$sha1'")"
must_die_on_failure=yes
;;
merge)
command="git merge"
- die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path
'\$sm_path'")"
- say_msg="$(eval_gettext "Submodule path '\$sm_path': merged in '\$sha1'")"
+ die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path
'\$prefix\$sm_path'")"
+ say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': merged
in '\$sha1'")"
must_die_on_failure=yes
;;
*)
command="git checkout $subforce -q"
- die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule
path '\$sm_path'")"
- say_msg="$(eval_gettext "Submodule path '\$sm_path': checked out '\$sha1'")"
+ die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule
path '\$prefix\$sm_path'")"
+ say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': checked
out '\$sha1'")"
;;
esac
@@ -688,11 +688,16 @@ Maybe you want to use 'update --init'?")"
if test -n "$recursive"
then
- (clear_local_git_env; cd "$sm_path" && eval cmd_update "$orig_flags")
+ (
+ prefix="$prefix$sm_path/"
+ clear_local_git_env
+ cd "$sm_path" &&
+ eval cmd_update "$orig_flags"
+ )
res=$?
if test $res -gt 0
then
- die_msg="$(eval_gettext "Failed to recurse into submodule path '\$sm_path'")"
+ die_msg="$(eval_gettext "Failed to recurse into submodule path
'\$prefix\$sm_path'")"
if test $res -eq 1
then
err="${err};$die_msg"
--
1.7.11.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] submodule update: when using recursion, show full path
2013-02-22 4:25 [PATCH] submodule update: when using recursion, show full path Will Entriken
@ 2013-02-22 19:17 ` Jens Lehmann
2013-03-02 19:44 ` William Entriken
0 siblings, 1 reply; 5+ messages in thread
From: Jens Lehmann @ 2013-02-22 19:17 UTC (permalink / raw)
To: Will Entriken; +Cc: git, Phil Hord, Stefan Zager
Thanks. Your code changes are looking good and the commit message
explains what you did and why you did it. A few comments below.
Am 22.02.2013 05:25, schrieb Will Entriken:
>>From d3fe2c76e6fa53e4cfa6f81600685c21bdadd4e3 Mon Sep 17 00:00:00 2001
> From: William Entriken <github.com@phor.net>
> Date: Thu, 21 Feb 2013 23:10:07 -0500
>
> Subject: [PATCH] submodule update: when using recursion, show full path
The lines above aren't necessary as they are taken from the mail header.
> Previously when using update with recursion, only the path for the
> inner-most module was printed. Now the path is printed from GIT_DIR.
You should replace "from GIT_DIR" with something like "relative to the
directory the recursion started in" here.
> This now matches the behavior of submodule foreach
Please add a '.' at the end of the sentence.
> ---
>
> First patch. Several tests failed, but they were failing before I
> started. This is against maint, I would consider this a (low priority)
> bug.
Strange that you have failing tests, for me everything runs fine (With
or without your patch). But I agree that this is a low priority bug.
> How does it look? Please let me know next steps.
This patch does not apply due to removed leading whitespaces and a
few wrapped lines. Please see Documentation/git-format-patch.txt on
how to convince the mailer of your choice to send the patch out
unmangled.
> Signed-off-by: William Entriken <github.com@phor.net>
The Signed-off-by belongs just before the "---" line above, as
everything between "---" and the line below won't make it into the
commit message.
> git-submodule.sh | 31 ++++++++++++++++++-------------
> 1 file changed, 18 insertions(+), 13 deletions(-)
>
> diff --git a/git-submodule.sh b/git-submodule.sh
> index 2365149..f2c53c9 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -588,7 +588,7 @@ cmd_update()
> die_if_unmatched "$mode"
> if test "$stage" = U
> then
> - echo >&2 "Skipping unmerged submodule $sm_path"
> + echo >&2 "Skipping unmerged submodule $prefix$sm_path"
> continue
> fi
> name=$(module_name "$sm_path") || exit
> @@ -602,7 +602,7 @@ cmd_update()
>
> if test "$update_module" = "none"
> then
> - echo "Skipping submodule '$sm_path'"
> + echo "Skipping submodule '$prefix$sm_path'"
> continue
> fi
>
> @@ -611,7 +611,7 @@ cmd_update()
> # Only mention uninitialized submodules when its
> # path have been specified
> test "$#" != "0" &&
> - say "$(eval_gettext "Submodule path '\$sm_path' not initialized
> + say "$(eval_gettext "Submodule path '\$prefix\$sm_path' not initialized
> Maybe you want to use 'update --init'?")"
> continue
> fi
> @@ -624,7 +624,7 @@ Maybe you want to use 'update --init'?")"
> else
> subsha1=$(clear_local_git_env; cd "$sm_path" &&
> git rev-parse --verify HEAD) ||
> - die "$(eval_gettext "Unable to find current revision in submodule
> path '\$sm_path'")"
> + die "$(eval_gettext "Unable to find current revision in submodule
> path '\$prefix\$sm_path'")"
> fi
>
> if test "$subsha1" != "$sha1" -o -n "$force"
> @@ -643,7 +643,7 @@ Maybe you want to use 'update --init'?")"
> (clear_local_git_env; cd "$sm_path" &&
> ( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
> test -z "$rev") || git-fetch)) ||
> - die "$(eval_gettext "Unable to fetch in submodule path '\$sm_path'")"
> + die "$(eval_gettext "Unable to fetch in submodule path '\$prefix\$sm_path'")"
> fi
>
> # Is this something we just cloned?
> @@ -657,20 +657,20 @@ Maybe you want to use 'update --init'?")"
> case "$update_module" in
> rebase)
> command="git rebase"
> - die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path
> '\$sm_path'")"
> - say_msg="$(eval_gettext "Submodule path '\$sm_path': rebased into '\$sha1'")"
> + die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path
> '\$prefix\$sm_path'")"
> + say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': rebased
> into '\$sha1'")"
> must_die_on_failure=yes
> ;;
> merge)
> command="git merge"
> - die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path
> '\$sm_path'")"
> - say_msg="$(eval_gettext "Submodule path '\$sm_path': merged in '\$sha1'")"
> + die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path
> '\$prefix\$sm_path'")"
> + say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': merged
> in '\$sha1'")"
> must_die_on_failure=yes
> ;;
> *)
> command="git checkout $subforce -q"
> - die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule
> path '\$sm_path'")"
> - say_msg="$(eval_gettext "Submodule path '\$sm_path': checked out '\$sha1'")"
> + die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule
> path '\$prefix\$sm_path'")"
> + say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': checked
> out '\$sha1'")"
> ;;
> esac
>
> @@ -688,11 +688,16 @@ Maybe you want to use 'update --init'?")"
>
> if test -n "$recursive"
> then
> - (clear_local_git_env; cd "$sm_path" && eval cmd_update "$orig_flags")
> + (
> + prefix="$prefix$sm_path/"
> + clear_local_git_env
> + cd "$sm_path" &&
> + eval cmd_update "$orig_flags"
> + )
> res=$?
> if test $res -gt 0
> then
> - die_msg="$(eval_gettext "Failed to recurse into submodule path '\$sm_path'")"
> + die_msg="$(eval_gettext "Failed to recurse into submodule path
> '\$prefix\$sm_path'")"
> if test $res -eq 1
> then
> err="${err};$die_msg"
> --
> 1.7.11.3
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] submodule update: when using recursion, show full path
2013-02-22 19:17 ` Jens Lehmann
@ 2013-03-02 19:44 ` William Entriken
2013-03-04 0:06 ` Jens Lehmann
0 siblings, 1 reply; 5+ messages in thread
From: William Entriken @ 2013-03-02 19:44 UTC (permalink / raw)
To: git, Phil Hord, Jens Lehmann, Stefan Zager; +Cc: William Entriken
Previously when using update with recursion, only the path for the
inner-most module was printed. Now the path is printed relative to
the directory the command was started from. This now matches the
behavior of submodule foreach.
Signed-off-by: William Entriken <github.com@phor.net>
---
git-submodule.sh | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 2365149..f2c53c9 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -588,7 +588,7 @@ cmd_update()
die_if_unmatched "$mode"
if test "$stage" = U
then
- echo >&2 "Skipping unmerged submodule $sm_path"
+ echo >&2 "Skipping unmerged submodule $prefix$sm_path"
continue
fi
name=$(module_name "$sm_path") || exit
@@ -602,7 +602,7 @@ cmd_update()
if test "$update_module" = "none"
then
- echo "Skipping submodule '$sm_path'"
+ echo "Skipping submodule '$prefix$sm_path'"
continue
fi
@@ -611,7 +611,7 @@ cmd_update()
# Only mention uninitialized submodules when its
# path have been specified
test "$#" != "0" &&
- say "$(eval_gettext "Submodule path '\$sm_path' not initialized
+ say "$(eval_gettext "Submodule path '\$prefix\$sm_path' not initialized
Maybe you want to use 'update --init'?")"
continue
fi
@@ -624,7 +624,7 @@ Maybe you want to use 'update --init'?")"
else
subsha1=$(clear_local_git_env; cd "$sm_path" &&
git rev-parse --verify HEAD) ||
- die "$(eval_gettext "Unable to find current revision in submodule path '\$sm_path'")"
+ die "$(eval_gettext "Unable to find current revision in submodule path '\$prefix\$sm_path'")"
fi
if test "$subsha1" != "$sha1" -o -n "$force"
@@ -643,7 +643,7 @@ Maybe you want to use 'update --init'?")"
(clear_local_git_env; cd "$sm_path" &&
( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
test -z "$rev") || git-fetch)) ||
- die "$(eval_gettext "Unable to fetch in submodule path '\$sm_path'")"
+ die "$(eval_gettext "Unable to fetch in submodule path '\$prefix\$sm_path'")"
fi
# Is this something we just cloned?
@@ -657,20 +657,20 @@ Maybe you want to use 'update --init'?")"
case "$update_module" in
rebase)
command="git rebase"
- die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$sm_path'")"
- say_msg="$(eval_gettext "Submodule path '\$sm_path': rebased into '\$sha1'")"
+ die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$prefix\$sm_path'")"
+ say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': rebased into '\$sha1'")"
must_die_on_failure=yes
;;
merge)
command="git merge"
- die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$sm_path'")"
- say_msg="$(eval_gettext "Submodule path '\$sm_path': merged in '\$sha1'")"
+ die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$prefix\$sm_path'")"
+ say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': merged in '\$sha1'")"
must_die_on_failure=yes
;;
*)
command="git checkout $subforce -q"
- die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$sm_path'")"
- say_msg="$(eval_gettext "Submodule path '\$sm_path': checked out '\$sha1'")"
+ die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$prefix\$sm_path'")"
+ say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': checked out '\$sha1'")"
;;
esac
@@ -688,11 +688,16 @@ Maybe you want to use 'update --init'?")"
if test -n "$recursive"
then
- (clear_local_git_env; cd "$sm_path" && eval cmd_update "$orig_flags")
+ (
+ prefix="$prefix$sm_path/"
+ clear_local_git_env
+ cd "$sm_path" &&
+ eval cmd_update "$orig_flags"
+ )
res=$?
if test $res -gt 0
then
- die_msg="$(eval_gettext "Failed to recurse into submodule path '\$sm_path'")"
+ die_msg="$(eval_gettext "Failed to recurse into submodule path '\$prefix\$sm_path'")"
if test $res -eq 1
then
err="${err};$die_msg"
--
1.7.12.4 (Apple Git-37)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] submodule update: when using recursion, show full path
2013-03-02 19:44 ` William Entriken
@ 2013-03-04 0:06 ` Jens Lehmann
2013-03-04 3:48 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Jens Lehmann @ 2013-03-04 0:06 UTC (permalink / raw)
To: William Entriken
Cc: git, Phil Hord, Stefan Zager, William Entriken, Junio C Hamano
Am 02.03.2013 20:44, schrieb William Entriken:
> Previously when using update with recursion, only the path for the
> inner-most module was printed. Now the path is printed relative to
> the directory the command was started from. This now matches the
> behavior of submodule foreach.
>
> Signed-off-by: William Entriken <github.com@phor.net>
Thanks, this patch cleanly applies against maint and addresses all
issues from the previous rounds.
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Junio, could you please squash in this additional test?
--------8<-------
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index feaec6c..70528b7 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -612,7 +612,8 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re
rm -rf super_update_r2 &&
git clone super_update_r super_update_r2 &&
(cd super_update_r2 &&
- git submodule update --init --recursive &&
+ git submodule update --init --recursive >actual &&
+ test_i18ngrep "Submodule path .submodule/subsubmodule.: checked out" actual &&
(cd submodule/subsubmodule &&
git log > ../../expected
) &&
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] submodule update: when using recursion, show full path
2013-03-04 0:06 ` Jens Lehmann
@ 2013-03-04 3:48 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2013-03-04 3:48 UTC (permalink / raw)
To: Jens Lehmann
Cc: William Entriken, git, Phil Hord, Stefan Zager, William Entriken
Jens Lehmann <Jens.Lehmann@web.de> writes:
> Am 02.03.2013 20:44, schrieb William Entriken:
>> Previously when using update with recursion, only the path for the
>> inner-most module was printed. Now the path is printed relative to
>> the directory the command was started from. This now matches the
>> behavior of submodule foreach.
>>
>> Signed-off-by: William Entriken <github.com@phor.net>
>
> Thanks, this patch cleanly applies against maint and addresses all
> issues from the previous rounds.
>
> Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
>
> Junio, could you please squash in this additional test?
Thanks.
I wish all areas of Git had competent and diligent area maintainers
like you. Makes it a lot easier for me _not_ to keep track of ;-).
>
> --------8<-------
> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
> index feaec6c..70528b7 100755
> --- a/t/t7406-submodule-update.sh
> +++ b/t/t7406-submodule-update.sh
> @@ -612,7 +612,8 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re
> rm -rf super_update_r2 &&
> git clone super_update_r super_update_r2 &&
> (cd super_update_r2 &&
> - git submodule update --init --recursive &&
> + git submodule update --init --recursive >actual &&
> + test_i18ngrep "Submodule path .submodule/subsubmodule.: checked out" actual &&
> (cd submodule/subsubmodule &&
> git log > ../../expected
> ) &&
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-03-04 3:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-22 4:25 [PATCH] submodule update: when using recursion, show full path Will Entriken
2013-02-22 19:17 ` Jens Lehmann
2013-03-02 19:44 ` William Entriken
2013-03-04 0:06 ` Jens Lehmann
2013-03-04 3:48 ` Junio C Hamano
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).