Skip to content

Commit f9fc72a

Browse files
committed
autogen.pl: fix submodule hash check
Update the git submodule check to just look at the first character in each line of "git submodule status" output: * If it's "-", then the submodule is missing (this check was already there) * If it's "+", then the locally-checked out hash is different than what is expected by the submodule, so emit a warning (this check was there, but was incorrect) Signed-off-by: Jeff Squyres <[email protected]>
1 parent b44e927 commit f9fc72a

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

autogen.pl

+8-16
Original file line numberDiff line numberDiff line change
@@ -1409,12 +1409,9 @@ sub replace_config_sub_guess {
14091409
open(IN, "git submodule status|")
14101410
|| die "Can't run \"git submodule status\"";
14111411
while (<IN>) {
1412-
chomp;
1413-
$_ =~ m/^(.)(.{40}) ([^ ]+) *\(*([^\(\)]*)\)*$/;
1414-
my $status = $1;
1415-
my $local_hash = $2;
1416-
my $path = $3;
1417-
my $extra = $4;
1412+
$_ =~ m/^(.).{40} ([^ ]+) /;
1413+
my $status = $1;
1414+
my $path = $2;
14181415

14191416
print("=== Submodule: $path\n");
14201417
if (index($path, "pmix") != -1 and list_contains("pmix", @disabled_3rdparty_packages)) {
@@ -1437,19 +1434,14 @@ sub replace_config_sub_guess {
14371434
exit(1);
14381435
}
14391436

1440-
# See if the submodule is at the expected git hash
1441-
# (it may be ok if it's not -- just warn the user)
1442-
$extra =~ m/-g(.+)/;
1443-
my $remote_hash = $1;
1444-
if ($remote_hash) {
1445-
my $abbrev_local_hash = substr($local_hash, 0, length($remote_hash));
1446-
if ($remote_hash ne $abbrev_local_hash) {
1437+
# See if the commit in the submodule is not the same as the
1438+
# commit that the git submodule thinks it should be.
1439+
elsif ($status eq "+") {
14471440
print(" ==> WARNING: Submodule hash is different than upstream.
14481441
If this is not intentional, you may want to run:
14491442
\"git submodule update --init --recursive\"\n");
1450-
} else {
1451-
print(" Local hash == remote hash (good!)\n");
1452-
}
1443+
} else {
1444+
print(" Local hash is what is expected by the submodule (good!)\n");
14531445
}
14541446
}
14551447
}

0 commit comments

Comments
 (0)