version 1.1.1.1, 2012/02/17 15:09:30
|
version 1.1.1.2, 2013/10/14 07:51:14
|
Line 6 sub check_git_state
|
Line 6 sub check_git_state
|
my($master_branch, $fatal_unless_clean, $check_patches_dir) = @_; |
my($master_branch, $fatal_unless_clean, $check_patches_dir) = @_; |
|
|
my($cur_branch) = check_git_status($fatal_unless_clean); |
my($cur_branch) = check_git_status($fatal_unless_clean); |
if ($cur_branch ne $master_branch) { | (my $branch = $cur_branch) =~ s{^patch/([^/]+)/[^/]+$}{$1}; # change patch/BRANCH/PATCH_NAME into BRANCH |
| if ($branch ne $master_branch) { |
print "The checkout is not on the $master_branch branch.\n"; |
print "The checkout is not on the $master_branch branch.\n"; |
exit 1 if $master_branch ne 'master'; |
exit 1 if $master_branch ne 'master'; |
print "Do you want me to continue with --branch=$cur_branch? [n] "; | print "Do you want me to continue with --branch=$branch? [n] "; |
$_ = <STDIN>; |
$_ = <STDIN>; |
exit 1 unless /^y/i; |
exit 1 unless /^y/i; |
$_[0] = $master_branch = $cur_branch; # Updates caller's $master_branch too. | $_[0] = $master_branch = $branch; # Updates caller's $master_branch too. |
} |
} |
|
|
if ($check_patches_dir && -d 'patches/.git') { |
if ($check_patches_dir && -d 'patches/.git') { |
($cur_branch) = check_git_status($fatal_unless_clean, 'patches'); | ($branch) = check_git_status($fatal_unless_clean, 'patches'); |
if ($cur_branch ne $master_branch) { | if ($branch ne $master_branch) { |
print "The *patches* checkout is on branch $cur_branch, not branch $master_branch.\n"; | print "The *patches* checkout is on branch $branch, not branch $master_branch.\n"; |
print "Do you want to change it to branch $master_branch? [n] "; |
print "Do you want to change it to branch $master_branch? [n] "; |
$_ = <STDIN>; |
$_ = <STDIN>; |
exit 1 unless /^y/i; |
exit 1 unless /^y/i; |
system "cd patches && git checkout '$master_branch'"; |
system "cd patches && git checkout '$master_branch'"; |
} |
} |
} |
} |
|
|
|
return $cur_branch; |
} |
} |
|
|
sub check_git_status |
sub check_git_status |