Skip to content

v5.0.x: autogen.pl: fix submodule hash check #10808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions autogen.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1391,12 +1391,9 @@ sub replace_config_sub_guess {
open(IN, "git submodule status|")
|| die "Can't run \"git submodule status\"";
while (<IN>) {
chomp;
$_ =~ m/^(.)(.{40}) ([^ ]+) *\(*([^\(\)]*)\)*$/;
my $status = $1;
my $local_hash = $2;
my $path = $3;
my $extra = $4;
$_ =~ m/^(.)[0-9a-f]{40}\s+(\S+)/;
my $status = $1;
my $path = $2;

print("=== Submodule: $path\n");
if (index($path, "pmix") != -1 and list_contains("pmix", @disabled_3rdparty_packages)) {
Expand All @@ -1419,19 +1416,14 @@ sub replace_config_sub_guess {
exit(1);
}

# See if the submodule is at the expected git hash
# (it may be ok if it's not -- just warn the user)
$extra =~ m/-g(.+)/;
my $remote_hash = $1;
if ($remote_hash) {
my $abbrev_local_hash = substr($local_hash, 0, length($remote_hash));
if ($remote_hash ne $abbrev_local_hash) {
# See if the commit in the submodule is not the same as the
# commit that the git submodule thinks it should be.
elsif ($status eq "+") {
print(" ==> WARNING: Submodule hash is different than upstream.
If this is not intentional, you may want to run:
\"git submodule update --init --recursive\"\n");
} else {
print(" Local hash == remote hash (good!)\n");
}
} else {
print(" Local hash is what is expected by the submodule (good!)\n");
}
}
}
Expand Down