git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Allow passing of --directory to git-am.
@ 2008-12-04 18:48 Simon 'corecode' Schubert
  2008-12-04 18:51 ` Jeff King
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Simon 'corecode' Schubert @ 2008-12-04 18:48 UTC (permalink / raw)
  To: git

We need to play some shell tricks to be able to pass directory names
which contain spaces and/or quotes.

Signed-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
---

Boyd Stephen Smith Jr. wrote:
 > I'm thinking your sed line doesn't do what you think it does.  You 
probably
 > want something like:
 > bss@monster:~$ echo "don't" | sed -e "s/'/'\\\\''/g"
 > don'\''t

Thanks, I clearly did not test this well enough.

  git-am.sh |    8 +++++---
  1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index aa60261..3baff4e 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -16,6 +16,7 @@ s,signoff       add a Signed-off-by line to the commit 
message
  u,utf8          recode into utf8 (default)
  k,keep          pass -k flag to git-mailinfo
  whitespace=     pass it through git-apply
+directory=      pass it through git-apply
  C=              pass it through git-apply
  p=              pass it through git-apply
  resolvemsg=     override error message when patch failure occurs
@@ -155,8 +156,9 @@ do
  		;;
  	--resolvemsg)
  		shift; resolvemsg=$1 ;;
-	--whitespace)
-		git_apply_opt="$git_apply_opt $1=$2"; shift ;;
+	--whitespace|--directory)
+		quot=$(echo "$2" | sed -e "s/'/'\\\''/g")
+		git_apply_opt="$git_apply_opt $1='$quot'"; shift ;;
  	-C|-p)
  		git_apply_opt="$git_apply_opt $1$2"; shift ;;
  	--)
@@ -454,7 +456,7 @@ do

  	case "$resolved" in
  	'')
-		git apply $git_apply_opt --index "$dotest/patch"
+		eval git apply $git_apply_opt --index '"$dotest/patch"'
  		apply_status=$?
  		;;
  	t)
-- 
1.6.1.rc1.45.g123ed.dirty

^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [PATCH] Allow passing of --directory to git-am.
@ 2008-12-04 17:04 Simon 'corecode' Schubert
  2008-12-04 18:28 ` Boyd Stephen Smith Jr.
  0 siblings, 1 reply; 15+ messages in thread
From: Simon 'corecode' Schubert @ 2008-12-04 17:04 UTC (permalink / raw)
  To: git

We need to play some shell tricks to be able to pass directory names
which contain spaces and/or quotes.

Signed-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
---
  git-am.sh |    8 +++++---
  1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index aa60261..4052d7d 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -16,6 +16,7 @@ s,signoff       add a Signed-off-by line to the commit 
message
  u,utf8          recode into utf8 (default)
  k,keep          pass -k flag to git-mailinfo
  whitespace=     pass it through git-apply
+directory=      pass it through git-apply
  C=              pass it through git-apply
  p=              pass it through git-apply
  resolvemsg=     override error message when patch failure occurs
@@ -155,8 +156,9 @@ do
  		;;
  	--resolvemsg)
  		shift; resolvemsg=$1 ;;
-	--whitespace)
-		git_apply_opt="$git_apply_opt $1=$2"; shift ;;
+	--whitespace|--directory)
+		quot=$(echo "$2" | sed -e "s/'/\\'/g")
+		git_apply_opt="$git_apply_opt $1='$quot'"; shift ;;
  	-C|-p)
  		git_apply_opt="$git_apply_opt $1$2"; shift ;;
  	--)
@@ -454,7 +456,7 @@ do

  	case "$resolved" in
  	'')
-		git apply $git_apply_opt --index "$dotest/patch"
+		eval git apply $git_apply_opt --index '"$dotest/patch"'
  		apply_status=$?
  		;;
  	t)
-- 
1.6.1.rc1.45.g123ed.dirty

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-12-05  0:17 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-04 18:48 [PATCH] Allow passing of --directory to git-am Simon 'corecode' Schubert
2008-12-04 18:51 ` Jeff King
2008-12-04 19:27 ` Junio C Hamano
2008-12-04 22:26   ` Simon 'corecode' Schubert
2008-12-04 22:33     ` Junio C Hamano
2008-12-04 23:14       ` Junio C Hamano
2008-12-04 23:36         ` [PATCH - DONTUSE] git-am: propagate -C/-p as well Junio C Hamano
2008-12-04 23:41       ` [PATCH] Allow passing of --directory to git-am Simon 'corecode' Schubert
2008-12-05  0:11         ` Junio C Hamano
2008-12-05  0:16           ` Simon 'corecode' Schubert
2008-12-04 19:35 ` Jakub Narebski
2008-12-04 22:25   ` Simon 'corecode' Schubert
2008-12-04 22:46     ` Jakub Narebski
  -- strict thread matches above, loose matches on Subject: below --
2008-12-04 17:04 Simon 'corecode' Schubert
2008-12-04 18:28 ` Boyd Stephen Smith Jr.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).