diff options
Diffstat (limited to 'pre-receive')
| -rwxr-xr-x | pre-receive | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/pre-receive b/pre-receive index 6dd2205..52303ab 100755 --- a/pre-receive +++ b/pre-receive @@ -5,6 +5,7 @@ # 20261123 bkw: initial version. may still need work. # 20261123 bkw: added colors and -o mono, add test env instructions. +# 20261124 bkw: this is in git now, see sbo-maintainer-tools log for changes. ########################################################################### @@ -81,9 +82,10 @@ $skip = 0; # Disable colors with -o mono $color_output = 1; -# Default branch is usually 'master'. It is for SBo, anyway. Still, -# query repo for this instead of hardcoding (see set_default_branch()). -$default_branch = undef; +# Default branch is 'master' for SBo, despite newer releases of git +# chaning the dedault to 'main' for newly-created repos. We aren't +# going to change our existing (for 15+ years) repo. +$default_branch = 'master'; ### @@ -176,9 +178,9 @@ sub check_message { my %cats; sub init_cats { - open(my $gitpipe, - "-|", "git", "ls-tree", "-d", "--name-only", $default_branch) - or fatal($!); + my @cmd = ("git", "ls-tree", "-d", "--name-only", $default_branch); + debug("executing " . join(" ", @cmd)); + open(my $gitpipe, "-|", @cmd) or fatal($!); while(my $l=<$gitpipe>) { next if $l =~ /^\./; # skip .forgejo and .github dirs @@ -238,21 +240,6 @@ sub read_push_options { } } -sub set_default_branch { -## chomp ($default_branch = `git config get init.defaultBranch`); -## if(!length($default_branch)) { -## # This seems to happen with repos that were cloned a long -## # time ago, I guess because the init.defaultBranch setting -## # didn't exist yet in old versions of git? -## debug("got empty result from " . -## "'git config get init.defaultBranch', " . -## "assuming 'master'"); -## $default_branch = "master"; -## } -## debug("default branch is '$default_branch'"); - $default_branch = 'master'; # for testing -} - sub init_colors { # Good old ANSI colors. Really should be using 'tput' or something # to get these, but I don't think anyone's still using anything @@ -286,7 +273,6 @@ sub green { init_colors(); read_push_options(); -set_default_branch(); if($help) { print_opt_help(); |
