* [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
* Re: [PATCH] Allow passing of --directory to git-am.
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 19:35 ` Jakub Narebski
2 siblings, 0 replies; 15+ messages in thread
From: Jeff King @ 2008-12-04 18:51 UTC (permalink / raw)
To: Simon 'corecode' Schubert; +Cc: git
On Thu, Dec 04, 2008 at 07:48:50PM +0100, Simon 'corecode' Schubert wrote:
> 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.
Maybe it would be a good idea to add a test to the test script, then?
-Peff
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Allow passing of --directory to git-am.
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 19:35 ` Jakub Narebski
2 siblings, 1 reply; 15+ messages in thread
From: Junio C Hamano @ 2008-12-04 19:27 UTC (permalink / raw)
To: Simon 'corecode' Schubert; +Cc: git
Simon 'corecode' Schubert <corecode@fs.ei.tum.de> writes:
> We need to play some shell tricks to be able to pass directory names
> which contain spaces and/or quotes.
There already was an earlier attempt for this feature by Kevin Ballard,
which had issues I pointed out:
http://thread.gmane.org/gmane.comp.version-control.git/94335/focus=94456
The patch was carried for a few weeks in 'pu' but was dropped due to lack
of follow-up updates.
Does your version address the issues Kevin's one had?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Allow passing of --directory to git-am.
2008-12-04 19:27 ` Junio C Hamano
@ 2008-12-04 22:26 ` Simon 'corecode' Schubert
2008-12-04 22:33 ` Junio C Hamano
0 siblings, 1 reply; 15+ messages in thread
From: Simon 'corecode' Schubert @ 2008-12-04 22:26 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano wrote:
> Simon 'corecode' Schubert <corecode@fs.ei.tum.de> writes:
>
>> We need to play some shell tricks to be able to pass directory names
>> which contain spaces and/or quotes.
>
> There already was an earlier attempt for this feature by Kevin Ballard,
> which had issues I pointed out:
>
> http://thread.gmane.org/gmane.comp.version-control.git/94335/focus=94456
>
> The patch was carried for a few weeks in 'pu' but was dropped due to lack
> of follow-up updates.
>
> Does your version address the issues Kevin's one had?
You mean not storing/restoring the flags across an invocation? No, that's
a different thing. My patch only adds the --directory option, it does not
fix the previously existing bug.
cheers
simon
--
<3 the future +++ RENT this banner advert +++ ASCII Ribbon /"\
rock the past +++ space for low €€€ NOW!1 +++ Campaign \ /
Party Enjoy Relax | http://dragonflybsd.org Against HTML \
Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Allow passing of --directory to git-am.
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:41 ` [PATCH] Allow passing of --directory to git-am Simon 'corecode' Schubert
0 siblings, 2 replies; 15+ messages in thread
From: Junio C Hamano @ 2008-12-04 22:33 UTC (permalink / raw)
To: Simon 'corecode' Schubert; +Cc: git
Simon 'corecode' Schubert <corecode@fs.ei.tum.de> writes:
> You mean not storing/restoring the flags across an invocation? No,
> that's a different thing. My patch only adds the --directory option,
> it does not fix the previously existing bug.
The question is if it _introduces_ a bug that the directory given in the
initial invocation of "git am --directory=foo" is lost if an patch does
not apply and you need to manually resolve and continue.
If it does not introduce such a bug, you do not have the same issue as the
old patch. Otherwise you have the same issue as the old patch. The
question was if you have the same issue or you don't. Yes? No?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Allow passing of --directory to git-am.
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
1 sibling, 1 reply; 15+ messages in thread
From: Junio C Hamano @ 2008-12-04 23:14 UTC (permalink / raw)
To: Simon 'corecode' Schubert; +Cc: git
Junio C Hamano <gitster@pobox.com> writes:
> Simon 'corecode' Schubert <corecode@fs.ei.tum.de> writes:
>
>> You mean not storing/restoring the flags across an invocation? No,
>> that's a different thing. My patch only adds the --directory option,
>> it does not fix the previously existing bug.
>
> The question is if it _introduces_ a bug that the directory given in the
> initial invocation of "git am --directory=foo" is lost if an patch does
> not apply and you need to manually resolve and continue.
>
> If it does not introduce such a bug, you do not have the same issue as the
> old patch. Otherwise you have the same issue as the old patch. The
> question was if you have the same issue or you don't. Yes? No?
I think this fixes the --whitespace=* one, although I obviously haven't
tried to use it myself extensively.
The third hunk is just a style fix. "am" is written in a quite old
fashioned way.
-- >8 --
Subject: [PATCH] git-am --whitespace: do not lose the command line option
When you start "git am --whitespace=fix" and the patch application process
is interrupted by an unapplicable patch early in the series, after
fixing the offending patch, the remainder of the patch should be processed
still with --whitespace=fix when restarted with "git am --resolved".
The commit 67dad68 (add -C[NUM] to git-am, 2007-02-08) broke this long
time ago. This should fix it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
git-am.sh | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index aa60261..1bf70d4 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -121,7 +121,7 @@ It does not apply to blobs recorded in its index."
prec=4
dotest="$GIT_DIR/rebase-apply"
-sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=
+sign= utf8=t keep= skip= interactive= resolved= rebasing= abort= ws=
resolvemsg= resume=
git_apply_opt=
@@ -156,7 +156,7 @@ do
--resolvemsg)
shift; resolvemsg=$1 ;;
--whitespace)
- git_apply_opt="$git_apply_opt $1=$2"; shift ;;
+ ws="--whitespace=$2"; shift ;;
-C|-p)
git_apply_opt="$git_apply_opt $1$2"; shift ;;
--)
@@ -283,7 +283,7 @@ if test "$(cat "$dotest/keep")" = t
then
keep=-k
fi
-ws=`cat "$dotest/whitespace"`
+ws=$(cat "$dotest/whitespace")
if test "$(cat "$dotest/sign")" = t
then
SIGNOFF=`git var GIT_COMMITTER_IDENT | sed -e '
@@ -454,7 +454,7 @@ do
case "$resolved" in
'')
- git apply $git_apply_opt --index "$dotest/patch"
+ git apply $git_apply_opt $ws --index "$dotest/patch"
apply_status=$?
;;
t)
--
1.6.1.rc1.60.g1d1d7
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH - DONTUSE] git-am: propagate -C/-p as well
2008-12-04 23:14 ` Junio C Hamano
@ 2008-12-04 23:36 ` Junio C Hamano
0 siblings, 0 replies; 15+ messages in thread
From: Junio C Hamano @ 2008-12-04 23:36 UTC (permalink / raw)
To: Simon 'corecode' Schubert; +Cc: git
Junio C Hamano <gitster@pobox.com> writes:
> I think this fixes the --whitespace=* one, although I obviously haven't
> tried to use it myself extensively.
This one comes on top of it *if* you want to propagate -C/-p as well, but
I think it might be a wrong idea to propagate these to begin with.
Just like --3way is a one-shot option to deal with a single unapplicable
patch (because it was based on an old version) in the whole series, and is
designed not to get propagated, I suspect that people use -C<n> to fix a
single broken patch and they may expect it not to apply to the whole
series.
The breakage --whitespace deals with is an attribute of the submitter (use
of a broken editor and lack of diligence). You most often feed a single
series from the same submitter in the same mbox to "git am", preserving
the --whitespace=fix option during the same "am" run makes sense, and
somewhat more importantly, even though the option indeed modifies what you
received, the change the option causes and the risk of breaking the
semantics of the patch is minimum. I am not sure the breakage --3way
deals with falls into the exactly the same category, but it is similar (if
the first patch in the series was based on an old version, it is very
likely that the subsequent ones are also based on the same old version).
So after all it might be better to propagate --3way as well (which this
patch does not do).
If we decide that propagating --3way is a good thing, then it would be
equally good to propagate -C, -p and --directory options.
I dunno.
git-am.sh | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git c/git-am.sh w/git-am.sh
index 1bf70d4..a35e07a 100755
--- c/git-am.sh
+++ w/git-am.sh
@@ -121,7 +121,7 @@ It does not apply to blobs recorded in its index."
prec=4
dotest="$GIT_DIR/rebase-apply"
-sign= utf8=t keep= skip= interactive= resolved= rebasing= abort= ws=
+sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=
resolvemsg= resume=
git_apply_opt=
@@ -155,9 +155,7 @@ do
;;
--resolvemsg)
shift; resolvemsg=$1 ;;
- --whitespace)
- ws="--whitespace=$2"; shift ;;
- -C|-p)
+ -C|-p|--whitespace)
git_apply_opt="$git_apply_opt $1$2"; shift ;;
--)
shift; break ;;
@@ -247,10 +245,10 @@ else
exit 1
}
- # -s, -u, -k and --whitespace flags are kept for the
- # resuming session after a patch failure.
+ # -s, -u, -k, --whitespace, -C and -p flags are kept
+ # for the resuming session after a patch failure.
# -3 and -i can and must be given when resuming.
- echo " $ws" >"$dotest/whitespace"
+ echo " $git_apply_opt" >"$dotest/apply_opt_extra"
echo "$sign" >"$dotest/sign"
echo "$utf8" >"$dotest/utf8"
echo "$keep" >"$dotest/keep"
@@ -283,7 +281,7 @@ if test "$(cat "$dotest/keep")" = t
then
keep=-k
fi
-ws=$(cat "$dotest/whitespace")
+apply_opt_extra=$(cat "$dotest/apply_opt_extra")
if test "$(cat "$dotest/sign")" = t
then
SIGNOFF=`git var GIT_COMMITTER_IDENT | sed -e '
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] Allow passing of --directory to git-am.
2008-12-04 22:33 ` Junio C Hamano
2008-12-04 23:14 ` Junio C Hamano
@ 2008-12-04 23:41 ` Simon 'corecode' Schubert
2008-12-05 0:11 ` Junio C Hamano
1 sibling, 1 reply; 15+ messages in thread
From: Simon 'corecode' Schubert @ 2008-12-04 23:41 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano wrote:
> Simon 'corecode' Schubert <corecode@fs.ei.tum.de> writes:
>
>> You mean not storing/restoring the flags across an invocation? No,
>> that's a different thing. My patch only adds the --directory option,
>> it does not fix the previously existing bug.
>
> The question is if it _introduces_ a bug that the directory given in the
> initial invocation of "git am --directory=foo" is lost if an patch does
> not apply and you need to manually resolve and continue.
>
> If it does not introduce such a bug, you do not have the same issue as the
> old patch. Otherwise you have the same issue as the old patch. The
> question was if you have the same issue or you don't. Yes? No?
Yes, that's the issue. In this regard it behaves bug-compatible with the
-p and -C options.
--
<3 the future +++ RENT this banner advert +++ ASCII Ribbon /"\
rock the past +++ space for low €€€ NOW!1 +++ Campaign \ /
Party Enjoy Relax | http://dragonflybsd.org Against HTML \
Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Allow passing of --directory to git-am.
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
0 siblings, 1 reply; 15+ messages in thread
From: Junio C Hamano @ 2008-12-05 0:11 UTC (permalink / raw)
To: Simon 'corecode' Schubert; +Cc: git
Simon 'corecode' Schubert <corecode@fs.ei.tum.de> writes:
> Junio C Hamano wrote:
>> Simon 'corecode' Schubert <corecode@fs.ei.tum.de> writes:
>>
>>> You mean not storing/restoring the flags across an invocation? No,
>>> that's a different thing. My patch only adds the --directory option,
>>> it does not fix the previously existing bug.
>>
>> The question is if it _introduces_ a bug that the directory given in the
>> initial invocation of "git am --directory=foo" is lost if an patch does
>> not apply and you need to manually resolve and continue.
>>
>> If it does not introduce such a bug, you do not have the same issue as the
>> old patch. Otherwise you have the same issue as the old patch. The
>> question was if you have the same issue or you don't. Yes? No?
>
> Yes, that's the issue. In this regard it behaves bug-compatible with
> the -p and -C options.
If that is the case, and assuming that propagating -C/-p would be a good
idea (which I am not sure yet), the patch I sent out earlier (which was
flawed somewhat; it should use "$git_apply_opt_extra" where it invokes the
"git apply" command) with necessary fix would serve as the basis to
implement --directory=<dir>?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Allow passing of --directory to git-am.
2008-12-05 0:11 ` Junio C Hamano
@ 2008-12-05 0:16 ` Simon 'corecode' Schubert
0 siblings, 0 replies; 15+ messages in thread
From: Simon 'corecode' Schubert @ 2008-12-05 0:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano wrote:
> If that is the case, and assuming that propagating -C/-p would be a good
> idea (which I am not sure yet), the patch I sent out earlier (which was
> flawed somewhat; it should use "$git_apply_opt_extra" where it invokes the
> "git apply" command) with necessary fix would serve as the basis to
> implement --directory=<dir>?
certainly. I'll be travelling, so don't expect anything real soon, will
resubmit unless I forget.
--
<3 the future +++ RENT this banner advert +++ ASCII Ribbon /"\
rock the past +++ space for low €€€ NOW!1 +++ Campaign \ /
Party Enjoy Relax | http://dragonflybsd.org Against HTML \
Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Allow passing of --directory to git-am.
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 19:35 ` Jakub Narebski
2008-12-04 22:25 ` Simon 'corecode' Schubert
2 siblings, 1 reply; 15+ messages in thread
From: Jakub Narebski @ 2008-12-04 19:35 UTC (permalink / raw)
To: Simon 'corecode' Schubert; +Cc: git
Simon 'corecode' Schubert <corecode@fs.ei.tum.de> writes:
> 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
Shouldn't it be
+ directory= pass it through git-apply
to have it aligned like the rest of it?
By the way, your patch looks whitespace damaged, although only context
for the above chunk was wrapped...
> 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")
Why not simply use "git rev-parse --sq"?
> + 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"'
Why eval?
> apply_status=$?
> ;;
> t)
> --
> 1.6.1.rc1.45.g123ed.dirty
Hmmm...
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Allow passing of --directory to git-am.
2008-12-04 19:35 ` Jakub Narebski
@ 2008-12-04 22:25 ` Simon 'corecode' Schubert
2008-12-04 22:46 ` Jakub Narebski
0 siblings, 1 reply; 15+ messages in thread
From: Simon 'corecode' Schubert @ 2008-12-04 22:25 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
Jakub Narebski wrote:
> Shouldn't it be
>
> + directory= pass it through git-apply
>
> to have it aligned like the rest of it?
>
> By the way, your patch looks whitespace damaged, although only context
> for the above chunk was wrapped...
Thunderbird must have pummeled it. No clue why it does that though.
Black magic software.
>> @@ -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")
>
> Why not simply use "git rev-parse --sq"?
What I need is to convert $2 into a form suitable for quoting, does git
rev-parse --sq do that?
>> + 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"'
>
> Why eval?
I quoted the above variable, so I now need to unquote it, that's done by eval.
--
<3 the future +++ RENT this banner advert +++ ASCII Ribbon /"\
rock the past +++ space for low €€€ NOW!1 +++ Campaign \ /
Party Enjoy Relax | http://dragonflybsd.org Against HTML \
Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Allow passing of --directory to git-am.
2008-12-04 22:25 ` Simon 'corecode' Schubert
@ 2008-12-04 22:46 ` Jakub Narebski
0 siblings, 0 replies; 15+ messages in thread
From: Jakub Narebski @ 2008-12-04 22:46 UTC (permalink / raw)
To: Simon 'corecode' Schubert; +Cc: git
Simon 'corecode' Schubert wrote:
> Jakub Narebski wrote:
>> Simon 'corecode' Schubert wrote:
>>> @@ -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")
>>
>> Why not simply use "git rev-parse --sq"?
>
> What I need is to convert $2 into a form suitable for quoting, does git
> rev-parse --sq do that?
$ git rev-parse --sq -- "don't do that"
'--' 'don'\''t do that'
Without terminating newline. The '--' is needed because otherwise
git-rev-parse expects revisions... and doesn't find any.
By the way you could both simplify option parsing _and_ take care of
proper quoting by using --parseopt, i.e. use git-rev-parse in PARSEOPT
mode. But that is more involved change.
>>> @@ -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"'
>>
>> Why eval?
>
> I quoted the above variable, so I now need to unquote it, that's done by eval.
Ah.
--
Jakub Narebski
Poland
^ permalink raw reply [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).