Commit 9504e955 authored by Robert Ricci's avatar Robert Ricci
Browse files

New option to gitmail: -C

In testmode, pretends the ref was just created.

Renamed old '-C' option '-c'
parent 53c3748f
......@@ -60,14 +60,15 @@ my $hide_trivial_merges = get_config("hidetrivialmerges",undef);
#
my %opt;
Getopt::Long::Configure("no_ignore_case");
if (!GetOptions(\%opt, 'd', 'h', 't', 'T=s', 'C=s', 'o=s@')
if (!GetOptions(\%opt, 'd', 'h', 't', 'T=s', 'c=s', 'C', 'o=s@')
|| @ARGV || $opt{h}) {
print STDERR "Usage: gitmail [-h|-d]\n";
print STDERR " -h this message\n";
print STDERR " -d enable debugging output and don't send mail\n";
print STDERR " -t test mode - operate on last 3 commits to master\n";
print STDERR " -T br like '-t', but use branch 'br' instead of master\n";
print STDERR " -C n in test mode, use the last n commits for testing \n";
print STDERR " -c n in test mode, use the last n commits for testing \n";
print STDERR " -C in test mode, pretend the ref was just created\n";
print STDERR " -o o=v give option o the value v (may be given multiple\n";
print STDERR " times)\n";
exit 1;
......@@ -75,10 +76,12 @@ if (!GetOptions(\%opt, 'd', 'h', 't', 'T=s', 'C=s', 'o=s@')
my $testbranch = "master";
my $testcommits = 3;
my $testcreate = 0;
if ($opt{d}) { $debug = 1; }
if ($opt{t}) { $testmode = 1; }
if ($opt{T}) { $testmode = 1; $testbranch = $opt{T} }
if ($opt{C}) { $testcommits = $opt{C} }
if ($opt{c}) { $testcommits = $opt{c} }
if ($opt{C}) { $testcreate = 1; }
#
# Name of this repository - set it to a string to get it included in the
......@@ -362,10 +365,17 @@ if ($testmode) {
my $newrev = `$GIT rev-parse $fullref $STDERRNULL`;
chomp $newrev;
my $oldrev;
if ($testcreate) {
$oldrev = $EMPTYREV;
} else {
$oldrev = "$newrev~'$testcommits'";
}
#
# Provide a simple way to grab some commits - the three most recent ones
# Provide a simple way to grab some commits
#
@reflines = ("$newrev~'$testcommits' $newrev $fullref");
@reflines = ("$oldrev $newrev $fullref");
} else {
#
# Get all of the references that are being pushed from stdin - we do this in
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment