From: Junio C Hamano <gitster@pobox.com>
To: "Spencer E. Olson" <olsonse@umich.edu>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2 (v2)] submodule: no [--merge|--rebase] when newly cloned
Date: Thu, 17 Feb 2011 12:02:13 -0800 [thread overview]
Message-ID: <7vbp2abfay.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 1297959526-8089-1-git-send-email-olsonse@umich.edu
"Spencer E. Olson" <olsonse@umich.edu> writes:
> @@ -469,6 +484,12 @@ cmd_update()
> die "Unable to fetch in submodule path '$path'"
> fi
>
> + list_contains "$name" "$cloned_modules"
> + if test "$?" = 0
> + then
> + update_module=
> + fi
> +
It would be a lot easier to read if you said this:
if list_contains "$name" "$cloned_modules"
then
update_module=
fi
or just open code the idiom:
case ";list-of-stuff-with-delimiter;" in
*";i-want-to-see-this;"*) : happy ;;
esac
without introducing "list_contains" that is called only once.
But otherwise the patch looks good.
Thanks.
-- >8 --
From: Spencer E. Olson <olsonse@umich.edu>
Date: Thu, 17 Feb 2011 09:18:45 -0700
Subject: [PATCH] submodule: no [--merge|--rebase] when newly cloned
Previously, when a new submodule is cloned by running "git submodule update
[--merge|--rebase]", the newly cloned submodule does not get checked out and a
rebase or merge is incorrectly attempted against an empty working directory.
This patch ignores --rebase or --merge for new submodules and instead simply
checks out the appropriate revision.
Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
git-submodule.sh | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 8b90589..5e989b7 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -423,6 +423,7 @@ cmd_update()
cmd_init "--" "$@" || return
fi
+ cloned_modules=
module_list "$@" |
while read mode sha1 stage path
do
@@ -442,6 +443,7 @@ cmd_update()
if ! test -d "$path"/.git -o -f "$path"/.git
then
module_clone "$path" "$url" "$reference"|| exit
+ cloned_modules="$cloned_modules;$name"
subsha1=
else
subsha1=$(clear_local_git_env; cd "$path" &&
@@ -469,6 +471,13 @@ cmd_update()
die "Unable to fetch in submodule path '$path'"
fi
+ # Is this something we just cloned?
+ case ";$cloned_modules;" in
+ *";$name;"*)
+ # then there is no local change to integrate
+ update_module= ;;
+ esac
+
case "$update_module" in
rebase)
command="git rebase"
--
1.7.4.1.107.ga7184
prev parent reply other threads:[~2011-02-17 20:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-17 16:18 [PATCH 1/2 (v2)] submodule: no [--merge|--rebase] when newly cloned Spencer E. Olson
2011-02-17 16:18 ` [PATCH 2/2 (v2)] t7406: "git submodule update {--merge|--rebase]" with new submodules Spencer E. Olson
2011-02-17 19:43 ` Jens Lehmann
2011-02-17 20:18 ` Junio C Hamano
2011-02-17 21:39 ` Jens Lehmann
2011-02-17 19:41 ` [PATCH 1/2 (v2)] submodule: no [--merge|--rebase] when newly cloned Jens Lehmann
2011-02-17 20:25 ` Junio C Hamano
2011-02-17 22:17 ` Spencer E. Olson
2011-02-17 23:37 ` Junio C Hamano
2011-02-17 23:50 ` Spencer E. Olson
2011-02-17 20:02 ` Junio C Hamano [this message]
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=7vbp2abfay.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=olsonse@umich.edu \
/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).