Skip to content
Snippets Groups Projects
Commit 9c2dade9 authored by Joachim Breitner's avatar Joachim Breitner
Browse files

Fix branch name check regex in sync-all

parent 62008092
No related branches found
No related tags found
No related merge requests found
......@@ -163,14 +163,14 @@ sub getrepo {
my $git_dir = $bare_flag ? "ghc.git" : ".";
my $branch = &readgit($git_dir, "rev-parse", "--abbrev-ref", "HEAD");
die "Bad branch: $branch"
unless $branch =~ m!^[a-zA-Z][a-zA-Z0-9.-/]*$!;
unless $branch =~ m!^[a-zA-Z][a-zA-Z0-9./-]*$!;
my $remote = &readgit($git_dir, "config", "branch.$branch.remote");
if ($remote eq "") {
# remotes are not mandatory for branches (e.g. not recorded by default for bare repos)
$remote = "origin";
}
die "Bad remote: $remote"
unless $remote =~ m!^[a-zA-Z][a-zA-Z0-9.-/]*$!;
unless $remote =~ m!^[a-zA-Z][a-zA-Z0-9./-]*$!;
$repo = &readgit($git_dir, "config", "remote.$remote.url");
}
......@@ -541,7 +541,7 @@ sub gitall {
print (' ' x (40 - length($localpath)));
my $branch = &readgit($localpath, "rev-parse", "--abbrev-ref", "HEAD");
die "Bad branch: $branch"
unless $branch =~ m!^[a-zA-Z][a-zA-Z0-9.-/]*$!;
unless $branch =~ m!^[a-zA-Z][a-zA-Z0-9./-]*$!;
my $us = &readgit(".", "ls-remote", $localpath, "refs/heads/$branch");
my $them = &readgit(".", "ls-remote", $compareto, "refs/heads/$branch");
$us =~ s/[[:space:]].*//;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment