Fixed finding of parent's description when @ARGV doesn't mention it.
authorWayne Davison <wayned@samba.org>
Mon, 4 Feb 2008 08:12:01 +0000 (00:12 -0800)
committerWayne Davison <wayned@samba.org>
Mon, 4 Feb 2008 08:12:01 +0000 (00:12 -0800)
support/patch-update

index 502380df19d71ad0f3e88b39d5c3116ad18f1eb3..a76f111d857f8fcbaf146458105f7b218cbd4a37 100755 (executable)
@@ -56,16 +56,9 @@ if ($incl_generated_files) {
 my $last_touch = time;
 
 my(@patches, %local_patch);
-if (@ARGV) {
-    foreach (@ARGV) {
-       s{^(patches|patch|origin/patch)/} {};
-       s{\.diff$} {};
-       push(@patches, $_);
-    }
-    open(PIPE, '-|', 'git', 'branch', '-l') or die $!;
-} else {
-    open(PIPE, '-|', 'git', 'branch', '-a') or die $!;
-}
+
+# Start by finding all patches so that we can load all possible parents.
+open(PIPE, '-|', 'git', 'branch', '-a') or die $!;
 while (<PIPE>) {
     if (m# origin/patch/(.*)#) {
        push(@patches, $1);
@@ -93,6 +86,16 @@ foreach my $patch (@patches) {
     $description{$patch} = $desc;
 }
 
+if (@ARGV) {
+    # Limit the list of patches to actually process based on @ARGV.
+    @patches = ( );
+    foreach (@ARGV) {
+       s{^(patches|patch|origin/patch)/} {};
+       s{\.diff$} {};
+       push(@patches, $_);
+    }
+}
+
 my %completed;
 foreach my $patch (@patches) {
     next if $completed{$patch}++;