Skip to contentSkip to conversation

Make 'git submodule update --force' always check out submodules.

PATCH In review Stefan Zager 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make 'git submodule update --force' always check out submodules.

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.

---
 git-submodule.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-submodule.sh +1 -1
index dba4d39..621eff7 100755
@@ -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
Signature · 1 line
1.7.11.rc2
#1 lore raw
Quoted 8 lines · Stefan Zager

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.

---

Looks sensible (again -- see http://thread.gmane.org/gmane.comp.version-control.git/197532
for the original discussion). Can submodule folks Ack it?

Thanks.

Quoted 16 lines
 git-submodule.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-submodule.sh +1 -1
index dba4d39..621eff7 100755
@@ -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
#2 lore raw

Am 25.07.2012 20:44, schrieb Junio C Hamano:

Quoted 8 lines
Quoted 6 lines · Stefan Zager

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.

Quoted 5 lines
Quoted 2 lines

---

Looks sensible (again -- see http://thread.gmane.org/gmane.comp.version-control.git/197532
for the original discussion). Can submodule folks Ack it?

I like it. Still I'd vote for amending the documentation like the original thread proposed and would appreciate to have a test or two, but apart from that I have no objections.

Quoted 21 lines
Quoted 8 lines
 git-submodule.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-submodule.sh +0 -0
index dba4d39..621eff7 100755

git-submodule.sh Maybe you want to use 'update --init'?")" · line 581

Quoted 8 lines
git-submodule.sh +1 -1
@@ -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

--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 12 lines · Jens Lehmann

Am 25.07.2012 20:44, schrieb Junio C Hamano:

Quoted 11 lines
Quoted 8 lines · Stefan Zager

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.

---

Quoted 6 lines
Quoted 2 lines

Looks sensible (again -- see http://thread.gmane.org/gmane.comp.version-control.git/197532
for the original discussion). Can submodule folks Ack it?

I like it. Still I'd vote for amending the documentation like the original thread proposed and would appreciate to have a test or two, but apart from that I have no objections.

OK, then I'll queue this so that we won't forget about the topic for now, and docs and tests can be done as follow-up patches to the topic.

Thanks.

#4 lore raw
In reply to Jens Lehmann
Quoted 12 lines · Jens Lehmann

Am 25.07.2012 20:44, schrieb Junio C Hamano:

Quoted 11 lines
Quoted 8 lines · Stefan Zager

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.

---

Quoted 6 lines
Quoted 2 lines

Looks sensible (again -- see http://thread.gmane.org/gmane.comp.version-control.git/197532
for the original discussion). Can submodule folks Ack it?

I like it. Still I'd vote for amending the documentation like the original thread proposed and would appreciate to have a test or two, but apart from that I have no objections.

Mind ping on missing follow-ups.