From: Wayne Davison Date: Sat, 19 Mar 2011 23:29:47 +0000 (-0700) Subject: Make it possible to create a new patch file while on a patch branch. X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/016ce7156881c1ea292ff115e5a0cc26e05b2ced Make it possible to create a new patch file while on a patch branch. --- diff --git a/packaging/git-status.pl b/packaging/git-status.pl index 295018c9..32cd437d 100644 --- a/packaging/git-status.pl +++ b/packaging/git-status.pl @@ -6,25 +6,28 @@ sub check_git_state my($master_branch, $fatal_unless_clean, $check_patches_dir) = @_; 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"; 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] "; $_ = ; 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') { - ($cur_branch) = check_git_status($fatal_unless_clean, 'patches'); - if ($cur_branch ne $master_branch) { - print "The *patches* checkout is on branch $cur_branch, not branch $master_branch.\n"; + ($branch) = check_git_status($fatal_unless_clean, 'patches'); + if ($branch ne $master_branch) { + 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] "; $_ = ; exit 1 unless /^y/i; system "cd patches && git checkout '$master_branch'"; } } + + return $cur_branch; } sub check_git_status diff --git a/packaging/patch-update b/packaging/patch-update index dba8e472..4ac01ebe 100755 --- a/packaging/patch-update +++ b/packaging/patch-update @@ -32,7 +32,7 @@ die "No '$patches_dir' directory was found.\n" unless -d $patches_dir; die "No '.git' directory present in the current dir.\n" unless -d '.git'; require 'packaging/git-status.pl'; -check_git_state($master_branch, !$skip_branch_check, 1); +my $starting_branch = check_git_state($master_branch, !$skip_branch_check, 1); my $master_commit; open PIPE, '-|', "git log -1 --no-color $master_branch" or die $!; @@ -124,7 +124,7 @@ if ($incl_generated_files) { } sleep 1 while $last_touch >= time; -system "git checkout $master_branch" and exit 1; +system "git checkout $starting_branch" and exit 1; exit;