File 0001-fix-inappropriate-REPO-substitution.patch of Package gitslave

From 0fc40b1e57f00acddd64ed88e44d28206f3682d6 Mon Sep 17 00:00:00 2001
From: Alexander Dupuy <adupuy@trustedcs.com>
Date: Wed, 25 Jan 2012 22:14:27 -0500
Subject: [PATCH] fix inappropriate %REPO% substitution

there are still some cases where this may occur, but they should be limited
to cases where the repository name appears on its own, surrounded by
whitespace or quotes or a leading /
---
 BugsTodo       | 10 ----------
 gits           | 10 ++++++----
 prep_gitscheck |  3 +++
 3 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/BugsTodo b/BugsTodo
index d5e05d3..d50e309 100644
--- a/BugsTodo
+++ b/BugsTodo
@@ -1,13 +1,3 @@
-* Inappropriate output substitution
-
-I had a superproject name foo with folders.  Inside the folders were
-files which started with the project name (bar/foo.h baz/foo-biff.spec
-etc) When performing a `gits pull` the resulting changes had %REPO%
-substitutions performed on them so that I actually saw (bar/%REPO%.h
-and baz/%REPO%-biff.spec) incorrect filenames which screwed with the
-ASCII formatting.
-
-
 * Windows
 
 Gits purportedly works with strawberry-perl and msysgit's perl on
diff --git a/gits b/gits
index 9088fd8..005e212 100755
--- a/gits
+++ b/gits
@@ -2031,10 +2031,11 @@ elsif ($ARGV[0] eq 'pulls')
 	chomp $mod;
 	$mod =~ s=.*/==;
       }
-      $msg =~ s/\b$mod\b/%REPO%/g;
+      $msg =~ s#(?:\A|[/'"\s])\K$mod(?=(?:[/\s'"]|\z))#%REPO%#g;
       my $submod = $mod;
       $submod =~ s=.*/==;
-      $msg =~ s/\b$submod\b/%REPO%/g if ($mod ne $submod);
+      $msg =~ s#(?:\A|[/'"\s])\K$submod(?=(?:[/\s'"]|\z))#%REPO%#g
+	if ($mod ne $submod);
       # remove hash ids in various places to collapse redundant messages
       if (!$OPTIONS{'no-hide'})
       {
@@ -2140,10 +2141,11 @@ elsif ($ARGV[0] eq 'pull' || $ARGV[0] eq 'fetch')
       chomp $mod;
       $mod =~ s=.*/==;
     }
-    $msg =~ s/\b$mod\b/%REPO%/g;
+    $msg =~ s#(?:\A|[/'"\s])\K$mod(?=(?:[/\s'"]|\z))#%REPO%#g;
     my $submod = $mod;
     $submod =~ s=.*/==;
-    $msg =~ s/\b$submod\b/%REPO%/g if ($mod ne $submod);
+    $msg =~ s#(?:\A|[/'"\s])\K$submod(?=(?:[/\s'"]|\z))#%REPO%#g
+      if ($mod ne $submod);
     # remove hash ids in various places to collapse redundant messages
     if (!$OPTIONS{'no-hide'})
     {
diff --git a/prep_gitscheck b/prep_gitscheck
index e0240cd..b4a33da 100755
--- a/prep_gitscheck
+++ b/prep_gitscheck
@@ -18,6 +18,7 @@ BASE=`pwd`
     git init
     date > datelist
     echo $f > packagename
+    echo > $f.h
     git add *
     git commit -a -m "Initial files"
     cd ../../master; git clone --bare --mirror ../masterprep/$f $f)
@@ -56,6 +57,8 @@ gits pull
 :  Make some mods and commit
 date >> datelist
 date >> sub1/datelist
+date >> top.h
+date >> sub1/sub1.h
 gits status
 gits commit -a -m "First stage updates"
 gits push
-- 
1.8.1.4

openSUSE Build Service is sponsored by