git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Zager <szager@google.com>
To: git@vger.kernel.org
Cc: Stefan Zager <szager@google.com>, gitster@pobox.com
Subject: [PATCH] Make 'git submodule update --force' always check out submodules.
Date: Wed, 25 Jul 2012 11:03:32 -0700	[thread overview]
Message-ID: <1343239412-26780-1-git-send-email-szager@google.com> (raw)

Currently, it will only do a checkout if the sha1 registered in the containing
repository doesn't match the HEAD of the submodule, regardless of whether the
submodule is dirty.  As discussed on the mailing list, the '--force' flag is a
strong indicator that the state of the submodule is suspect, and should be reset
to HEAD.

Signed-off-by: Stefan Zager <szager@google.com>
---
 git-submodule.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index dba4d39..621eff7 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -575,7 +575,7 @@ Maybe you want to use 'update --init'?")"
 			die "$(eval_gettext "Unable to find current revision in submodule path '\$sm_path'")"
 		fi
 
-		if test "$subsha1" != "$sha1"
+		if test "$subsha1" != "$sha1" -o -n "$force"
 		then
 			subforce=$force
 			# If we don't already have a -f flag and the submodule has never been checked out
-- 
1.7.11.rc2

             reply	other threads:[~2012-07-25 18:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 18:03 Stefan Zager [this message]
2012-07-25 18:44 ` [PATCH] Make 'git submodule update --force' always check out submodules Junio C Hamano
2012-07-25 20:51   ` Jens Lehmann
2012-07-25 22:09     ` Junio C Hamano
2012-08-17  3:23     ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2012-07-25 17:41 Stefan Zager
2012-08-23  1:43 ` Junio C Hamano
2012-08-23 18:51   ` Jens Lehmann

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=1343239412-26780-1-git-send-email-szager@google.com \
    --to=szager@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).