Discussion:
[PATCH] cvsimport: have default merge regex allow for dashes in the branch name
(too old to reply)
Philippe Bruhat (BooK)
2008-02-28 10:18:21 UTC
Permalink
From: Philippe Bruhat (BooK <***@cpan.org>

The default value of @mergerx uses \w, which matches word
character; a branch name like policy-20050608-br will not be
matched.
---
git-cvsimport.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 9516242..3d013a7 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -164,7 +164,7 @@ if ($#ARGV == 0) {

our @mergerx = ();
if ($opt_m) {
- @mergerx = ( qr/\b(?:from|of|merge|merging|merged) (\w+)/i );
+ @mergerx = ( qr/\b(?:from|of|merge|merging|merged) ([-\w]+)/i );
}
if ($opt_M) {
push (@mergerx, qr/$opt_M/);
--
1.5.4.2.187.gfc276
Philippe Bruhat (BooK)
2008-02-28 10:18:22 UTC
Permalink
From: Philippe Bruhat (BooK <***@cpan.org>

Use Getopt::Long instead of Getopt::Std to handle multiple -M options,
for all the cases when having a single custom regex is not enough.

For example, "merged (\w+)" and "(\w+) merged" can't be easily turned
into a single regular expression capturing the branch name in $1.
---
git-cvsimport.perl | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 3d013a7..f138a01 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -15,7 +15,7 @@

use strict;
use warnings;
-use Getopt::Std;
+use Getopt::Long;
use File::Spec;
use File::Temp qw(tempfile tmpnam);
use File::Path qw(mkpath);
@@ -29,7 +29,7 @@ use IPC::Open2;
$SIG{'PIPE'}="IGNORE";
$ENV{'TZ'}="UTC";

-our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S,$opt_L, $opt_a, $opt_r);
+our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,@opt_M,$opt_A,$opt_S,$opt_L, $opt_a, $opt_r);
my (%conv_author_name, %conv_author_email);

sub usage(;$) {
@@ -112,7 +112,12 @@ sub read_repo_config {

my $opts = "haivmkuo:d:p:r:C:z:s:M:P:A:S:L:";
read_repo_config($opts);
-getopts($opts) or usage();
+Getopt::Long::Configure( 'no_ignore_case' );
+
+# turn the Getopt::Std specification in a Getopt::Long one,
+# with support for multiple -M options
+GetOptions( map { s/:/=s/; /M/ ? "$_\@" : $_ } split( /(?!:)/, $opts ) )
+ or usage();
usage if $opt_h;

if (@ARGV == 0) {
@@ -166,8 +171,8 @@ our @mergerx = ();
if ($opt_m) {
@mergerx = ( qr/\b(?:from|of|merge|merging|merged) ([-\w]+)/i );
}
-if ($opt_M) {
- push (@mergerx, qr/$opt_M/);
+if (@opt_M) {
+ push (@mergerx, map { qr/$_/ } @opt_M);
}

# Remember UTC of our starting time
--
1.5.4.2.187.gfc276
Philippe Bruhat (BooK)
2008-02-28 10:18:24 UTC
Permalink
---
git-cvsimport.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index f138a01..47f116f 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -112,7 +112,7 @@ sub read_repo_config {

my $opts = "haivmkuo:d:p:r:C:z:s:M:P:A:S:L:";
read_repo_config($opts);
-Getopt::Long::Configure( 'no_ignore_case' );
+Getopt::Long::Configure( 'no_ignore_case', 'bundling' );

# turn the Getopt::Std specification in a Getopt::Long one,
# with support for multiple -M options
--
1.5.4.2.187.gfc276
Philippe Bruhat (BooK)
2008-02-28 10:18:23 UTC
Permalink
From: Philippe Bruhat (BooK <***@cpan.org>

Also document the capture behaviour (source branch name in $1)

Signed-off-by: Philippe Bruhat (BooK) <***@cpan.org>
---
Documentation/git-cvsimport.txt | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt
index 6f91b9e..58eefd4 100644
--- a/Documentation/git-cvsimport.txt
+++ b/Documentation/git-cvsimport.txt
@@ -102,13 +102,17 @@ If you need to pass multiple options, separate them with a comma.

-m::
Attempt to detect merges based on the commit message. This option
- will enable default regexes that try to capture the name source
+ will enable default regexes that try to capture the source
branch name from the commit message.

-M <regex>::
Attempt to detect merges based on the commit message with a custom
regex. It can be used with '-m' to enable the default regexes
as well. You must escape forward slashes.
++
+The regex must capture the source branch name in $1.
++
+This option can be used several times to provide several detection regexes.

-S <regex>::
Skip paths matching the regex.
--
1.5.4.2.187.gfc276
Philippe Bruhat (BooK)
2008-02-28 10:18:20 UTC
Permalink
Sending again my series of patches to git-cvsimport, which allow to
use several -M options for giving the regular expressions capturing the
source branch name when merging.

Signed-off-by: Philippe Bruhat (BooK) <***@cpan.org>
Junio C Hamano
2008-02-28 20:07:46 UTC
Permalink
"Philippe Bruhat (BooK)" <***@cpan.org> writes:

> Sending again my series of patches to git-cvsimport, which allow to
> use several -M options for giving the regular expressions capturing the
> source branch name when merging.

Could you be a bit more explicit than "Sending again", describe
if it is just a straight resend, or what problems were pointed
out in the earlier round (if any) and how they were addressed
(or ignored, if any)?

Also please Sign-off all your patches. Cover letters do not
need one.

I'll take a look at them later, when I have enough time to fish
for messages and discussions from earlier round in the list
archive in order to process this.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Philippe Bruhat (BooK)
2008-02-29 10:02:41 UTC
Permalink
On Thu, Feb 28, 2008 at 12:07:46PM -0800, Junio C Hamano wrote:
> "Philippe Bruhat (BooK)" <***@cpan.org> writes:
>
> > Sending again my series of patches to git-cvsimport, which allow to
> > use several -M options for giving the regular expressions capturing the
> > source branch name when merging.
>
> Could you be a bit more explicit than "Sending again", describe
> if it is just a straight resend, or what problems were pointed
> out in the earlier round (if any) and how they were addressed
> (or ignored, if any)?

Sorry.

In the previous round, an asciidoc formatting error was pointed in my
doc patch, and you also noted that the t/t9600-cvsimport.sh test script
failed after my Getopt::Std -> Getopt::Long patch.

I corrected all those problems (checked the asciidoc HTML output, and
made sure the test script passed again).

> Also please Sign-off all your patches. Cover letters do not
> need one.

It noticed that I forgot to -s my commits, so I thought that signing off
the cover letter would be equivalent. I tried to follow the guidelines
for sending patches, using format-patch and send-email, but I'm still a
newbie both to git and it's development model.

> I'll take a look at them later, when I have enough time to fish
> for messages and discussions from earlier round in the list
> archive in order to process this.

You can ignore my previous messages, then. These four patches were
rebased on the top of master, and correct the problems that were
previously pointed to me.

Thanks,

--
Philippe Bruhat (BooK)

The shortest distance between two points is not always the safest.
(Moral from Groo The Wanderer #69 (Epic))
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Junio C Hamano
2008-03-01 05:59:19 UTC
Permalink
"Philippe Bruhat (BooK)" <***@cpan.org> writes:

> On Thu, Feb 28, 2008 at 12:07:46PM -0800, Junio C Hamano wrote:
>
>> I'll take a look at them later, when I have enough time to fish
>> for messages and discussions from earlier round in the list
>> archive in order to process this.
>
> You can ignore my previous messages, then. These four patches were
> rebased on the top of master, and correct the problems that were
> previously pointed to me.

I do not work that way. I am a trust-but-verify kind of person.

So I dug up the old ones and the discussion. The series looks
fine.

cvsimport: have default merge regex allow for dashes in the branch name

You can extend the default with -M anyway, but I guess the
default pattern can be loosened like this without increasing
the risk of false hits, so probably it is Ok.

cvsimport: allow for multiple -M options

Ok.

cvsimport: document that -M can be used multiple times

Ok, except that "can be used seveval times" should probably be
"can be used more than once".

cvsimport: configure Getopt::Long to bundle options

Ok. Why isn't bundling the default, I have to wonder...

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Junio C Hamano
2008-03-01 20:24:39 UTC
Permalink
Junio C Hamano <***@pobox.com> writes:

> "Philippe Bruhat (BooK)" <***@cpan.org> writes:
>
>> On Thu, Feb 28, 2008 at 12:07:46PM -0800, Junio C Hamano wrote:
>>
>>> I'll take a look at them later, when I have enough time to fish
>>> for messages and discussions from earlier round in the list
>>> archive in order to process this.
>>
>> You can ignore my previous messages, then. These four patches were
>> rebased on the top of master, and correct the problems that were
>> previously pointed to me.
>
> I do not work that way. I am a trust-but-verify kind of person.
>
> So I dug up the old ones and the discussion. The series looks
> fine.
> ...
> cvsimport: have default merge regex allow for dashes in the branch name
> ...
> cvsimport: allow for multiple -M options
>
> Ok.
> ...
> cvsimport: document that -M can be used multiple times
> cvsimport: configure Getopt::Long to bundle options
>
> Ok. Why isn't bundling the default, I have to wonder...

I take these back.

The last one is an "Oops, the second one was an utter crap, it does not
even pass the testsuite, well let's patch it up with an extra commit at
the end."

Please don't do this. We do not have to record earlier mistakes in the
public history.

I've squashed 4/4 into 2/4 and made it a 3-patch series.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Jörg Sommer
2008-02-28 11:15:36 UTC
Permalink
If there's only one file to patch, select it automaticly and don't bother
the user. In the case he didn't want do patching, he can say 'd' at the
patch prompt.
---
git-add--interactive.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index a0a81f1..77ad6fb 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -778,7 +778,7 @@ sub patch_update_cmd {
print STDERR "No changes.\n";
return 0;
}
- if ($patch_mode) {
+ if ($patch_mode or @mods == 1) {
@them = @mods;
}
else {
--
1.5.4.3
Xavier Maillard
2008-02-29 02:00:20 UTC
Permalink
If there's only one file to patch, select it automaticly and don't bother
the user. In the case he didn't want do patching, he can say 'd' at the
patch prompt.

Like this quick-win.

Tested-by: Xavier Maillard <***@gnu.org>

Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
SZEDER Gábor
2008-03-04 18:00:58 UTC
Permalink
Signed-off-by: SZEDER G=C3=A1bor <***@ira.uka.de>
---
contrib/completion/git-completion.bash | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completio=
n/git-completion.bash
index 8f70e1e..8d6733a 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -506,7 +506,16 @@ _git_bisect ()
=20
_git_branch ()
{
- __gitcomp "$(__git_refs)"
+ case "${COMP_WORDS[COMP_CWORD]}" in
+ --*=3D*) COMPREPLY=3D() ;;
+ --*)
+ __gitcomp "
+ --color --no-color --verbose --abbrev=3D --no-abbrev
+ --track --no-track
+ "
+ ;;
+ *) __gitcomp "$(__git_refs)" ;;
+ esac
}
=20
_git_bundle ()
--=20
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
SZEDER Gábor
2008-03-04 18:00:59 UTC
Permalink
But still all branches are listed, if -r is present

Signed-off-by: SZEDER G=C3=A1bor <***@ira.uka.de>
---
contrib/completion/git-completion.bash | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completio=
n/git-completion.bash
index 8d6733a..49e6df0 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -506,6 +506,17 @@ _git_bisect ()
=20
_git_branch ()
{
+ local i c=3D1 only_local_ref=3D"n" has_r=3D"n"
+
+ while [ $c -lt $COMP_CWORD ]; do
+ i=3D"${COMP_WORDS[c]}"
+ case "$i" in
+ -d|-m) only_local_ref=3D"y" ;;
+ -r) has_r=3D"y" ;;
+ esac
+ c=3D$((++c))
+ done
+
case "${COMP_WORDS[COMP_CWORD]}" in
--*=3D*) COMPREPLY=3D() ;;
--*)
@@ -514,7 +525,13 @@ _git_branch ()
--track --no-track
"
;;
- *) __gitcomp "$(__git_refs)" ;;
+ *)
+ if [ $only_local_ref =3D "y" -a $has_r =3D "n" ]; then
+ __gitcomp "$(__git_heads)"
+ else
+ __gitcomp "$(__git_refs)"
+ fi
+ ;;
esac
}
=20
--=20
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Shawn O. Pearce
2008-03-05 05:51:38 UTC
Permalink
SZEDER Gbor <***@ira.uka.de> wrote:
> But still all branches are listed, if -r is present
>=20
> Signed-off-by: SZEDER G=C3=A1bor <***@ira.uka.de>

Nice.

Both patches 1 and 2,
Acked-by: Shawn O. Pearce <***@spearce.org>

> ---
> contrib/completion/git-completion.bash | 19 ++++++++++++++++++-
> 1 files changed, 18 insertions(+), 1 deletions(-)

--=20
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
SZEDER Gábor
2008-03-05 19:07:49 UTC
Permalink
Pressing TAB right after 'git command --long-option=3D' results in
'git command --long-option=3D--long-option=3D' when the long option req=
uires
an argument, but we don't provide completion for its arguments (e.g.
commit --author=3D, apply --exclude=3D). This patch detects these long
options and provides empty completion array for them.

Signed-off-by: SZEDER G=C3=A1bor <***@ira.uka.de>
---
contrib/completion/git-completion.bash | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completio=
n/git-completion.bash
index d890f16..18b4001 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -113,13 +113,21 @@ __gitcomp ()
if [ $# -gt 2 ]; then
cur=3D"$3"
fi
- for c in $1; do
- case "$c$4" in
- --*=3D*) all=3D"$all$c$4$s" ;;
- *.) all=3D"$all$c$4$s" ;;
- *) all=3D"$all$c$4 $s" ;;
- esac
- done
+ case "$cur" in
+ --*=3D)
+ COMPREPLY=3D()
+ return
+ ;;
+ *)
+ for c in $1; do
+ case "$c$4" in
+ --*=3D*) all=3D"$all$c$4$s" ;;
+ *.) all=3D"$all$c$4$s" ;;
+ *) all=3D"$all$c$4 $s" ;;
+ esac
+ done
+ ;;
+ esac
IFS=3D$s
COMPREPLY=3D($(compgen -P "$2" -W "$all" -- "$cur"))
return
--=20
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
SZEDER Gábor
2008-03-05 19:16:03 UTC
Permalink
Signed-off-by: SZEDER G=C3=A1bor <***@ira.uka.de>
---
contrib/completion/git-completion.bash | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completio=
n/git-completion.bash
index 8f70e1e..d138bda 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1087,7 +1087,7 @@ _git_show ()
=20
_git_stash ()
{
- __gitcomp 'list show apply clear'
+ __gitcomp 'save list show apply clear'
}
=20
_git_submodule ()
--=20
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
SZEDER Gábor
2008-03-05 19:16:04 UTC
Permalink
Signed-off-by: SZEDER G=C3=A1bor <***@ira.uka.de>
---
contrib/completion/git-completion.bash | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completio=
n/git-completion.bash
index d138bda..5ecdca0 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1087,7 +1087,22 @@ _git_show ()
=20
_git_stash ()
{
- __gitcomp 'save list show apply clear'
+ local i c=3D1 command
+
+ while [ $c -lt $COMP_CWORD ]; do
+ i=3D"${COMP_WORDS[c]}"
+ case "$i" in
+ save|list|show|apply|clear)
+ command=3D"$i"
+ break
+ ;;
+ esac
+ c=3D$((++c))
+ done
+
+ if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
+ __gitcomp 'save list show apply clear'
+ fi
}
=20
_git_submodule ()
--=20
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
SZEDER Gábor
2008-03-05 19:28:06 UTC
Permalink
Signed-off-by: SZEDER G=C3=A1bor <***@ira.uka.de>
---
contrib/completion/git-completion.bash | 65 ++++++++++++++++++++++++=
++++++++
1 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completio=
n/git-completion.bash
index 8f56641..797ac1b 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1186,6 +1186,71 @@ _git_svn ()
set-tree commit-diff info create-ignore propget
proplist show-ignore show-externals
"
+ else
+ local remote_opts=3D"--username=3D --config-dir=3D --no-auth-cache"
+ local fc_opts=3D"
+ --follow-parent --authors-file=3D --repack=3D
+ --no-metadata --use-svm-props --use-svnsync-props
+ --log-window-size=3D --no-checkout --quiet
+ --repack-flags --user-log-author $remote_opts
+ "
+ local init_opts=3D"
+ --template=3D --shared=3D --trunk=3D --tags=3D
+ --branches=3D --stdlayout --minimize-url
+ --no-metadata --use-svm-props --use-svnsync-props
+ --rewrite-root=3D $remote_opts
+ "
+ local cmt_opts=3D"
+ --edit --rmdir --find-copies-harder --copy-similarity=3D
+ "
+
+ local cur=3D"${COMP_WORDS[COMP_CWORD]}"
+ case "$command,$cur" in
+ fetch,--*)
+ __gitcomp "--revision=3D --fetch-all $fc_opts"
+ ;;
+ clone,--*)
+ __gitcomp "--revision=3D $fc_opts $init_opts"
+ ;;
+ init,--*)
+ __gitcomp "$init_opts"
+ ;;
+ dcommit,--*)
+ __gitcomp "
+ --merge --strategy=3D --verbose --dry-run
+ --fetch-all --no-rebase $cmt_opts $fc_opts
+ "
+ ;;
+ set-tree,--*)
+ __gitcomp "--stdin $cmt_opts $fc_opts"
+ ;;
+ create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\
+ show-externals,--*)
+ __gitcomp "--revision=3D"
+ ;;
+ log,--*)
+ __gitcomp "
+ --limit=3D --revision=3D --verbose --incremental
+ --oneline --show-commit --non-recursive
+ --authors-file=3D
+ "
+ ;;
+ rebase,--*)
+ __gitcomp "
+ --merge --verbose --strategy=3D --local
+ --fetch-all $fc_opts
+ "
+ ;;
+ commit-diff,--*)
+ __gitcomp "--message=3D --file=3D --revision=3D $cmt_opts"
+ ;;
+ info,--*)
+ __gitcomp "--url"
+ ;;
+ *)
+ COMPREPLY=3D()
+ ;;
+ esac
fi
}
=20
--=20
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
SZEDER Gábor
2008-03-05 19:28:05 UTC
Permalink
Signed-off-by: SZEDER G=C3=A1bor <***@ira.uka.de>
---
contrib/completion/git-completion.bash | 29 ++++++++++++++++++++++++=
++++-
1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completio=
n/git-completion.bash
index 23e5994..8f56641 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -384,7 +384,6 @@ __git_commands ()
show-index) : plumbing;;
ssh-*) : transport;;
stripspace) : plumbing;;
- svn) : import export;;
symbolic-ref) : plumbing;;
tar-tree) : deprecated;;
unpack-file) : plumbing;;
@@ -1164,6 +1163,32 @@ _git_submodule ()
fi
}
=20
+_git_svn ()
+{
+ local i c=3D1 command
+
+ while [ $c -lt $COMP_CWORD ]; do
+ i=3D"${COMP_WORDS[c]}"
+ case "$i" in
+ init|fetch|clone|rebase|dcommit|log|find-rev|\
+ set-tree|commit-diff|info|\
+ create-ignore|propget|proplist|show-ignore|show-externals)
+ command=3D"$i"
+ break
+ ;;
+ esac
+ c=3D$((++c))
+ done
+
+ if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
+ __gitcomp "
+ init fetch clone rebase dcommit log find-rev
+ set-tree commit-diff info create-ignore propget
+ proplist show-ignore show-externals
+ "
+ fi
+}
+
_git_tag ()
{
local i c=3D1 f=3D0
@@ -1265,6 +1290,7 @@ _git ()
show-branch) _git_log ;;
stash) _git_stash ;;
submodule) _git_submodule ;;
+ svn) _git_svn ;;
tag) _git_tag ;;
whatchanged) _git_log ;;
*) COMPREPLY=3D() ;;
@@ -1315,6 +1341,7 @@ complete -o default -o nospace -F _git_shortlog g=
it-shortlog
complete -o default -o nospace -F _git_show git-show
complete -o default -o nospace -F _git_stash git-stash
complete -o default -o nospace -F _git_submodule git-submodule
+complete -o default -o nospace -F _git_svn git-svn
complete -o default -o nospace -F _git_log git-show-branch
complete -o default -o nospace -F _git_tag git-tag
complete -o default -o nospace -F _git_log git-whatchanged
--=20
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
SZEDER Gábor
2008-03-06 14:58:32 UTC
Permalink
This function takes one argument: a string containing all subcommands
separated by spaces. The function searches through the command line
whether a subcommand is already present. If a subcommand is found, it
will be printed to standard output.

This enables us to remove code duplications from completion
functions for commands having subcommands.

Signed-off-by: SZEDER G=C3=A1bor <***@ira.uka.de>
---
This function does not return the index of the subcommand found on the
command line, which was in the $c variable previously. However, $c was
only used in if statements, like:
if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
__gitcomp "cmd1 cmd2 cmd3"
fi
To my understanding the only(?) purpose of those if statements was to
prevent subcommands appearing again on the list of possible completions=
,
when there was one already on the command line. But [ -z $command ] is
sufficient to detect those cases, so we can actually omit
[ $c -eq $COMP_CWORD ]. Is it right, or am I missing something?

Note, that some of the patches I sent out yesterday are in conflict wit=
h
these changes, namely:
* [PATCH 1/2] bash: add missing 'git stash save' subcommand
is in conflict,
* [PATCH 2/2] bash: complete 'git stash' subcommands only once
should be dropped,
* [PATCH 1/2] bash: add 'git svn' subcommands
should be updated, and
* [PATCH 2/2] bash: add 'git svn' options
should be updated (depends on the previous one).
I think that if this patch will get merged, then it should be merged
before those mentioned above. It just doesn't make much sense e.g. to
merge 'complete 'git stash' subcommands only once' and then basically
revert it. In this case, of course, I will send the updated patches.

contrib/completion/git-completion.bash | 70 ++++++++++++++----------=
--------
1 files changed, 31 insertions(+), 39 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completio=
n/git-completion.bash
index 49e6df0..f9e29be 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -420,6 +420,22 @@ __git_aliased_command ()
done
}
=20
+__git_find_subcommand ()
+{
+ local word subcommand c=3D1
+
+ while [ $c -lt $COMP_CWORD ]; do
+ word=3D"${COMP_WORDS[c]}"
+ for subcommand in $1; do
+ if [ "$subcommand" =3D "$word" ]; then
+ echo "$subcommand"
+ return
+ fi
+ done
+ c=3D$((++c))
+ done
+}
+
__git_whitespacelist=3D"nowarn warn error error-all strip"
=20
_git_am ()
@@ -477,24 +493,13 @@ _git_add ()
=20
_git_bisect ()
{
- local i c=3D1 command
- while [ $c -lt $COMP_CWORD ]; do
- i=3D"${COMP_WORDS[c]}"
- case "$i" in
- start|bad|good|reset|visualize|replay|log)
- command=3D"$i"
- break
- ;;
- esac
- c=3D$((++c))
- done
-
- if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
- __gitcomp "start bad good reset visualize replay log"
+ local subcommands=3D"start bad good reset visualize replay log"
+ local subcommand=3D"$(__git_find_subcommand "$subcommands")"
+ if [ -z "$subcommand" ]; then
return
fi
=20
- case "$command" in
+ case "$subcommand" in
bad|good|reset)
__gitcomp "$(__git_refs)"
;;
@@ -1025,21 +1030,13 @@ _git_config ()
=20
_git_remote ()
{
- local i c=3D1 command
- while [ $c -lt $COMP_CWORD ]; do
- i=3D"${COMP_WORDS[c]}"
- case "$i" in
- add|rm|show|prune|update) command=3D"$i"; break ;;
- esac
- c=3D$((++c))
- done
-
- if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
- __gitcomp "add rm show prune update"
+ local subcommands=3D"add rm show prune update"
+ local subcommand=3D"$(__git_find_subcommand "$subcommands")"
+ if [ -z "$subcommand" ]; then
return
fi
=20
- case "$command" in
+ case "$subcommand" in
rm|show|prune)
__gitcomp "$(__git_remotes)"
;;
@@ -1113,28 +1110,23 @@ _git_show ()
=20
_git_stash ()
{
- __gitcomp 'list show apply clear'
+ local subcommands=3D'list show apply clear'
+ if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
+ __gitcomp "$subcommands"
+ fi
}
=20
_git_submodule ()
{
- local i c=3D1 command
- while [ $c -lt $COMP_CWORD ]; do
- i=3D"${COMP_WORDS[c]}"
- case "$i" in
- add|status|init|update) command=3D"$i"; break ;;
- esac
- c=3D$((++c))
- done
Shawn O. Pearce
2008-03-08 02:23:42 UTC
Permalink
SZEDER Gbor <***@ira.uka.de> wrote:
> This enables us to remove code duplications from completion
> functions for commands having subcommands.
>=20
> Signed-off-by: SZEDER G=C3=A1bor <***@ira.uka.de>
> ---
> This function does not return the index of the subcommand found on th=
e
> command line, which was in the $c variable previously. However, $c w=
as
> only used in if statements, like:
> if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
> __gitcomp "cmd1 cmd2 cmd3"
> fi
> To my understanding the only(?) purpose of those if statements was to
> prevent subcommands appearing again on the list of possible completio=
ns,
> when there was one already on the command line. But [ -z $command ] =
is
> sufficient to detect those cases, so we can actually omit
> [ $c -eq $COMP_CWORD ]. Is it right, or am I missing something?

Yup, you understood it correctly. You found a cluster of "copy and
paste programming" and I am happy to see it cleaned up. Thanks.

--=20
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
SZEDER Gábor
2008-03-10 14:51:01 UTC
Permalink
On Fri, Mar 07, 2008 at 09:23:42PM -0500, Shawn O. Pearce wrote:
> Yup, you understood it correctly. You found a cluster of "copy and
> paste programming" and I am happy to see it cleaned up. Thanks.
Thanks. I will send out the updated patches soon.

G=E1bor
SZEDER Gábor
2008-03-06 21:37:36 UTC
Permalink
When doing completion of rebase options in a subdirectory of the work
tree during an ongoing rebase, wrong options were offered because of th=
e
hardcoded .git/.dotest-merge path.

Signed-off-by: SZEDER G=C3=A1bor <***@ira.uka.de>
---
contrib/completion/git-completion.bash | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completio=
n/git-completion.bash
index 49e6df0..aee9125 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -828,8 +828,8 @@ _git_push ()
=20
_git_rebase ()
{
- local cur=3D"${COMP_WORDS[COMP_CWORD]}"
- if [ -d .dotest ] || [ -d .git/.dotest-merge ]; then
+ local cur=3D"${COMP_WORDS[COMP_CWORD]}" dir=3D"$(__gitdir)"
+ if [ -d .dotest ] || [ -d "$dir"/.dotest-merge ]; then
__gitcomp "--continue --skip --abort"
return
fi
--=20
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Shawn Bohrer
2008-03-13 00:03:23 UTC
Permalink
A custom diffing utility can be specified for the 'p4 diff' command by
setting the P4DIFF environment variable. However when using a custom
diffing utility such as 'vimdiff' passing options like -du can cause
unexpected behavior.

Since the goal is to generate a unified diff of the changes and attach
them to the bottom of the p4 submit log we should unset P4DIFF if it
has been set in order to generate the diff properly.

Signed-off-by: Shawn Bohrer <***@gmail.com>
---
contrib/fast-import/git-p4 | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 650ea34..0b46084 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -627,6 +627,8 @@ class P4Submit(Command):

if self.interactive:
submitTemplate = self.prepareLogMessage(template, logMessage)
+ if os.environ.has_key("P4DIFF"):
+ del(os.environ["P4DIFF"])
diff = read_pipe("p4 diff -du ...")

for newFile in filesToAdd:
--
1.5.4.3
Shawn Bohrer
2008-03-13 00:03:24 UTC
Permalink
Perforce allows you to set the P4EDITOR environment variable to your
preferred editor for use in perforce. Since we are displaying a
perforce changelog to the user we should use it when it is defined.

Signed-off-by: Shawn Bohrer <***@gmail.com>
---
contrib/fast-import/git-p4 | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 0b46084..55e38ff 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -652,7 +652,10 @@ class P4Submit(Command):
defaultEditor = "vi"
if platform.system() == "Windows":
defaultEditor = "notepad"
- editor = os.environ.get("EDITOR", defaultEditor);
+ if os.environ.has_key("P4EDITOR"):
+ editor = os.environ.get("P4EDITOR")
+ else:
+ editor = os.environ.get("EDITOR", defaultEditor);
system(editor + " " + fileName)
tmpFile = open(fileName, "rb")
message = tmpFile.read()
--
1.5.4.3
Bryan Donlan
2008-03-28 06:19:46 UTC
Permalink
Pass --quiet to cpio in git-clone to hide the (confusing) "0 blocks" message.
For compatibility with operating systems which might not support GNUisms,
the presence of --quiet is probed for by grepping cpio's --help output.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
git-clone.sh | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-clone.sh b/git-clone.sh
index e981122..2636159 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -310,6 +310,9 @@ yes)
mkdir -p "$GIT_DIR/objects/info"
echo "$repo/objects" >>"$GIT_DIR/objects/info/alternates"
else
+ cpio_quiet_flag=""
+ cpio --help 2>&1 | grep -- --quiet >/dev/null && \
+ cpio_quiet_flag=--quiet
l= &&
if test "$use_local_hardlink" = yes
then
@@ -330,7 +333,8 @@ yes)
fi
fi &&
cd "$repo" &&
- find objects -depth -print | cpio -pumd$l "$GIT_DIR/" || exit 1
+ find objects -depth -print | cpio $cpio_quiet_flag -pumd$l "$GIT_DIR/" || \
+ exit 1
fi
git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1
;;
--
1.5.4.3
Johannes Schindelin
2008-03-28 13:01:10 UTC
Permalink
Hi,

On Fri, 28 Mar 2008, Bryan Donlan wrote:

> Pass --quiet to cpio in git-clone to hide the (confusing) "0 blocks"
> message. For compatibility with operating systems which might not
> support GNUisms, the presence of --quiet is probed for by grepping
> cpio's --help output.

We have a builtin clone which is almost ready for 'next', and I think that
this issue would be resolved there anyway.

Ciao,
Dscho
Wincent Colaiuta
2008-03-28 16:12:27 UTC
Permalink
El 28/3/2008, a las 14:01, Johannes Schindelin escribi=F3:

> On Fri, 28 Mar 2008, Bryan Donlan wrote:
>
>> Pass --quiet to cpio in git-clone to hide the (confusing) "0 blocks"
>> message. For compatibility with operating systems which might not
>> support GNUisms, the presence of --quiet is probed for by grepping
>> cpio's --help output.
>
> We have a builtin clone which is almost ready for 'next', and I =20
> think that
> this issue would be resolved there anyway.

In any case, I'd rather see the cpio check at configure-time rather =20
than run-time.

Cheers,
Wincent
Johannes Schindelin
2008-03-28 16:29:36 UTC
Permalink
Hi,

On Fri, 28 Mar 2008, Wincent Colaiuta wrote:

> El 28/3/2008, a las 14:01, Johannes Schindelin escribió:
>
> >On Fri, 28 Mar 2008, Bryan Donlan wrote:
> >
> > >Pass --quiet to cpio in git-clone to hide the (confusing) "0 blocks"
> > >message. For compatibility with operating systems which might not
> > >support GNUisms, the presence of --quiet is probed for by grepping
> > >cpio's --help output.
> >
> >We have a builtin clone which is almost ready for 'next', and I think
> >that this issue would be resolved there anyway.
>
> In any case, I'd rather see the cpio check at configure-time rather than
> run-time.

That would have to be done via ./configure, missing out those people who
do not run ./configure, but just make.

Ciao,
Dscho
Bryan Donlan
2008-03-28 18:59:12 UTC
Permalink
On Fri, Mar 28, 2008 at 12:29 PM, Johannes Schindelin
<***@gmx.de> wrote:
> Hi,
>
>
> On Fri, 28 Mar 2008, Wincent Colaiuta wrote:
>
> > El 28/3/2008, a las 14:01, Johannes Schindelin escribi=F3:
> >
> > >On Fri, 28 Mar 2008, Bryan Donlan wrote:
> > >
> > > >Pass --quiet to cpio in git-clone to hide the (confusing) "0 bl=
ocks"
> > > >message. For compatibility with operating systems which might n=
ot
> > > >support GNUisms, the presence of --quiet is probed for by grepp=
ing
> > > >cpio's --help output.
> > >
> > >We have a builtin clone which is almost ready for 'next', and I t=
hink
> > >that this issue would be resolved there anyway.
> >
> > In any case, I'd rather see the cpio check at configure-time rathe=
r than
> > run-time.
>
> That would have to be done via ./configure, missing out those people=
who
> do not run ./configure, but just make.

Some distributions don't run configure either, including debian (and
by extension, likely ubuntu). That said, if git-clone's going builtin
anyway, we might as well wait for that :)
Junio C Hamano
2008-03-31 00:19:04 UTC
Permalink
Johannes Schindelin <***@gmx.de> writes:

> On Fri, 28 Mar 2008, Wincent Colaiuta wrote:
>
>> El 28/3/2008, a las 14:01, Johannes Schindelin escribi=C3=B3:
>>=20
>> >On Fri, 28 Mar 2008, Bryan Donlan wrote:
>> >
>> > >Pass --quiet to cpio in git-clone to hide the (confusing) "0 bloc=
ks"=20
>> > >message. For compatibility with operating systems which might not=
=20
>> > >support GNUisms, the presence of --quiet is probed for by greppin=
g=20
>> > >cpio's --help output.
>> >
>> >We have a builtin clone which is almost ready for 'next', and I thi=
nk=20
>> >that this issue would be resolved there anyway.
>>=20
>> In any case, I'd rather see the cpio check at configure-time rather =
than=20
>> run-time.
>
> That would have to be done via ./configure, missing out those people =
who=20
> do not run ./configure, but just make.

Runtime is just fine for this case. Unlike other commands, clone is no=
t
something you run all the time. Anything more elaborate is just
overengineered.
Bryan Donlan
2008-04-09 01:29:56 UTC
Permalink
This patch series fixes bugs in git and git's testsuite to allow all tests
to pass when the working directory contains whitespace and/or shell
metacharacters.

The first three patches in this series fix bugs in git itself that were
uncovered in the process of fixing the test suite. Each contains additional
tests and/or updates to existing tests to exercise the bug in question.

The remaining patches fix bugs in the test suite itself.

Bryan Donlan (8):
git-rebase.sh: Fix --merge --abort failures when path contains
whitespace
config.c: Escape backslashes in section names properly
git-send-email.perl: Handle shell metacharacters in $EDITOR properly
test-lib.sh: Handle properly cases where the git checkout path
contains whitespace
test-lib.sh: Add a test_set_editor function to safely set $VISUAL
lib-git-svn.sh: Handle paths with shell metacharacters correctly
Use test_set_editor in t9001-send-email.sh
Fix tests breaking when checkout path contains shell metacharacters

config.c | 2 +-
git-rebase.sh | 4 +-
git-send-email.perl | 2 +-
t/lib-git-svn.sh | 11 +++--
t/t0000-basic.sh | 4 +-
t/t0001-init.sh | 2 +-
t/t1020-subdirectory.sh | 24 +++++-----
t/t1303-wacky-config.sh | 6 +++
t/t1501-worktree.sh | 14 +++---
t/t3050-subprojects-fetch.sh | 2 +-
t/t3404-rebase-interactive.sh | 3 +-
t/t3407-rebase-abort.sh | 55 ++++++++++++++----------
t/t5500-fetch-pack.sh | 2 +-
t/t5512-ls-remote.sh | 2 +-
t/t5516-fetch-push.sh | 8 ++--
t/t5700-clone-reference.sh | 4 +-
t/t5710-info-alternate.sh | 4 +-
t/t7003-filter-branch.sh | 4 +-
t/t7010-setup.sh | 2 +-
t/t7300-clean.sh | 2 +-
t/t7501-commit.sh | 8 ++--
t/t7504-commit-msg-hook.sh | 20 +++++-----
t/t7505-prepare-commit-msg-hook.sh | 14 +++---
t/t9001-send-email.sh | 5 +-
t/t9100-git-svn-basic.sh | 54 ++++++++++++------------
t/t9101-git-svn-props.sh | 6 +-
t/t9102-git-svn-deep-rmdir.sh | 6 +-
t/t9103-git-svn-tracked-directory-removed.sh | 30 +++++++-------
t/t9104-git-svn-follow-parent.sh | 50 +++++++++++-----------
t/t9105-git-svn-commit-diff.sh | 12 +++---
t/t9106-git-svn-commit-diff-clobber.sh | 14 +++---
t/t9106-git-svn-dcommit-clobber-series.sh | 6 +-
t/t9107-git-svn-migrate.sh | 48 +++++++++++-----------
t/t9108-git-svn-glob.sh | 8 ++--
t/t9110-git-svn-use-svm-props.sh | 8 ++--
t/t9111-git-svn-use-svnsync-props.sh | 8 ++--
t/t9112-git-svn-md5less-file.sh | 4 +-
t/t9113-git-svn-dcommit-new-file.sh | 6 +-
t/t9114-git-svn-dcommit-merge.sh | 4 +-
t/t9115-git-svn-dcommit-funky-renames.sh | 4 +-
t/t9116-git-svn-log.sh | 4 +-
t/t9117-git-svn-init-clone.sh | 10 ++--
t/t9118-git-svn-funky-branch-names.sh | 12 +++---
t/t9120-git-svn-clone-with-percent-escapes.sh | 2 +-
t/t9500-gitweb-standalone-no-errors.sh | 13 +++---
t/test-lib.sh | 11 +++++-
46 files changed, 275 insertions(+), 249 deletions(-)
Bryan Donlan
2008-04-09 01:29:57 UTC
Permalink
Also update t/t3407-rebase-abort.sh to exercise the bug

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
git-rebase.sh | 4 +-
t/t3407-rebase-abort.sh | 55 +++++++++++++++++++++++++++-------------------
2 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index 60c458f..389b5cb 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -42,7 +42,7 @@ To restore the original branch and stop rebasing run \"git rebase --abort\".
unset newbase
strategy=recursive
do_merge=
-dotest=$GIT_DIR/.dotest-merge
+dotest="$GIT_DIR/.dotest-merge"
prec=4
verbose=
git_am_opt=
@@ -214,7 +214,7 @@ do
else
die "No rebase in progress?"
fi
- git reset --hard $(cat $dotest/orig-head)
+ git reset --hard $(cat "$dotest/orig-head")
rm -r "$dotest"
exit
;;
diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh
index 37944c3..396a354 100755
--- a/t/t3407-rebase-abort.sh
+++ b/t/t3407-rebase-abort.sh
@@ -4,7 +4,13 @@ test_description='git rebase --abort tests'

. ./test-lib.sh

+### Test that we handle strange characters properly
+work_dir="$(pwd)/test \" ' \$ \\ dir"
+
test_expect_success setup '
+ mkdir -p "$work_dir" &&
+ cd "$work_dir" &&
+ git init &&
echo a > a &&
git add a &&
git commit -m a &&
@@ -27,42 +33,45 @@ testrebase() {
type=$1
dotest=$2

- test_expect_success "rebase$type --abort" '
+ test_expect_success "rebase$type --abort" "
+ cd \"\$work_dir\" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d \"\$dotest\" &&
git rebase --abort &&
- test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
- '
+ test \$(git rev-parse to-rebase) = \$(git rev-parse pre-rebase) &&
+ test ! -d \"\$dotest\"
+ "

- test_expect_success "rebase$type --abort after --skip" '
+ test_expect_success "rebase$type --abort after --skip" "
+ cd \"\$work_dir\" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d \"\$dotest\" &&
test_must_fail git rebase --skip &&
- test $(git rev-parse HEAD) = $(git rev-parse master) &&
+ test \$(git rev-parse HEAD) = \$(git rev-parse master) &&
git-rebase --abort &&
- test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
- '
+ test \$(git rev-parse to-rebase) = \$(git rev-parse pre-rebase) &&
+ test ! -d \"\$dotest\"
+ "

- test_expect_success "rebase$type --abort after --continue" '
+ test_expect_success "rebase$type --abort after --continue" "
+ cd \"\$work_dir\" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d \"\$dotest\" &&
echo c > a &&
echo d >> a &&
git add a &&
test_must_fail git rebase --continue &&
- test $(git rev-parse HEAD) != $(git rev-parse master) &&
+ test \$(git rev-parse HEAD) != \$(git rev-parse master) &&
git rebase --abort &&
- test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
- '
+ test \$(git rev-parse to-rebase) = \$(git rev-parse pre-rebase) &&
+ test ! -d \"\$dotest\"
+ "
}

testrebase "" .dotest
--
1.5.5.8.gbbd98
Bryan Donlan
2008-04-09 01:30:04 UTC
Permalink
This fixes the remainder of the issues where the test script itself is at
fault for failing when the git checkout path contains whitespace or other
shell metacharacters.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/t0000-basic.sh | 4 +-
t/t0001-init.sh | 2 +-
t/t1020-subdirectory.sh | 24 +++++-----
t/t1501-worktree.sh | 14 +++---
t/t3050-subprojects-fetch.sh | 2 +-
t/t3404-rebase-interactive.sh | 3 +-
t/t5500-fetch-pack.sh | 2 +-
t/t5512-ls-remote.sh | 2 +-
t/t5516-fetch-push.sh | 8 ++--
t/t5700-clone-reference.sh | 4 +-
t/t5710-info-alternate.sh | 4 +-
t/t7003-filter-branch.sh | 4 +-
t/t7010-setup.sh | 2 +-
t/t7300-clean.sh | 2 +-
t/t7501-commit.sh | 8 ++--
t/t7504-commit-msg-hook.sh | 20 +++++-----
t/t7505-prepare-commit-msg-hook.sh | 14 +++---
t/t9100-git-svn-basic.sh | 54 ++++++++++++------------
t/t9101-git-svn-props.sh | 6 +-
t/t9102-git-svn-deep-rmdir.sh | 6 +-
t/t9103-git-svn-tracked-directory-removed.sh | 30 +++++++-------
t/t9104-git-svn-follow-parent.sh | 50 +++++++++++-----------
t/t9105-git-svn-commit-diff.sh | 12 +++---
t/t9106-git-svn-commit-diff-clobber.sh | 14 +++---
t/t9106-git-svn-dcommit-clobber-series.sh | 6 +-
t/t9107-git-svn-migrate.sh | 48 +++++++++++-----------
t/t9108-git-svn-glob.sh | 8 ++--
t/t9110-git-svn-use-svm-props.sh | 8 ++--
t/t9111-git-svn-use-svnsync-props.sh | 8 ++--
t/t9112-git-svn-md5less-file.sh | 4 +-
t/t9113-git-svn-dcommit-new-file.sh | 6 +-
t/t9114-git-svn-dcommit-merge.sh | 4 +-
t/t9115-git-svn-dcommit-funky-renames.sh | 4 +-
t/t9116-git-svn-log.sh | 4 +-
t/t9117-git-svn-init-clone.sh | 10 ++--
t/t9118-git-svn-funky-branch-names.sh | 12 +++---
t/t9120-git-svn-clone-with-percent-escapes.sh | 2 +-
t/t9500-gitweb-standalone-no-errors.sh | 13 +++---
38 files changed, 214 insertions(+), 214 deletions(-)

diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 27b54cb..690f80a 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -305,10 +305,10 @@ test_expect_success 'absolute path works as expected' '
file="$dir"/index &&
test "$file" = "$(test-absolute-path $dir2/index)" &&
basename=blub &&
- test "$dir/$basename" = $(cd .git && test-absolute-path $basename) &&
+ test "$dir/$basename" = "$(cd .git && test-absolute-path "$basename")" &&
ln -s ../first/file .git/syml &&
sym="$(cd first; pwd -P)"/file &&
- test "$sym" = "$(test-absolute-path $dir2/syml)"
+ test "$sym" = "$(test-absolute-path "$dir2/syml")"
'

test_expect_success 'very long name in the index handled sanely' '
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index b0289e3..22eb735 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -95,7 +95,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' '
(
unset GIT_CONFIG
mkdir git-dir-wt-1.git &&
- GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init
+ GIT_WORK_TREE="$(pwd)" GIT_DIR=git-dir-wt-1.git git init
) &&
check_config git-dir-wt-1.git false "$(pwd)"
'
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index b9cef34..20a1e82 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -16,12 +16,12 @@ test_expect_success setup '
cp one original.one &&
cp dir/two original.two
'
-HERE=`pwd`
+HERE="$(pwd)"
LF='
'

test_expect_success 'update-index and ls-files' '
- cd $HERE &&
+ cd "$HERE" &&
git update-index --add one &&
case "`git ls-files`" in
one) echo ok one ;;
@@ -41,7 +41,7 @@ test_expect_success 'update-index and ls-files' '
'

test_expect_success 'cat-file' '
- cd $HERE &&
+ cd "$HERE" &&
two=`git ls-files -s dir/two` &&
two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
echo "$two" &&
@@ -54,7 +54,7 @@ test_expect_success 'cat-file' '
rm -f actual dir/actual

test_expect_success 'diff-files' '
- cd $HERE &&
+ cd "$HERE" &&
echo a >>one &&
echo d >>dir/two &&
case "`git diff-files --name-only`" in
@@ -74,7 +74,7 @@ test_expect_success 'diff-files' '
'

test_expect_success 'write-tree' '
- cd $HERE &&
+ cd "$HERE" &&
top=`git write-tree` &&
echo $top &&
cd dir &&
@@ -84,7 +84,7 @@ test_expect_success 'write-tree' '
'

test_expect_success 'checkout-index' '
- cd $HERE &&
+ cd "$HERE" &&
git checkout-index -f -u one &&
cmp one original.one &&
cd dir &&
@@ -93,7 +93,7 @@ test_expect_success 'checkout-index' '
'

test_expect_success 'read-tree' '
- cd $HERE &&
+ cd "$HERE" &&
rm -f one dir/two &&
tree=`git write-tree` &&
git read-tree --reset -u "$tree" &&
@@ -107,27 +107,27 @@ test_expect_success 'read-tree' '
'

test_expect_success 'no file/rev ambiguity check inside .git' '
- cd $HERE &&
+ cd "$HERE" &&
git commit -a -m 1 &&
- cd $HERE/.git &&
+ cd "$HERE"/.git &&
git show -s HEAD
'

test_expect_success 'no file/rev ambiguity check inside a bare repo' '
- cd $HERE &&
+ cd "$HERE" &&
git clone -s --bare .git foo.git &&
cd foo.git && GIT_DIR=. git show -s HEAD
'

# This still does not work as it should...
: test_expect_success 'no file/rev ambiguity check inside a bare repo' '
- cd $HERE &&
+ cd "$HERE" &&
git clone -s --bare .git foo.git &&
cd foo.git && git show -s HEAD
'

test_expect_success 'detection should not be fooled by a symlink' '
- cd $HERE &&
+ cd "$HERE" &&
rm -fr foo.git &&
git clone -s .git another &&
ln -s another yetanother &&
diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh
index 7ee3820..ffb77b6 100755
--- a/t/t1501-worktree.sh
+++ b/t/t1501-worktree.sh
@@ -48,8 +48,8 @@ test_rev_parse 'subdirectory' false false true sub/dir/
cd ../../.. || exit 1

say "core.worktree = absolute path"
-export GIT_DIR=$(pwd)/repo.git
-export GIT_CONFIG=$GIT_DIR/config
+export GIT_DIR="$(pwd)/repo.git"
+export GIT_CONFIG="$GIT_DIR/config"
git config core.worktree "$(pwd)/work"
test_rev_parse 'outside' false false false
cd work || exit 1
@@ -59,8 +59,8 @@ test_rev_parse 'subdirectory' false false true sub/dir/
cd ../../.. || exit 1

say "GIT_WORK_TREE=relative path (override core.worktree)"
-export GIT_DIR=$(pwd)/repo.git
-export GIT_CONFIG=$GIT_DIR/config
+export GIT_DIR="$(pwd)/repo.git"
+export GIT_CONFIG="$GIT_DIR/config"
git config core.worktree non-existent
export GIT_WORK_TREE=work
test_rev_parse 'outside' false false false
@@ -75,9 +75,9 @@ cd ../../.. || exit 1
mv work repo.git/work

say "GIT_WORK_TREE=absolute path, work tree below git dir"
-export GIT_DIR=$(pwd)/repo.git
-export GIT_CONFIG=$GIT_DIR/config
-export GIT_WORK_TREE=$(pwd)/repo.git/work
+export GIT_DIR="$(pwd)/repo.git"
+export GIT_CONFIG="$GIT_DIR/config"
+export GIT_WORK_TREE="$(pwd)/repo.git/work"
test_rev_parse 'outside' false false false
cd repo.git || exit 1
test_rev_parse 'in repo.git' false true false
diff --git a/t/t3050-subprojects-fetch.sh b/t/t3050-subprojects-fetch.sh
index 2b21b10..4261e96 100755
--- a/t/t3050-subprojects-fetch.sh
+++ b/t/t3050-subprojects-fetch.sh
@@ -20,7 +20,7 @@ test_expect_success setup '
'

test_expect_success clone '
- git clone file://`pwd`/.git cloned &&
+ git clone "file://$(pwd)/.git" cloned &&
(git rev-parse HEAD; git ls-files -s) >expected &&
(
cd cloned &&
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 9cf873f..b9e3dbd 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -91,9 +91,8 @@ for line in $FAKE_LINES; do
done
EOF

+test_set_editor "$(pwd)/fake-editor.sh"
chmod a+x fake-editor.sh
-VISUAL="$(pwd)/fake-editor.sh"
-export VISUAL

test_expect_success 'no changes are a nop' '
git rebase -i F &&
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 788b4a5..c52707b 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -129,7 +129,7 @@ pull_to_client 2nd "B" $((64*3))

pull_to_client 3rd "A" $((1*3)) # old fails

-test_expect_success "clone shallow" "git-clone --depth 2 file://`pwd`/. shallow"
+test_expect_success "clone shallow" 'git-clone --depth 2 "file://$(pwd)/." shallow'

(cd shallow; git count-objects -v) > count.shallow

diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index c0dc949..1dd8eed 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -17,7 +17,7 @@ test_expect_success setup '
git show-ref -d | sed -e "s/ / /"
) >expected.all &&

- git remote add self $(pwd)/.git
+ git remote add self "$(pwd)/.git"

'

diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 793ffc6..6e8cb9e 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -103,9 +103,9 @@ test_expect_success 'fetch with wildcard' '
test_expect_success 'fetch with insteadOf' '
mk_empty &&
(
- TRASH=$(pwd) &&
+ TRASH="$(pwd)" &&
cd testrepo &&
- git config url./$TRASH/.insteadOf trash/
+ git config "url./$TRASH/.insteadOf" trash/ &&
git config remote.up.url trash/. &&
git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
git fetch up &&
@@ -145,8 +145,8 @@ test_expect_success 'push with wildcard' '

test_expect_success 'push with insteadOf' '
mk_empty &&
- TRASH=$(pwd) &&
- git config url./$TRASH/.insteadOf trash/ &&
+ TRASH="$(pwd)" &&
+ git config "url./$TRASH/.insteadOf" trash/ &&
git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
(
cd testrepo &&
diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh
index b6a5486..82ef023 100755
--- a/t/t5700-clone-reference.sh
+++ b/t/t5700-clone-reference.sh
@@ -6,7 +6,7 @@
test_description='test clone --reference'
. ./test-lib.sh

-base_dir=`pwd`
+base_dir="$(pwd)"

test_expect_success 'preparing first repository' \
'test_create_repo A && cd A &&
@@ -51,7 +51,7 @@ diff expected current'
cd "$base_dir"

test_expect_success 'cloning with reference (no -l -s)' \
-'git clone --reference B file://`pwd`/A D'
+'git clone --reference B "file://$(pwd)/A" D'

cd "$base_dir"

diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh
index 910ccb4..8f26999 100755
--- a/t/t5710-info-alternate.sh
+++ b/t/t5710-info-alternate.sh
@@ -21,7 +21,7 @@ test_valid_repo() {
test `wc -l < fsck.log` = 0
}

-base_dir=`pwd`
+base_dir="$(pwd)"

test_expect_success 'preparing first repository' \
'test_create_repo A && cd A &&
@@ -81,7 +81,7 @@ test_valid_repo'
cd "$base_dir"

test_expect_success 'breaking of loops' \
-"echo '$base_dir/B/.git/objects' >> '$base_dir'/A/.git/objects/info/alternates&&
+"echo \"\$base_dir\"/B/.git/objects >> \"\$base_dir\"/A/.git/objects/info/alternates&&
cd C &&
test_valid_repo"

diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index efd658a..abe3d83 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -123,9 +123,9 @@ test_expect_success 'use index-filter to move into a subdirectory' '
git branch directorymoved &&
git-filter-branch -f --index-filter \
"git ls-files -s | sed \"s-\\t-&newsubdir/-\" |
- GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \
+ GIT_INDEX_FILE=\"\$GIT_INDEX_FILE.new\" \
git update-index --index-info &&
- mv \$GIT_INDEX_FILE.new \$GIT_INDEX_FILE" directorymoved &&
+ mv \"\$GIT_INDEX_FILE.new\" \"\$GIT_INDEX_FILE\"" directorymoved &&
test -z "$(git diff HEAD directorymoved:newsubdir)"'

test_expect_success 'stops when msg filter fails' '
diff --git a/t/t7010-setup.sh b/t/t7010-setup.sh
index 02cf7c5..d8a7c79 100755
--- a/t/t7010-setup.sh
+++ b/t/t7010-setup.sh
@@ -122,7 +122,7 @@ test_expect_success 'commit using absolute path names' '

test_expect_success 'log using absolute path names' '
echo bb >>a/b/c/d &&
- git commit -m "bb" $(pwd)/a/b/c/d &&
+ git commit -m "bb" "$(pwd)/a/b/c/d" &&

git log a/b/c/d >f1.txt &&
git log "$(pwd)/a/b/c/d" >f2.txt &&
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index afccfc9..54b1352 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -111,7 +111,7 @@ test_expect_success 'git-clean with absolute path' '
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
would_clean=$(
cd docs &&
- git clean -n $(pwd)/../src |
+ git clean -n "$(pwd)/../src" |
sed -n -e "s|^Would remove ||p"
) &&
test "$would_clean" = ../src/part3.c || {
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index c0288f3..e5fdb63 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -79,8 +79,8 @@ test_expect_success \

cat >editor <<\EOF
#!/bin/sh
-sed -e "s/a file/an amend commit/g" < $1 > $1-
-mv $1- $1
+sed -e "s/a file/an amend commit/g" < "$1" > "$1-"
+mv "$1-" "$1"
EOF
chmod 755 editor

@@ -99,8 +99,8 @@ test_expect_success \

cat >editor <<\EOF
#!/bin/sh
-sed -e "s/amend/older/g" < $1 > $1-
-mv $1- $1
+sed -e "s/amend/older/g" < "$1" > "$1-"
+mv "$1-" "$1"
EOF
chmod 755 editor

diff --git a/t/t7504-commit-msg-hook.sh b/t/t7504-commit-msg-hook.sh
index eff36aa..24f6b2e 100755
--- a/t/t7504-commit-msg-hook.sh
+++ b/t/t7504-commit-msg-hook.sh
@@ -27,7 +27,7 @@ test_expect_success 'with no hook (editor)' '
echo "more foo" >> file &&
git add file &&
echo "more foo" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit

'

@@ -44,7 +44,7 @@ test_expect_success '--no-verify with no hook (editor)' '
echo "more bar" > file &&
git add file &&
echo "more bar" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -71,7 +71,7 @@ test_expect_success 'with succeeding hook (editor)' '
echo "more more" >> file &&
git add file &&
echo "more more" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit

'

@@ -88,7 +88,7 @@ test_expect_success '--no-verify with succeeding hook (editor)' '
echo "even more more" >> file &&
git add file &&
echo "even more more" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -111,7 +111,7 @@ test_expect_success 'with failing hook (editor)' '
echo "more another" >> file &&
git add file &&
echo "more another" > FAKE_MSG &&
- ! (GIT_EDITOR="$FAKE_EDITOR" git commit)
+ ! (GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit)

'

@@ -128,7 +128,7 @@ test_expect_success '--no-verify with failing hook (editor)' '
echo "more stuff" >> file &&
git add file &&
echo "more stuff" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -146,7 +146,7 @@ test_expect_success 'with non-executable hook (editor)' '
echo "content again" >> file &&
git add file &&
echo "content again" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit -m "content again"
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -m "content again"

'

@@ -163,7 +163,7 @@ test_expect_success '--no-verify with non-executable hook (editor)' '
echo "even more content" >> file &&
git add file &&
echo "even more content" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -193,7 +193,7 @@ test_expect_success 'hook edits commit message (editor)' '
echo "additional content" >> file &&
git add file &&
echo "additional content" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit &&
commit_msg_is "new message"

'
@@ -212,7 +212,7 @@ test_expect_success "hook doesn't edit commit message (editor)" '
echo "more plus" >> file &&
git add file &&
echo "more plus" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify &&
commit_msg_is "more plus"

'
diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh
index 802aa62..bc2bad9 100755
--- a/t/t7505-prepare-commit-msg-hook.sh
+++ b/t/t7505-prepare-commit-msg-hook.sh
@@ -58,7 +58,7 @@ test_expect_success 'with hook (-m editor)' '

echo "more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit -e -m "more more" &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -e -m "more more" &&
test "`git log -1 --pretty=format:%s`" = message

'
@@ -85,7 +85,7 @@ test_expect_success 'with hook (-F editor)' '

echo "more" >> file &&
git add file &&
- (echo more more | GIT_EDITOR="$FAKE_EDITOR" git commit -e -F -) &&
+ (echo more more | GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -e -F -) &&
test "`git log -1 --pretty=format:%s`" = message

'
@@ -104,7 +104,7 @@ test_expect_success 'with hook (editor)' '

echo "more more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit &&
test "`git log -1 --pretty=format:%s`" = default

'
@@ -114,7 +114,7 @@ test_expect_success 'with hook (--amend)' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --amend &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --amend &&
test "`git log -1 --pretty=format:%s`" = "$head"

'
@@ -124,7 +124,7 @@ test_expect_success 'with hook (-c)' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit -c $head &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head &&
test "`git log -1 --pretty=format:%s`" = "$head"

'
@@ -139,7 +139,7 @@ test_expect_success 'with failing hook' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- ! GIT_EDITOR="$FAKE_EDITOR" git commit -c $head
+ ! GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head

'

@@ -148,7 +148,7 @@ test_expect_success 'with failing hook (--no-verify)' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- ! GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify -c $head
+ ! GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify -c $head

'

diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 4e24ab3..528c0a9 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -31,16 +31,16 @@ test_expect_success \
echo 'zzz' > bar/zzz &&
echo '#!/bin/sh' > exec.sh &&
chmod +x exec.sh &&
- svn import -m 'import for git-svn' . $svnrepo >/dev/null &&
+ svn import -m 'import for git-svn' . \"\$svnrepo\" >/dev/null &&
cd .. &&
rm -rf import &&
- git-svn init $svnrepo"
+ git-svn init \"\$svnrepo\""

test_expect_success \
'import an SVN revision into git' \
'git-svn fetch'

-test_expect_success "checkout from svn" "svn co $svnrepo '$SVN_TREE'"
+test_expect_success "checkout from svn" "svn co \"\$svnrepo\" \"\$SVN_TREE\""

name='try a deep --rmdir with a commit'
test_expect_success "$name" "
@@ -51,8 +51,8 @@ test_expect_success "$name" "
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch &&
- svn up '$SVN_TREE' &&
- test -d '$SVN_TREE'/dir && test ! -d '$SVN_TREE'/dir/a"
+ svn up \"\$SVN_TREE\" &&
+ test -d \"\$SVN_TREE\"/dir && test ! -d \"\$SVN_TREE\"/dir/a"


name='detect node change from file to directory #1'
@@ -69,7 +69,7 @@ test_expect_success "$name" "

name='detect node change from directory to file #1'
test_expect_success "$name" "
- rm -rf dir '$GIT_DIR'/index &&
+ rm -rf dir \"\$GIT_DIR\"/index &&
git checkout -f -b mybranch2 remotes/git-svn &&
mv bar/zzz zzz &&
rm -rf bar &&
@@ -83,7 +83,7 @@ test_expect_success "$name" "

name='detect node change from file to directory #2'
test_expect_success "$name" "
- rm -f '$GIT_DIR'/index &&
+ rm -f \"\$GIT_DIR\"/index &&
git checkout -f -b mybranch3 remotes/git-svn &&
rm bar/zzz &&
git update-index --remove bar/zzz &&
@@ -97,7 +97,7 @@ test_expect_success "$name" "

name='detect node change from directory to file #2'
test_expect_success "$name" "
- rm -f '$GIT_DIR'/index &&
+ rm -f \"\$GIT_DIR\"/index &&
git checkout -f -b mybranch4 remotes/git-svn &&
rm -rf dir &&
git update-index --remove -- dir/file &&
@@ -111,15 +111,15 @@ test_expect_success "$name" "

name='remove executable bit from a file'
test_expect_success "$name" "
- rm -f '$GIT_DIR'/index &&
+ rm -f \"\$GIT_DIR\"/index &&
git checkout -f -b mybranch5 remotes/git-svn &&
chmod -x exec.sh &&
git update-index exec.sh &&
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test ! -x '$SVN_TREE'/exec.sh"
+ svn up \"\$SVN_TREE\" &&
+ test ! -x \"\$SVN_TREE\"/exec.sh"


name='add executable bit back file'
@@ -129,8 +129,8 @@ test_expect_success "$name" "
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -x '$SVN_TREE'/exec.sh"
+ svn up \"\$SVN_TREE\" &&
+ test -x \"\$SVN_TREE\"/exec.sh"


name='executable file becomes a symlink to bar/zzz (file)'
@@ -141,8 +141,8 @@ test_expect_success "$name" "
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -L '$SVN_TREE'/exec.sh"
+ svn up \"\$SVN_TREE\" &&
+ test -L \"\$SVN_TREE\"/exec.sh"

name='new symlink is added to a file that was also just made executable'

@@ -153,9 +153,9 @@ test_expect_success "$name" "
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -x '$SVN_TREE'/bar/zzz &&
- test -L '$SVN_TREE'/exec-2.sh"
+ svn up \"\$SVN_TREE\" &&
+ test -x \"\$SVN_TREE\"/bar/zzz &&
+ test -L \"\$SVN_TREE\"/exec-2.sh"

name='modify a symlink to become a file'
test_expect_success "$name" "
@@ -166,10 +166,10 @@ test_expect_success "$name" "
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -f '$SVN_TREE'/exec-2.sh &&
- test ! -L '$SVN_TREE'/exec-2.sh &&
- git diff help $SVN_TREE/exec-2.sh"
+ svn up \"\$SVN_TREE\" &&
+ test -f \"\$SVN_TREE\"/exec-2.sh &&
+ test ! -L \"\$SVN_TREE\"/exec-2.sh &&
+ git diff help \"\$SVN_TREE\"/exec-2.sh"

if test "$have_utf8" = t
then
@@ -190,7 +190,7 @@ name='test fetch functionality (svn => git) with alternate GIT_SVN_ID'
GIT_SVN_ID=alt
export GIT_SVN_ID
test_expect_success "$name" \
- "git-svn init $svnrepo && git-svn fetch &&
+ "git-svn init \"\$svnrepo\" && git-svn fetch &&
git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
git diff a b"
@@ -220,16 +220,16 @@ test_expect_success 'exit if remote refs are ambigious' "
"

test_expect_success 'exit if init-ing a would clobber a URL' "
- svnadmin create ${PWD}/svnrepo2 &&
- svn mkdir -m 'mkdir bar' ${svnrepo}2/bar &&
+ svnadmin create \"\${PWD}/svnrepo2\" &&
+ svn mkdir -m 'mkdir bar' \"\${svnrepo}2/bar\" &&
git config --unset svn-remote.svn.fetch \
'^bar:refs/remotes/git-svn$' &&
- ! git-svn init ${svnrepo}2/bar
+ ! git-svn init \"\${svnrepo}2/bar\"
"

test_expect_success \
'init allows us to connect to another directory in the same repo' "
- git-svn init --minimize-url -i bar $svnrepo/bar &&
+ git-svn init --minimize-url -i bar \"\$svnrepo/bar\" &&
git config --get svn-remote.svn.fetch \
'^bar:refs/remotes/bar$' &&
git config --get svn-remote.svn.fetch \
diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
index d7a7047..fa8b7ee 100755
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
@@ -52,7 +52,7 @@ EOF
cd ..

rm -rf import
-test_expect_success 'checkout working copy from svn' "svn co $svnrepo test_wc"
+test_expect_success 'checkout working copy from svn' "svn co \"\$svnrepo\" test_wc"
test_expect_success 'setup some commits to svn' \
'cd test_wc &&
echo Greetings >> kw.c &&
@@ -66,7 +66,7 @@ test_expect_success 'setup some commits to svn' \
svn commit -m "Propset Id" &&
cd ..'

-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' "git-svn init \"\$svnrepo\""
test_expect_success 'fetch revisions from svn' 'git-svn fetch'

name='test svn:keywords ignoring'
@@ -92,7 +92,7 @@ test_expect_success "propset CR on crlf files" \
test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
"git-svn fetch &&
git pull . remotes/git-svn &&
- svn co $svnrepo new_wc"
+ svn co \"\$svnrepo\" new_wc"

for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
do
diff --git a/t/t9102-git-svn-deep-rmdir.sh b/t/t9102-git-svn-deep-rmdir.sh
index 4e08083..8eaf7d3 100755
--- a/t/t9102-git-svn-deep-rmdir.sh
+++ b/t/t9102-git-svn-deep-rmdir.sh
@@ -9,12 +9,12 @@ test_expect_success 'initialize repo' "
mkdir -p deeply/nested/directory/number/2 &&
echo foo > deeply/nested/directory/number/1/file &&
echo foo > deeply/nested/directory/number/2/another &&
- svn import -m 'import for git-svn' . $svnrepo &&
+ svn import -m 'import for git-svn' . \"\$svnrepo\" &&
cd ..
"

test_expect_success 'mirror via git-svn' "
- git-svn init $svnrepo &&
+ git-svn init \"\$svnrepo\" &&
git-svn fetch &&
git checkout -f -b test-rmdir remotes/git-svn
"
@@ -23,7 +23,7 @@ test_expect_success 'Try a commit on rmdir' "
git rm -f deeply/nested/directory/number/2/another &&
git commit -a -m 'remove another' &&
git-svn set-tree --rmdir HEAD &&
- svn ls -R $svnrepo | grep ^deeply/nested/directory/number/1
+ svn ls -R \"\$svnrepo\" | grep ^deeply/nested/directory/number/1
"


diff --git a/t/t9103-git-svn-tracked-directory-removed.sh b/t/t9103-git-svn-tracked-directory-removed.sh
index 0f0b0fd..c7734e6 100755
--- a/t/t9103-git-svn-tracked-directory-removed.sh
+++ b/t/t9103-git-svn-tracked-directory-removed.sh
@@ -6,34 +6,34 @@
test_description='git-svn tracking removed top-level path'
. ./lib-git-svn.sh

-test_expect_success 'make history for tracking' '
+test_expect_success 'make history for tracking' "
mkdir import &&
mkdir import/trunk &&
echo hello >> import/trunk/README &&
- svn import -m initial import $svnrepo &&
+ svn import -m initial import \"\$svnrepo\" &&
rm -rf import &&
- svn co $svnrepo/trunk trunk &&
+ svn co \"\$svnrepo\"/trunk trunk &&
echo bye bye >> trunk/README &&
- svn rm -m "gone" $svnrepo/trunk &&
+ svn rm -m 'gone' \"\$svnrepo\"/trunk &&
rm -rf trunk &&
mkdir trunk &&
- echo "new" > trunk/FOLLOWME &&
- svn import -m "new trunk" trunk $svnrepo/trunk
-'
+ echo 'new' > trunk/FOLLOWME &&
+ svn import -m 'new trunk' trunk \"\$svnrepo\"/trunk
+"

-test_expect_success 'clone repo with git' '
- git svn clone -s $svnrepo x &&
+test_expect_success 'clone repo with git' "
+ git svn clone -s \"\$svnrepo\" x &&
test -f x/FOLLOWME &&
test ! -f x/README
-'
+"

-test_expect_success 'make sure r2 still has old file' '
+test_expect_success 'make sure r2 still has old file' "
cd x &&
- test -n "$(git svn find-rev r1)" &&
- git reset --hard $(git svn find-rev r1) &&
+ test -n \"\$(git svn find-rev r1)\" &&
+ git reset --hard \$(git svn find-rev r1) &&
test -f README &&
test ! -f FOLLOWME &&
- test x$(git svn find-rev r2) = x
-'
+ test x\$(git svn find-rev r2) = x
+"

test_done
diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index 7ba7630..56b1704 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -11,9 +11,9 @@ test_expect_success 'initialize repo' "
cd import &&
mkdir -p trunk &&
echo hello > trunk/readme &&
- svn import -m 'initial' . $svnrepo &&
+ svn import -m 'initial' . \"\$svnrepo\" &&
cd .. &&
- svn co $svnrepo wc &&
+ svn co \"\$svnrepo\" wc &&
cd wc &&
echo world >> trunk/readme &&
poke trunk/readme &&
@@ -27,7 +27,7 @@ test_expect_success 'initialize repo' "
"

test_expect_success 'init and fetch a moved directory' "
- git-svn init --minimize-url -i thunk $svnrepo/thunk &&
+ git-svn init --minimize-url -i thunk \"\$svnrepo\"/thunk &&
git-svn fetch -i thunk &&
test \"\`git rev-parse --verify refs/remotes/***@2\`\" \
= \"\`git rev-parse --verify refs/remotes/thunk~1\`\" &&
@@ -38,7 +38,7 @@ test_expect_success 'init and fetch a moved directory' "
"

test_expect_success 'init and fetch from one svn-remote' "
- git config svn-remote.svn.url $svnrepo &&
+ git config svn-remote.svn.url \"\$svnrepo\" &&
git config --add svn-remote.svn.fetch \
trunk:refs/remotes/svn/trunk &&
git config --add svn-remote.svn.fetch \
@@ -52,9 +52,9 @@ test_expect_success 'init and fetch from one svn-remote' "

test_expect_success 'follow deleted parent' "
(svn cp -m 'resurrecting trunk as junk' \
- $svnrepo/***@2 $svnrepo/junk ||
+ \"\$svnrepo\"/***@2 \"\$svnrepo\"/junk ||
svn cp -m 'resurrecting trunk as junk' \
- -r2 $svnrepo/trunk $svnrepo/junk) &&
+ -r2 \"\$svnrepo\"/trunk \"\$svnrepo\"/junk) &&
git config --add svn-remote.svn.fetch \
junk:refs/remotes/svn/junk &&
git-svn fetch -i svn/thunk &&
@@ -67,10 +67,10 @@ test_expect_success 'follow deleted parent' "
test_expect_success 'follow larger parent' "
mkdir -p import/trunk/thunk/bump/thud &&
echo hi > import/trunk/thunk/bump/thud/file &&
- svn import -m 'import a larger parent' import $svnrepo/larger-parent &&
- svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger &&
+ svn import -m 'import a larger parent' import \"\$svnrepo\"/larger-parent &&
+ svn cp -m 'hi' \"\$svnrepo\"/larger-parent \"\$svnrepo\"/another-larger &&
git-svn init --minimize-url -i larger \
- $svnrepo/another-larger/trunk/thunk/bump/thud &&
+ \"\$svnrepo\"/another-larger/trunk/thunk/bump/thud &&
git-svn fetch -i larger &&
git rev-parse --verify refs/remotes/larger &&
git rev-parse --verify \
@@ -83,23 +83,23 @@ test_expect_success 'follow larger parent' "
"

test_expect_success 'follow higher-level parent' "
- svn mkdir -m 'follow higher-level parent' $svnrepo/blob &&
- svn co $svnrepo/blob blob &&
+ svn mkdir -m 'follow higher-level parent' \"\$svnrepo\"/blob &&
+ svn co \"\$svnrepo\"/blob blob &&
cd blob &&
echo hi > hi &&
svn add hi &&
svn commit -m 'hihi' &&
cd ..
- svn mkdir -m 'new glob at top level' $svnrepo/glob &&
- svn mv -m 'move blob down a level' $svnrepo/blob $svnrepo/glob/blob &&
- git-svn init --minimize-url -i blob $svnrepo/glob/blob &&
+ svn mkdir -m 'new glob at top level' \"\$svnrepo\"/glob &&
+ svn mv -m 'move blob down a level' \"\$svnrepo\"/blob \"\$svnrepo\"/glob/blob &&
+ git-svn init --minimize-url -i blob \"\$svnrepo\"/glob/blob &&
git-svn fetch -i blob
"

test_expect_success 'follow deleted directory' "
- svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye &&
- svn rm -m 'remove glob' $svnrepo/glob &&
- git-svn init --minimize-url -i glob $svnrepo/glob &&
+ svn mv -m 'bye!' \"\$svnrepo\"/glob/blob/hi \"\$svnrepo\"/glob/blob/bye &&
+ svn rm -m 'remove glob' \"\$svnrepo\"/glob &&
+ git-svn init --minimize-url -i glob \"\$svnrepo\"/glob &&
git-svn fetch -i glob &&
test \"\`git cat-file blob refs/remotes/glob:blob/bye\`\" = hi &&
test \"\`git ls-tree refs/remotes/glob | wc -l \`\" -eq 1
@@ -118,9 +118,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
echo 'bad delete test 2' > \
import/trunk/subversion/bindings/swig/perl/another-larger &&
cd import &&
- svn import -m 'r9270 test' . $svnrepo/r9270 &&
+ svn import -m 'r9270 test' . \"\$svnrepo\"/r9270 &&
cd .. &&
- svn co $svnrepo/r9270/trunk/subversion/bindings/swig/perl r9270 &&
+ svn co \"\$svnrepo\"/r9270/trunk/subversion/bindings/swig/perl r9270 &&
cd r9270 &&
svn mkdir native &&
svn mv t native/t &&
@@ -130,7 +130,7 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
svn commit -m 'reorg test' &&
cd .. &&
git-svn init --minimize-url -i r9270-t \
- $svnrepo/r9270/trunk/subversion/bindings/swig/perl/native/t &&
+ \"\$svnrepo\"/r9270/trunk/subversion/bindings/swig/perl/native/t &&
git-svn fetch -i r9270-t &&
test \`git rev-list r9270-t | wc -l\` -eq 2 &&
test \"\`git ls-tree --name-only r9270-t~1\`\" = \
@@ -138,9 +138,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
"

test_expect_success "track initial change if it was only made to parent" "
- svn cp -m 'wheee!' $svnrepo/r9270/trunk $svnrepo/r9270/drunk &&
+ svn cp -m 'wheee!' \"\$svnrepo\"/r9270/trunk \"\$svnrepo\"/r9270/drunk &&
git-svn init --minimize-url -i r9270-d \
- $svnrepo/r9270/drunk/subversion/bindings/swig/perl/native/t &&
+ \"\$svnrepo\"/r9270/drunk/subversion/bindings/swig/perl/native/t &&
git-svn fetch -i r9270-d &&
test \`git rev-list r9270-d | wc -l\` -eq 3 &&
test \"\`git ls-tree --name-only r9270-t\`\" = \
@@ -150,7 +150,7 @@ test_expect_success "track initial change if it was only made to parent" "
"

test_expect_success "track multi-parent paths" "
- svn cp -m 'resurrect /glob' $svnrepo/r9270 $svnrepo/glob &&
+ svn cp -m 'resurrect /glob' \"\$svnrepo\"/r9270 \"\$svnrepo\"/glob &&
git-svn multi-fetch &&
test \`git cat-file commit refs/remotes/glob | \
grep '^parent ' | wc -l\` -eq 2
@@ -161,8 +161,8 @@ test_expect_success "multi-fetch continues to work" "
"

test_expect_success "multi-fetch works off a 'clean' repository" "
- rm -r $GIT_DIR/svn $GIT_DIR/refs/remotes $GIT_DIR/logs &&
- mkdir $GIT_DIR/svn &&
+ rm -r \"\$GIT_DIR/svn\" \"\$GIT_DIR/refs/remotes\" \"\$GIT_DIR/logs\" &&
+ mkdir \"\$GIT_DIR/svn\" &&
git-svn multi-fetch
"

diff --git a/t/t9105-git-svn-commit-diff.sh b/t/t9105-git-svn-commit-diff.sh
index 318e172..4f7f9cc 100755
--- a/t/t9105-git-svn-commit-diff.sh
+++ b/t/t9105-git-svn-commit-diff.sh
@@ -8,7 +8,7 @@ test_expect_success 'initialize repo' "
mkdir import &&
cd import &&
echo hello > readme &&
- svn import -m 'initial' . $svnrepo &&
+ svn import -m 'initial' . \"\$svnrepo\" &&
cd .. &&
echo hello > readme &&
git update-index --add readme &&
@@ -26,17 +26,17 @@ prev=`git rev-parse --verify HEAD^1`

test_expect_success 'test the commit-diff command' "
test -n '$prev' && test -n '$head' &&
- git-svn commit-diff -r1 '$prev' '$head' '$svnrepo' &&
- svn co $svnrepo wc &&
+ git-svn commit-diff -r1 '$prev' '$head' \"\$svnrepo\" &&
+ svn co \"\$svnrepo\" wc &&
cmp readme wc/readme
"

test_expect_success 'commit-diff to a sub-directory (with git-svn config)' "
- svn import -m 'sub-directory' import $svnrepo/subdir &&
- git-svn init --minimize-url $svnrepo/subdir &&
+ svn import -m 'sub-directory' import \"\$svnrepo\"/subdir &&
+ git-svn init --minimize-url \"\$svnrepo\"/subdir &&
git-svn fetch &&
git-svn commit-diff -r3 '$prev' '$head' &&
- svn cat $svnrepo/subdir/readme > readme.2 &&
+ svn cat \"\$svnrepo\"/subdir/readme > readme.2 &&
cmp readme readme.2
"

diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh
index f74ab12..bb544f6 100755
--- a/t/t9106-git-svn-commit-diff-clobber.sh
+++ b/t/t9106-git-svn-commit-diff-clobber.sh
@@ -8,14 +8,14 @@ test_expect_success 'initialize repo' "
mkdir import &&
cd import &&
echo initial > file &&
- svn import -m 'initial' . $svnrepo &&
+ svn import -m 'initial' . \"\$svnrepo\" &&
cd .. &&
echo initial > file &&
git update-index --add file &&
git commit -a -m 'initial'
"
test_expect_success 'commit change from svn side' "
- svn co $svnrepo t.svn &&
+ svn co \"\$svnrepo\" t.svn &&
cd t.svn &&
echo second line from svn >> file &&
poke file &&
@@ -27,7 +27,7 @@ test_expect_success 'commit change from svn side' "
test_expect_success 'commit conflicting change from git' "
echo second line from git >> file &&
git commit -a -m 'second line from git' &&
- ! git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
+ ! git-svn commit-diff -r1 HEAD~1 HEAD \"\$svnrepo\"
"

test_expect_success 'commit complementing change from git' "
@@ -36,14 +36,14 @@ test_expect_success 'commit complementing change from git' "
git commit -a -m 'second line from svn' &&
echo third line from git >> file &&
git commit -a -m 'third line from git' &&
- git-svn commit-diff -r2 HEAD~1 HEAD $svnrepo
+ git-svn commit-diff -r2 HEAD~1 HEAD \"\$svnrepo\"
"

test_expect_success 'dcommit fails to commit because of conflict' "
- git-svn init $svnrepo &&
+ git-svn init \"\$svnrepo\" &&
git-svn fetch &&
git reset --hard refs/remotes/git-svn &&
- svn co $svnrepo t.svn &&
+ svn co \"\$svnrepo\" t.svn &&
cd t.svn &&
echo fourth line from svn >> file &&
poke file &&
@@ -67,7 +67,7 @@ test_expect_success 'dcommit does the svn equivalent of an index merge' "
"

test_expect_success 'commit another change from svn side' "
- svn co $svnrepo t.svn &&
+ svn co \"\$svnrepo\" t.svn &&
cd t.svn &&
echo third line from svn >> file &&
poke file &&
diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh
index ca8a00e..477755a 100755
--- a/t/t9106-git-svn-dcommit-clobber-series.sh
+++ b/t/t9106-git-svn-dcommit-clobber-series.sh
@@ -8,9 +8,9 @@ test_expect_success 'initialize repo' "
mkdir import &&
cd import &&
awk 'BEGIN { for (i = 1; i < 64; i++) { print i } }' > file
- svn import -m 'initial' . $svnrepo &&
+ svn import -m 'initial' . \"\$svnrepo\" &&
cd .. &&
- git svn init $svnrepo &&
+ git svn init \"\$svnrepo\" &&
git svn fetch &&
test -e file
"
@@ -18,7 +18,7 @@ test_expect_success 'initialize repo' "
test_expect_success '(supposedly) non-conflicting change from SVN' "
test x\"\`sed -n -e 58p < file\`\" = x58 &&
test x\"\`sed -n -e 61p < file\`\" = x61 &&
- svn co $svnrepo tmp &&
+ svn co \"\$svnrepo\" tmp &&
cd tmp &&
perl -i -p -e 's/^58\$/5588/' file &&
perl -i -p -e 's/^61\$/6611/' file &&
diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
index 0a41d52..9ab7074 100755
--- a/t/t9107-git-svn-migrate.sh
+++ b/t/t9107-git-svn-migrate.sh
@@ -4,7 +4,7 @@ test_description='git-svn metadata migrations from previous versions'
. ./lib-git-svn.sh

test_expect_success 'setup old-looking metadata' "
- cp $GIT_DIR/config $GIT_DIR/config-old-git-svn &&
+ cp \"\$GIT_DIR\"/config \"\$GIT_DIR\"/config-old-git-svn &&
mkdir import &&
cd import &&
for i in trunk branches/a branches/b \
@@ -12,13 +12,13 @@ test_expect_success 'setup old-looking metadata' "
mkdir -p \$i && \
echo hello >> \$i/README || exit 1
done && \
- svn import -m test . $svnrepo
+ svn import -m test . \"\$svnrepo\"
cd .. &&
- git-svn init $svnrepo &&
+ git-svn init \"\$svnrepo\" &&
git-svn fetch &&
- mv $GIT_DIR/svn/* $GIT_DIR/ &&
- mv $GIT_DIR/svn/.metadata $GIT_DIR/ &&
- rmdir $GIT_DIR/svn &&
+ mv \"\$GIT_DIR\"/svn/* \"\$GIT_DIR\"/ &&
+ mv \"\$GIT_DIR\"/svn/.metadata \"\$GIT_DIR\"/ &&
+ rmdir \"\$GIT_DIR\"/svn &&
git update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn &&
git update-ref refs/heads/svn-HEAD refs/remotes/git-svn &&
git update-ref -d refs/remotes/git-svn refs/remotes/git-svn
@@ -28,20 +28,20 @@ head=`git rev-parse --verify refs/heads/git-svn-HEAD^0`
test_expect_success 'git-svn-HEAD is a real HEAD' "test -n '$head'"

test_expect_success 'initialize old-style (v0) git-svn layout' "
- mkdir -p $GIT_DIR/git-svn/info $GIT_DIR/svn/info &&
- echo $svnrepo > $GIT_DIR/git-svn/info/url &&
- echo $svnrepo > $GIT_DIR/svn/info/url &&
+ mkdir -p \"\$GIT_DIR\"/git-svn/info \"\$GIT_DIR\"/svn/info &&
+ echo \"\$svnrepo\" > \"\$GIT_DIR\"/git-svn/info/url &&
+ echo \"\$svnrepo\" > \"\$GIT_DIR\"/svn/info/url &&
git-svn migrate &&
- ! test -d $GIT_DIR/git-svn &&
+ ! test -d \"\$GIT_DIR\"/git-svn &&
git rev-parse --verify refs/remotes/git-svn^0 &&
git rev-parse --verify refs/remotes/svn^0 &&
- test \`git config --get svn-remote.svn.url\` = '$svnrepo' &&
+ test \"\$(git config --get svn-remote.svn.url)\" = \"\$svnrepo\" &&
test \`git config --get svn-remote.svn.fetch\` = \
':refs/remotes/git-svn'
"

test_expect_success 'initialize a multi-repository repo' "
- git-svn init $svnrepo -T trunk -t tags -b branches &&
+ git-svn init \"\$svnrepo\" -T trunk -t tags -b branches &&
git config --get-all svn-remote.svn.fetch > fetch.out &&
grep '^trunk:refs/remotes/trunk$' fetch.out &&
test -n \"\`git config --get svn-remote.svn.branches \
@@ -76,14 +76,14 @@ test_expect_success 'multi-fetch works on partial urls + paths' "
test_expect_success 'migrate --minimize on old inited layout' "
git config --unset-all svn-remote.svn.fetch &&
git config --unset-all svn-remote.svn.url &&
- rm -rf $GIT_DIR/svn &&
+ rm -rf \"\$GIT_DIR\"/svn &&
for i in \`cat fetch.out\`; do
path=\`expr \$i : '\\([^:]*\\):.*$'\`
ref=\`expr \$i : '[^:]*:refs/remotes/\\(.*\\)$'\`
if test -z \"\$ref\"; then continue; fi
if test -n \"\$path\"; then path=\"/\$path\"; fi
- ( mkdir -p $GIT_DIR/svn/\$ref/info/ &&
- echo $svnrepo\$path > $GIT_DIR/svn/\$ref/info/url ) || exit 1;
+ ( mkdir -p \"\$GIT_DIR\"/svn/\$ref/info/ &&
+ echo \"\$svnrepo\"\$path > \"\$GIT_DIR\"/svn/\$ref/info/url ) || exit 1;
done &&
git-svn migrate --minimize &&
test -z \"\`git config -l |grep -v '^svn-remote\.git-svn\.'\`\" &&
@@ -99,17 +99,17 @@ test_expect_success 'migrate --minimize on old inited layout' "

test_expect_success ".rev_db auto-converted to .rev_map.UUID" "
git-svn fetch -i trunk &&
- test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
- expect=\"\$(ls $GIT_DIR/svn/trunk/.rev_map.*)\" &&
+ test -z \"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_db.* 2>/dev/null)\" &&
+ expect=\"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_map.*)\" &&
test -n \"\$expect\" &&
- rev_db=\$(echo \$expect | sed -e 's,_map,_db,') &&
- convert_to_rev_db \$expect \$rev_db &&
- rm -f \$expect &&
- test -f \$rev_db &&
+ rev_db=\"\$(echo \$expect | sed -e 's,_map,_db,')\" &&
+ convert_to_rev_db \"\$expect\" \"\$rev_db\" &&
+ rm -f \"\$expect\" &&
+ test -f \"\$rev_db\" &&
git-svn fetch -i trunk &&
- test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
- test ! -e $GIT_DIR/svn/trunk/.rev_db &&
- test -f \$expect
+ test -z \"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_db.* 2>/dev/null)\" &&
+ test ! -e \"\$GIT_DIR\"/svn/trunk/.rev_db &&
+ test -f \"\$expect\"
"

test_done
diff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh
index db4344c..8f03f2d 100755
--- a/t/t9108-git-svn-glob.sh
+++ b/t/t9108-git-svn-glob.sh
@@ -14,8 +14,8 @@ test_expect_success 'test refspec globbing' "
mkdir -p trunk/src/a trunk/src/b trunk/doc &&
echo 'hello world' > trunk/src/a/readme &&
echo 'goodbye world' > trunk/src/b/readme &&
- svn import -m 'initial' trunk $svnrepo/trunk &&
- svn co $svnrepo tmp &&
+ svn import -m 'initial' trunk \"\$svnrepo\"/trunk &&
+ svn co \"\$svnrepo\" tmp &&
cd tmp &&
mkdir branches tags &&
svn add branches tags &&
@@ -38,7 +38,7 @@ test_expect_success 'test refspec globbing' "
poke tags/end/src/b/readme &&
svn commit -m 'nothing to see here'
cd .. &&
- git config --add svn-remote.svn.url $svnrepo &&
+ git config --add svn-remote.svn.url \"\$svnrepo\" &&
git config --add svn-remote.svn.fetch \
'trunk/src/a:refs/remotes/trunk' &&
git config --add svn-remote.svn.branches \
@@ -60,7 +60,7 @@ echo nothing to see here >> expect.two
cat expect.end >> expect.two

test_expect_success 'test left-hand-side only globbing' "
- git config --add svn-remote.two.url $svnrepo &&
+ git config --add svn-remote.two.url \"\$svnrepo\" &&
git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
git config --add svn-remote.two.branches \
'branches/*:refs/remotes/two/branches/*' &&
diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh
index 6235af4..d9ac558 100755
--- a/t/t9110-git-svn-use-svm-props.sh
+++ b/t/t9110-git-svn-use-svm-props.sh
@@ -8,11 +8,11 @@ test_description='git-svn useSvmProps test'
. ./lib-git-svn.sh

test_expect_success 'load svm repo' "
- svnadmin load -q $rawsvnrepo < ../t9110/svm.dump &&
- git-svn init --minimize-url -R arr -i bar $svnrepo/mirror/arr &&
- git-svn init --minimize-url -R argh -i dir $svnrepo/mirror/argh &&
+ svnadmin load -q \"\$rawsvnrepo\" < ../t9110/svm.dump &&
+ git-svn init --minimize-url -R arr -i bar \"\$svnrepo\"/mirror/arr &&
+ git-svn init --minimize-url -R argh -i dir \"\$svnrepo\"/mirror/argh &&
git-svn init --minimize-url -R argh -i e \
- $svnrepo/mirror/argh/a/b/c/d/e &&
+ \"\$svnrepo\"/mirror/argh/a/b/c/d/e &&
git config svn.useSvmProps true &&
git-svn fetch --all
"
diff --git a/t/t9111-git-svn-use-svnsync-props.sh b/t/t9111-git-svn-use-svnsync-props.sh
index ec7dedd..77185bc 100755
--- a/t/t9111-git-svn-use-svnsync-props.sh
+++ b/t/t9111-git-svn-use-svnsync-props.sh
@@ -8,10 +8,10 @@ test_description='git-svn useSvnsyncProps test'
. ./lib-git-svn.sh

test_expect_success 'load svnsync repo' "
- svnadmin load -q $rawsvnrepo < ../t9111/svnsync.dump &&
- git-svn init --minimize-url -R arr -i bar $svnrepo/bar &&
- git-svn init --minimize-url -R argh -i dir $svnrepo/dir &&
- git-svn init --minimize-url -R argh -i e $svnrepo/dir/a/b/c/d/e &&
+ svnadmin load -q \"\$rawsvnrepo\" < ../t9111/svnsync.dump &&
+ git-svn init --minimize-url -R arr -i bar \"\$svnrepo\"/bar &&
+ git-svn init --minimize-url -R argh -i dir \"\$svnrepo\"/dir &&
+ git-svn init --minimize-url -R argh -i e \"\$svnrepo\"/dir/a/b/c/d/e &&
git config svn.useSvnsyncProps true &&
git-svn fetch --all
"
diff --git a/t/t9112-git-svn-md5less-file.sh b/t/t9112-git-svn-md5less-file.sh
index 646a5f0..fb1491d 100755
--- a/t/t9112-git-svn-md5less-file.sh
+++ b/t/t9112-git-svn-md5less-file.sh
@@ -40,8 +40,8 @@ PROPS-END

EOF

-test_expect_success 'load svn dumpfile' "svnadmin load $rawsvnrepo < dumpfile.svn"
+test_expect_success 'load svn dumpfile' "svnadmin load \"\$rawsvnrepo\" < dumpfile.svn"

-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' "git-svn init \"\$svnrepo\""
test_expect_success 'fetch revisions from svn' 'git-svn fetch'
test_done
diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh
index 9ef0db9..b92a64e 100755
--- a/t/t9113-git-svn-dcommit-new-file.sh
+++ b/t/t9113-git-svn-dcommit-new-file.sh
@@ -15,14 +15,14 @@ test_description='git-svn dcommit new files over svn:// test'

start_svnserve () {
svnserve --listen-port $SVNSERVE_PORT \
- --root $rawsvnrepo \
+ --root "$rawsvnrepo" \
--listen-once \
--listen-host 127.0.0.1 &
}

test_expect_success 'start tracking an empty repo' "
- svn mkdir -m 'empty dir' $svnrepo/empty-dir &&
- echo anon-access = write >> $rawsvnrepo/conf/svnserve.conf &&
+ svn mkdir -m 'empty dir' \"\$svnrepo\"/empty-dir &&
+ echo anon-access = write >> \"\$rawsvnrepo\"/conf/svnserve.conf &&
start_svnserve &&
git svn init svn://127.0.0.1:$SVNSERVE_PORT &&
git svn fetch
diff --git a/t/t9114-git-svn-dcommit-merge.sh b/t/t9114-git-svn-dcommit-merge.sh
index 225060b..74b971c 100755
--- a/t/t9114-git-svn-dcommit-merge.sh
+++ b/t/t9114-git-svn-dcommit-merge.sh
@@ -35,7 +35,7 @@ EOF
}

test_expect_success 'setup svn repository' "
- svn co $svnrepo mysvnwork &&
+ svn co \"\$svnrepo\" mysvnwork &&
mkdir -p mysvnwork/trunk &&
cd mysvnwork &&
big_text_block >> trunk/README &&
@@ -45,7 +45,7 @@ test_expect_success 'setup svn repository' "
"

test_expect_success 'setup git mirror and merge' "
- git svn init $svnrepo -t tags -T trunk -b branches &&
+ git svn init \"\$svnrepo\" -t tags -T trunk -b branches &&
git svn fetch &&
git checkout --track -b svn remotes/trunk &&
git checkout -b merge &&
diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh
index 182299c..f83f4f9 100755
--- a/t/t9115-git-svn-dcommit-funky-renames.sh
+++ b/t/t9115-git-svn-dcommit-funky-renames.sh
@@ -8,12 +8,12 @@ test_description='git-svn dcommit can commit renames of files with ugly names'
. ./lib-git-svn.sh

test_expect_success 'load repository with strange names' "
- svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+ svnadmin load -q \"\$rawsvnrepo\" < ../t9115/funky-names.dump &&
start_httpd
"

test_expect_success 'init and fetch repository' "
- git svn init $svnrepo &&
+ git svn init \"\$svnrepo\" &&
git svn fetch &&
git reset --hard git-svn
"
diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh
index e1e8bdf..13081b8 100755
--- a/t/t9116-git-svn-log.sh
+++ b/t/t9116-git-svn-log.sh
@@ -14,9 +14,9 @@ test_expect_success 'setup repository and import' "
mkdir -p \$i && \
echo hello >> \$i/README || exit 1
done && \
- svn import -m test . $svnrepo
+ svn import -m test . \"\$svnrepo\"
cd .. &&
- git-svn init $svnrepo -T trunk -b branches -t tags &&
+ git-svn init \"\$svnrepo\" -T trunk -b branches -t tags &&
git-svn fetch &&
git reset --hard trunk &&
echo bye >> README &&
diff --git a/t/t9117-git-svn-init-clone.sh b/t/t9117-git-svn-init-clone.sh
index d482b40..c924915 100755
--- a/t/t9117-git-svn-init-clone.sh
+++ b/t/t9117-git-svn-init-clone.sh
@@ -16,13 +16,13 @@ cd tmp
test_expect_success 'setup svnrepo' "
mkdir project project/trunk project/branches project/tags &&
echo foo > project/trunk/foo &&
- svn import -m '$test_description' project $svnrepo/project &&
+ svn import -m '$test_description' project \"\$svnrepo\"/project &&
rm -rf project
"

test_expect_success 'basic clone' "
test ! -d trunk &&
- git svn clone $svnrepo/project/trunk &&
+ git svn clone \"\$svnrepo\"/project/trunk &&
test -d trunk/.git/svn &&
test -e trunk/foo &&
rm -rf trunk
@@ -30,7 +30,7 @@ test_expect_success 'basic clone' "

test_expect_success 'clone to target directory' "
test ! -d target &&
- git svn clone $svnrepo/project/trunk target &&
+ git svn clone \"\$svnrepo\"/project/trunk target &&
test -d target/.git/svn &&
test -e target/foo &&
rm -rf target
@@ -38,7 +38,7 @@ test_expect_success 'clone to target directory' "

test_expect_success 'clone with --stdlayout' "
test ! -d project &&
- git svn clone -s $svnrepo/project &&
+ git svn clone -s \"\$svnrepo\"/project &&
test -d project/.git/svn &&
test -e project/foo &&
rm -rf project
@@ -46,7 +46,7 @@ test_expect_success 'clone with --stdlayout' "

test_expect_success 'clone to target directory with --stdlayout' "
test ! -d target &&
- git svn clone -s $svnrepo/project target &&
+ git svn clone -s \"\$svnrepo\"/project target &&
test -d target/.git/svn &&
test -e target/foo &&
rm -rf target
diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
index 640bb06..0f107fc 100755
--- a/t/t9118-git-svn-funky-branch-names.sh
+++ b/t/t9118-git-svn-funky-branch-names.sh
@@ -9,17 +9,17 @@ test_description='git-svn funky branch names'
test_expect_success 'setup svnrepo' "
mkdir project project/trunk project/branches project/tags &&
echo foo > project/trunk/foo &&
- svn import -m '$test_description' project \"$svnrepo/pr ject\" &&
+ svn import -m '\$test_description' project \"\$svnrepo/pr ject\" &&
rm -rf project &&
- svn cp -m 'fun' \"$svnrepo/pr ject/trunk\" \
- \"$svnrepo/pr ject/branches/fun plugin\" &&
- svn cp -m 'more fun!' \"$svnrepo/pr ject/branches/fun plugin\" \
- \"$svnrepo/pr ject/branches/more fun plugin!\" &&
+ svn cp -m 'fun' \"\$svnrepo/pr ject/trunk\" \
+ \"\$svnrepo/pr ject/branches/fun plugin\" &&
+ svn cp -m 'more fun!' \"\$svnrepo/pr ject/branches/fun plugin\" \
+ \"\$svnrepo/pr ject/branches/more fun plugin!\" &&
start_httpd
"

test_expect_success 'test clone with funky branch names' "
- git svn clone -s \"$svnrepo/pr ject\" project &&
+ git svn clone -s \"\$svnrepo/pr ject\" project &&
cd project &&
git rev-parse 'refs/remotes/fun%20plugin' &&
git rev-parse 'refs/remotes/more%20fun%20plugin!' &&
diff --git a/t/t9120-git-svn-clone-with-percent-escapes.sh b/t/t9120-git-svn-clone-with-percent-escapes.sh
index 9a4eabe..1414c0f 100755
--- a/t/t9120-git-svn-clone-with-percent-escapes.sh
+++ b/t/t9120-git-svn-clone-with-percent-escapes.sh
@@ -9,7 +9,7 @@ test_description='git-svn clone with percent escapes'
test_expect_success 'setup svnrepo' "
mkdir project project/trunk project/branches project/tags &&
echo foo > project/trunk/foo &&
- svn import -m '$test_description' project '$svnrepo/pr ject' &&
+ svn import -m \"\$test_description\" project \"\$svnrepo/pr ject\" &&
rm -rf project &&
start_httpd
"
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index 796cd7d..0f36e6c 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -10,6 +10,7 @@ commandline, and checks that it would not write any errors
or warnings to log.'

gitweb_init () {
+ safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
cat >gitweb_config.perl <<EOF
#!/usr/bin/perl

@@ -17,16 +18,16 @@ gitweb_init () {

our \$version = "current";
our \$GIT = "git";
-our \$projectroot = "$(pwd)";
+our \$projectroot = "$safe_pwd";
our \$project_maxdepth = 8;
our \$home_link_str = "projects";
our \$site_name = "[localhost]";
our \$site_header = "";
our \$site_footer = "";
our \$home_text = "indextext.html";
-our @stylesheets = ("file:///$(pwd)/../../gitweb/gitweb.css");
-our \$logo = "file:///$(pwd)/../../gitweb/git-logo.png";
-our \$favicon = "file:///$(pwd)/../../gitweb/git-favicon.png";
+our @stylesheets = ("file:///$safe_pwd/../../gitweb/gitweb.css");
+our \$logo = "file:///$safe_pwd/../../gitweb/git-logo.png";
+our \$favicon = "file:///$safe_pwd/../../gitweb/git-favicon.png";
our \$projects_list = "";
our \$export_ok = "";
our \$strict_export = "";
@@ -45,13 +46,13 @@ gitweb_run () {
export QUERY_STRING=""$1""
export PATH_INFO=""$2""

- export GITWEB_CONFIG=$(pwd)/gitweb_config.perl
+ export GITWEB_CONFIG="$(pwd)/gitweb_config.perl"

# some of git commands write to STDERR on error, but this is not
# written to web server logs, so we are not interested in that:
# we are interested only in properly formatted errors/warnings
rm -f gitweb.log &&
- perl -- $(pwd)/../../gitweb/gitweb.perl \
+ perl -- "$(pwd)/../../gitweb/gitweb.perl" \
>/dev/null 2>gitweb.log &&
if grep -q -s "^[[]" gitweb.log >/dev/null; then false; else true; fi

--
1.5.5.8.gbbd98
Johannes Sixt
2008-04-10 06:49:03 UTC
Permalink
Bryan Donlan schrieb:
> (did you mean to send the original reply to the list as well? not ccing for
> now, feel free to re-send/forward to the list if you like)

Sorry, yes, I hit the wrong button. I'm lazy again and simply resend this
reply with the complete Cc list, with everything quoted.

> On Wed, Apr 09, 2008 at 09:01:12AM +0200, Johannes Sixt wrote:
>> Bryan Donlan schrieb:
>>> - GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init
>>> + GIT_WORK_TREE="$(pwd)" GIT_DIR=git-dir-wt-1.git git init
>> This ...
>>
>>> -HERE=`pwd`
>>> +HERE="$(pwd)"
>> ... and this and a lot of similar cases shouldn't be required: The RHS of
>> an assignment does not undergo word-splitting.
>
> Will fix.
>
>>> -export GIT_DIR=$(pwd)/repo.git
>>> -export GIT_CONFIG=$GIT_DIR/config
>>> +export GIT_DIR="$(pwd)/repo.git"
>>> +export GIT_CONFIG="$GIT_DIR/config"
>> This, OTOH, is not an assignment, and the change is to the better. But not
>> all shells support export with assignment. Hence this should be changed to
>> the form
>>
>> GIT_DIR=$(pwd)/repo.git
>> GIT_CONFIG=$GIT_DIR/config
>> export GIT_DIR GIT_CONFIG
>>
>> (and similar cases at other places).
>
> I'll break these bits out into another patch in the sequence and fix.
>
>>> test_expect_success ".rev_db auto-converted to .rev_map.UUID" "
>>> git-svn fetch -i trunk &&
>>> - test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
>>> - expect=\"\$(ls $GIT_DIR/svn/trunk/.rev_map.*)\" &&
>>> + test -z \"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_db.* 2>/dev/null)\" &&
>>> + expect=\"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_map.*)\" &&
>>> test -n \"\$expect\" &&
>>> - rev_db=\$(echo \$expect | sed -e 's,_map,_db,') &&
>>> - convert_to_rev_db \$expect \$rev_db &&
>>> - rm -f \$expect &&
>>> - test -f \$rev_db &&
>>> + rev_db=\"\$(echo \$expect | sed -e 's,_map,_db,')\" &&
>>> + convert_to_rev_db \"\$expect\" \"\$rev_db\" &&
>>> + rm -f \"\$expect\" &&
>>> + test -f \"\$rev_db\" &&
>>> git-svn fetch -i trunk &&
>>> - test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
>>> - test ! -e $GIT_DIR/svn/trunk/.rev_db &&
>>> - test -f \$expect
>>> + test -z \"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_db.* 2>/dev/null)\" &&
>>> + test ! -e \"\$GIT_DIR\"/svn/trunk/.rev_db &&
>>> + test -f \"\$expect\"
>>> "
>> While looking at this test: Wouldn't it be easier to just place the whole
>> thing (and probably similar cases, too) in single-quotes?
>
> To be honest, I fixed all the git-svn tests with a suitably clever vim s///
> expression, so at the time this way was actually easier :)

Fair enough. If you still have the statement in you vim history, it's
worth quoting in the commit message. It's another piece of information
that helps reviewing.

> (Essentially all of the git-svn tests were broken, and it was a little
> annoying to fix them all by hand... though of course I verified the
> results)

-- Hannes
Bryan Donlan
2008-04-10 07:02:46 UTC
Permalink
On Thu, Apr 10, 2008 at 08:49:03AM +0200, Johannes Sixt wrote:
> Bryan Donlan schrieb:
> > To be honest, I fixed all the git-svn tests with a suitably clever vim s///
> > expression, so at the time this way was actually easier :)
>
> Fair enough. If you still have the statement in you vim history, it's
> worth quoting in the commit message. It's another piece of information
> that helps reviewing.

It's fallen off by now, but as I recall it was something along the lines
of:
:%s/\$\({a number of questionable variable names}\)/\\"\\$\1\\"/gc

After which point I stepped through the matches to confirm that it was
actually within the test eval strings at the time.

Thanks,

Bryan
Junio C Hamano
2008-04-10 07:24:29 UTC
Permalink
Johannes Sixt <***@viscovery.net> writes:

>>>> test_expect_success ".rev_db auto-converted to .rev_map.UUID" "
>>>> git-svn fetch -i trunk &&
>>>> + test -z \"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_db.* 2>/dev/null)\" &&
>>>> + expect=\"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_map.*)\" &&
>>>> test -n \"\$expect\" &&
>>>> + rev_db=\"\$(echo \$expect | sed -e 's,_map,_db,')\" &&
>>>> + convert_to_rev_db \"\$expect\" \"\$rev_db\" &&
>>>> + rm -f \"\$expect\" &&
>>>> + test -f \"\$rev_db\" &&
>>>> git-svn fetch -i trunk &&
>>>> + test -z \"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_db.* 2>/dev/null)\" &&
>>>> + test ! -e \"\$GIT_DIR\"/svn/trunk/.rev_db &&
>>>> + test -f \"\$expect\"
>>>> "
>>> While looking at this test: Wouldn't it be easier to just place the whole
>>> thing (and probably similar cases, too) in single-quotes?
>>
>> To be honest, I fixed all the git-svn tests with a suitably clever vim s///
>> expression, so at the time this way was actually easier :)

Yeah, last night I ran out of energy reviewing things. The above is
simply too ugly to be acceptable, with or without automated s///
expression.
Bryan Donlan
2008-04-09 01:30:01 UTC
Permalink
In particular, this function correctly handles cases where the pwd contains
spaces, quotes, and other troublesome metacharacters.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/test-lib.sh | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 17d4bc0..6f43376 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -160,6 +160,15 @@ die () {

trap 'die' exit

+test_set_editor () {
+ # If the editor path contains a quote, just using VISUAL='"path"' isn't
+ # enough.
+ FAKE_EDITOR="$1"
+ export FAKE_EDITOR
+ VISUAL='"$FAKE_EDITOR"'
+ export VISUAL
+}
+
test_tick () {
if test -z "${test_tick+set}"
then
--
1.5.5.8.gbbd98
Bryan Donlan
2008-04-09 01:30:02 UTC
Permalink
Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/lib-git-svn.sh | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 9decd2e..1b37ba8 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -7,9 +7,9 @@ then
exit
fi

-GIT_DIR=$PWD/.git
-GIT_SVN_DIR=$GIT_DIR/svn/git-svn
-SVN_TREE=$GIT_SVN_DIR/svn-tree
+GIT_DIR="$PWD/.git"
+GIT_SVN_DIR="$GIT_DIR/svn/git-svn"
+SVN_TREE="$GIT_SVN_DIR/svn-tree"

svn >/dev/null 2>&1
if test $? -ne 1
@@ -19,13 +19,14 @@ then
exit
fi

-svnrepo=$PWD/svnrepo
+svnrepo="$PWD/svnrepo"
+export svnrepo

perl -w -e "
use SVN::Core;
use SVN::Repos;
\$SVN::Core::VERSION gt '1.1.0' or exit(42);
-system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or exit(41);
+system(qw/svnadmin create --fs-type fsfs/, \$ENV{svnrepo}) == 0 or exit(41);
" >&3 2>&4
x=$?
if test $x -ne 0
--
1.5.5.8.gbbd98
Bryan Donlan
2008-04-09 01:30:03 UTC
Permalink
Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/t9001-send-email.sh | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 030f66c..0a65785 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -144,10 +144,7 @@ test_expect_success 'setup fake editor' '
chmod +x fake-editor
'

-FAKE_EDITOR="$(pwd)/fake-editor"
-export FAKE_EDITOR
-GIT_EDITOR='"$FAKE_EDITOR"'
-export GIT_EDITOR
+test_set_editor "$(pwd)/fake-editor"

test_expect_success '--compose works' '
clean_fake_sendmail &&
--
1.5.5.8.gbbd98
Johannes Sixt
2008-04-09 07:01:31 UTC
Permalink
Bryan Donlan schrieb:
> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
> index 030f66c..0a65785 100755
> --- a/t/t9001-send-email.sh
> +++ b/t/t9001-send-email.sh
> @@ -144,10 +144,7 @@ test_expect_success 'setup fake editor' '
> chmod +x fake-editor
> '
>
> -FAKE_EDITOR="$(pwd)/fake-editor"
> -export FAKE_EDITOR
> -GIT_EDITOR='"$FAKE_EDITOR"'
> -export GIT_EDITOR
> +test_set_editor "$(pwd)/fake-editor"
>
> test_expect_success '--compose works' '
> clean_fake_sendmail &&

I'd squash this into 5/8 or 8/8. Dunno.

-- Hannes
Bryan Donlan
2008-04-09 14:16:16 UTC
Permalink
On Wed, Apr 09, 2008 at 09:01:31AM +0200, Johannes Sixt wrote:
> Bryan Donlan schrieb:
> > diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
> > index 030f66c..0a65785 100755
> > --- a/t/t9001-send-email.sh
> > +++ b/t/t9001-send-email.sh
> > @@ -144,10 +144,7 @@ test_expect_success 'setup fake editor' '
> > chmod +x fake-editor
> > '
> >
> > -FAKE_EDITOR="$(pwd)/fake-editor"
> > -export FAKE_EDITOR
> > -GIT_EDITOR='"$FAKE_EDITOR"'
> > -export GIT_EDITOR
> > +test_set_editor "$(pwd)/fake-editor"
> >
> > test_expect_success '--compose works' '
> > clean_fake_sendmail &&
>
> I'd squash this into 5/8 or 8/8. Dunno.

I split it out as it's not really related to the goals of 5/8 or 8/8,
but is rather pure elimination of code duplication. However if it's
considered better to squash it into 5/8 I'd be happy to do so.

Thanks,

Bryan
Junio C Hamano
2008-04-09 06:50:35 UTC
Permalink
Bryan Donlan <***@fushizen.net> writes:

> Signed-off-by: Bryan Donlan <***@fushizen.net>
> ---
> t/lib-git-svn.sh | 11 ++++++-----
> 1 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
> index 9decd2e..1b37ba8 100644
> --- a/t/lib-git-svn.sh
> +++ b/t/lib-git-svn.sh
> @@ -7,9 +7,9 @@ then
> exit
> fi
>
> -GIT_DIR=$PWD/.git
> -GIT_SVN_DIR=$GIT_DIR/svn/git-svn
> -SVN_TREE=$GIT_SVN_DIR/svn-tree
> +GIT_DIR="$PWD/.git"
> +GIT_SVN_DIR="$GIT_DIR/svn/git-svn"
> +SVN_TREE="$GIT_SVN_DIR/svn-tree"

Same comment as the one for [1/8].

>
> svn >/dev/null 2>&1
> if test $? -ne 1
> @@ -19,13 +19,14 @@ then
> exit
> fi
>
> -svnrepo=$PWD/svnrepo
> +svnrepo="$PWD/svnrepo"
> +export svnrepo

Likewise, except "export" is a good way to propagate it down.

> perl -w -e "
> use SVN::Core;
> use SVN::Repos;
> \$SVN::Core::VERSION gt '1.1.0' or exit(42);
> -system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or exit(41);
> +system(qw/svnadmin create --fs-type fsfs/, \$ENV{svnrepo}) == 0 or exit(41);
> " >&3 2>&4
> x=$?
> if test $x -ne 0
Johannes Sixt
2008-04-09 06:36:48 UTC
Permalink
Bryan Donlan schrieb:
> +test_set_editor () {
> + # If the editor path contains a quote, just using VISUAL='"path"' isn't
> + # enough.
> + FAKE_EDITOR="$1"
> + export FAKE_EDITOR
> + VISUAL='"$FAKE_EDITOR"'
> + export VISUAL

Clever! It assumes that $VISUAL is always run as sh -c "$VISUAL ...", but
I think this assumption is valid. A hint along these lines in the comment
could turn out helpful.

-- Hannes
Bryan Donlan
2008-04-09 01:30:00 UTC
Permalink
Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/test-lib.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7c2a8ba..17d4bc0 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -329,7 +329,7 @@ test_create_repo () {
repo="$1"
mkdir "$repo"
cd "$repo" || error "Cannot setup test environment"
- "$GIT_EXEC_PATH/git" init --template=$GIT_EXEC_PATH/templates/blt/ >/dev/null 2>&1 ||
+ "$GIT_EXEC_PATH/git" init "--template=$GIT_EXEC_PATH/templates/blt/" >/dev/null 2>&1 ||
error "cannot run git init -- have you built things yet?"
mv .git/hooks .git/hooks-disabled
cd "$owd"
--
1.5.5.8.gbbd98
Bryan Donlan
2008-04-09 01:29:58 UTC
Permalink
Signed-off-by: Bryan Donlan <***@fushizen.net>
---
config.c | 2 +-
t/t1303-wacky-config.sh | 6 ++++++
2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/config.c b/config.c
index 0624494..6c07245 100644
--- a/config.c
+++ b/config.c
@@ -672,7 +672,7 @@ static int store_write_section(int fd, const char* key)
if (dot) {
strbuf_addf(&sb, "[%.*s \"", (int)(dot - key), key);
for (i = dot - key + 1; i < store.baselen; i++) {
- if (key[i] == '"')
+ if (key[i] == '"' || key[i] == '\\')
strbuf_addch(&sb, '\\');
strbuf_addch(&sb, key[i]);
}
diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh
index 99985dc..f366b53 100755
--- a/t/t1303-wacky-config.sh
+++ b/t/t1303-wacky-config.sh
@@ -34,4 +34,10 @@ test_expect_success 'add key in different section' '
check section2.key bar
'

+SECTION="test.q\"s\\sq'sp e.key"
+test_expect_success 'make sure git-config escapes section names properly' '
+ git config "$SECTION" bar &&
+ check "$SECTION" bar
+'
+
test_done
--
1.5.5.8.gbbd98
Bryan Donlan
2008-04-09 01:29:59 UTC
Permalink
Also, update t/t9001-send-email.sh to test for this bug.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
git-send-email.perl | 2 +-
t/t9001-send-email.sh | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index be4a20d..975df1c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -510,7 +510,7 @@ EOT
close(C);

my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
- system('sh', '-c', '$0 $@', $editor, $compose_filename);
+ system('sh', '-c', $editor.' $@', $editor, $compose_filename);

open(C2,">",$compose_filename . ".final")
or die "Failed to open $compose_filename.final : " . $!;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c0973b4..030f66c 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -139,15 +139,19 @@ test_expect_success 'Valid In-Reply-To when prompting' '

test_expect_success 'setup fake editor' '
(echo "#!/bin/sh" &&
- echo "echo fake edit >>\$1"
+ echo "echo fake edit >>\"\$1\""
) >fake-editor &&
chmod +x fake-editor
'

+FAKE_EDITOR="$(pwd)/fake-editor"
+export FAKE_EDITOR
+GIT_EDITOR='"$FAKE_EDITOR"'
+export GIT_EDITOR
+
test_expect_success '--compose works' '
clean_fake_sendmail &&
echo y | \
- GIT_EDITOR=$(pwd)/fake-editor \
GIT_SEND_EMAIL_NOTTY=1 \
git send-email \
--compose --subject foo \
--
1.5.5.8.gbbd98
Johannes Sixt
2008-04-09 06:31:18 UTC
Permalink
Bryan Donlan schrieb:
> Also, update t/t9001-send-email.sh to test for this bug.
>
> Signed-off-by: Bryan Donlan <***@fushizen.net>

Your defintion of "properly"? I didn't immediately see what is wrong with
the status quo and, hence, why your fix would solve a problem.

-- Hannes
Bryan Donlan
2008-04-09 14:28:08 UTC
Permalink
On Wed, Apr 09, 2008 at 08:31:18AM +0200, Johannes Sixt wrote:
> Bryan Donlan schrieb:
> > Also, update t/t9001-send-email.sh to test for this bug.
> >
> > Signed-off-by: Bryan Donlan <***@fushizen.net>
>
> Your defintion of "properly"? I didn't immediately see what is wrong with
> the status quo and, hence, why your fix would solve a problem.

This fixes the git-send-perl semantics for launching an editor when
$GIT_EDITOR (or friends) contains shell metacharacters to match
launch_editor() in builtin-tag.c. If we use the current approach
(sh -c '$0 $@' "$EDITOR" files ...), we see it fails when $EDITOR has
shell metacharacters:

$ sh -x -c '$0 $@' "$VISUAL" "foo"
+ "$FAKE_EDITOR" foo
"$FAKE_EDITOR": 1: "$FAKE_EDITOR": not found

Whereas builtin-tag.c will invoke sh -c "$EDITOR \"$@\"".

Note that with the method git-send-perl uses currently, it's difficult
(impossible?) to deal with a editor path that contains arbitrary shell
metacharacters. It's certainly impossible when the various git tools use
different semantics :)

I'll amend the commit message along with the other suggested changes.
Junio C Hamano
2008-04-10 03:39:08 UTC
Permalink
Johannes Sixt <***@viscovery.net> writes:

> Bryan Donlan schrieb:
>> Also, update t/t9001-send-email.sh to test for this bug.
>>
>> Signed-off-by: Bryan Donlan <***@fushizen.net>
>
> Your defintion of "properly"? I didn't immediately see what is wrong with
> the status quo and, hence, why your fix would solve a problem.

I agree the description of this series is a bit too sketchy. I suspect
even Bryan would not remember what the broken behaviour was and what's the
new accepted behaviour is three months from now.
Johannes Sixt
2008-04-09 06:31:12 UTC
Permalink
Bryan Donlan schrieb:
> Signed-off-by: Bryan Donlan <***@fushizen.net>

What is your definition of "properly"? Please give an example of what went
wrong.

-- Hannes
Johannes Sixt
2008-04-09 14:25:25 UTC
Permalink
Bryan Donlan schrieb:
> On Wed, Apr 09, 2008 at 08:31:12AM +0200, Johannes Sixt wrote:
>> Bryan Donlan schrieb:
>>> Signed-off-by: Bryan Donlan <***@fushizen.net>
>> What is your definition of "properly"? Please give an example of what went
>> wrong.
>
> The included patch to the test suite is an example - specifically if an
> element of the configuration key name other than the first or last
> contains a backslash, it would not be escaped on output, but would be
> treated as an escape sequence on input. Thus the backslash would be
> lost.

Could you then please add this to the commit message, most importantly,
the last sentence?

-- Hannes
Bryan Donlan
2008-04-09 14:13:34 UTC
Permalink
On Wed, Apr 09, 2008 at 08:31:12AM +0200, Johannes Sixt wrote:
> Bryan Donlan schrieb:
> > Signed-off-by: Bryan Donlan <***@fushizen.net>
>
> What is your definition of "properly"? Please give an example of what went
> wrong.

The included patch to the test suite is an example - specifically if an
element of the configuration key name other than the first or last
contains a backslash, it would not be escaped on output, but would be
treated as an escape sequence on input. Thus the backslash would be
lost.
Junio C Hamano
2008-04-09 06:50:48 UTC
Permalink
Bryan Donlan <***@fushizen.net> writes:

> @@ -42,7 +42,7 @@ To restore the original branch and stop rebasing run \"git rebase --abort\".
> unset newbase
> strategy=recursive
> do_merge=
> -dotest=$GIT_DIR/.dotest-merge
> +dotest="$GIT_DIR/.dotest-merge"
> prec=4
> verbose=
> git_am_opt=

This dq should not be necessary.

The rest of this looked fine.
Johannes Sixt
2008-04-09 06:55:31 UTC
Permalink
Bryan Donlan schrieb:
> -dotest=$GIT_DIR/.dotest-merge
> +dotest="$GIT_DIR/.dotest-merge"

This is not strictly necessary: The RHS expression of an assignment does
not undergo IFS splitting; but better safe than sorry. (But note that
'export foo=$bar', which is not POSIX, is *not* an assignment, and
different shells that support this construct treat it differently.)

> +### Test that we handle strange characters properly
> +work_dir="$(pwd)/test \" ' \$ \\ dir"

In effect, you modify only this test to stress-test strange characters,
but other tests in the test suite still run in a "sane" environment. IOW,
I don't think you should go to this extreme for this one test only. The
better approach would be to rename 'trash' in test-lib.sh to this strange
name so that all tests suffer from a challenging environment.

> - git reset --hard pre-rebase
> - test_must_fail git rebase'"$type"' master &&
> - test -d '$dotest' &&
> + git reset --hard pre-rebase &&
> + test_must_fail git rebase$type master &&
> + test -d \"\$dotest\" &&

I could imagine that the missing && after the git reset is deliberate. Mike?

> + git reset --hard pre-rebase &&

Ditto.

Apart from that, this looks good.

-- Hannes
Bryan Donlan
2008-04-09 14:37:02 UTC
Permalink
On Wed, Apr 09, 2008 at 08:55:31AM +0200, Johannes Sixt wrote:
> Bryan Donlan schrieb:
> > -dotest=$GIT_DIR/.dotest-merge
> > +dotest="$GIT_DIR/.dotest-merge"
>
> This is not strictly necessary: The RHS expression of an assignment does
> not undergo IFS splitting; but better safe than sorry. (But note that
> 'export foo=$bar', which is not POSIX, is *not* an assignment, and
> different shells that support this construct treat it differently.)

Since Junio asked(?) that it be removed, I'll drop it from the next rev
of the patchset.

> > +### Test that we handle strange characters properly
> > +work_dir="$(pwd)/test \" ' \$ \\ dir"
>
> In effect, you modify only this test to stress-test strange characters,
> but other tests in the test suite still run in a "sane" environment. IOW,
> I don't think you should go to this extreme for this one test only. The
> better approach would be to rename 'trash' in test-lib.sh to this strange
> name so that all tests suffer from a challenging environment.

I can do that, but it'd have to come as the last patch in the patchset,
or it would obviously cause test failures. My goal here was to ensure
that the bug I fixed in the patch would be tested in an isolated manner.

If you like I can add a change to the trash directory to the next rev of
the patchset.

>
> > - git reset --hard pre-rebase
> > - test_must_fail git rebase'"$type"' master &&
> > - test -d '$dotest' &&
> > + git reset --hard pre-rebase &&
> > + test_must_fail git rebase$type master &&
> > + test -d \"\$dotest\" &&
>
> I could imagine that the missing && after the git reset is deliberate. Mike?

I assumed that if git reset failed here we'd probably want to know :)

Thanks,

Bryan
Johannes Sixt
2008-04-09 14:51:20 UTC
Permalink
Bryan Donlan schrieb:
> On Wed, Apr 09, 2008 at 08:55:31AM +0200, Johannes Sixt wrote:
>> Bryan Donlan schrieb:
>>> +### Test that we handle strange characters properly
>>> +work_dir="$(pwd)/test \" ' \$ \\ dir"
>> In effect, you modify only this test to stress-test strange characters,
>> but other tests in the test suite still run in a "sane" environment. IOW,
>> I don't think you should go to this extreme for this one test only. The
>> better approach would be to rename 'trash' in test-lib.sh to this strange
>> name so that all tests suffer from a challenging environment.
>
> I can do that, but it'd have to come as the last patch in the patchset,
> or it would obviously cause test failures. My goal here was to ensure
> that the bug I fixed in the patch would be tested in an isolated manner.

I for my taste could live without a test because the fix is so obvious.
Given that you have to prepend 'cd "$work_dir"' to *all* the tests, this
really just highlights that for the purpose of this test the name 'trash'
of the regular test directory is just too simple ;)

Of course, it's Junio's draw, and he likes to have tests for fixes that
are submitted.

> If you like I can add a change to the trash directory to the next rev of
> the patchset.

Yes, why not?

>>> - git reset --hard pre-rebase
>>> - test_must_fail git rebase'"$type"' master &&
>>> - test -d '$dotest' &&
>>> + git reset --hard pre-rebase &&
>>> + test_must_fail git rebase$type master &&
>>> + test -d \"\$dotest\" &&
>> I could imagine that the missing && after the git reset is deliberate. Mike?
>
> I assumed that if git reset failed here we'd probably want to know :)

On second sight, this indeed looks just like an omission and your change
is good.

-- Hannes
Bryan Donlan
2008-04-09 15:02:46 UTC
Permalink
On Wed, Apr 09, 2008 at 04:51:20PM +0200, Johannes Sixt wrote:
> Bryan Donlan schrieb:
>
> > If you like I can add a change to the trash directory to the next rev of
> > the patchset.
>
> Yes, why not?

How exotic ought it be? I'm not entirely sure which characters are
allowed on windows or any other non-unixes that git supports (are there
any?)

Thanks,

Bryan
Johannes Sixt
2008-04-10 06:10:38 UTC
Permalink
Bryan Donlan schrieb:
> On Wed, Apr 09, 2008 at 04:51:20PM +0200, Johannes Sixt wrote:
>> Bryan Donlan schrieb:
>>
>>> If you like I can add a change to the trash directory to the next rev of
>>> the patchset.
>> Yes, why not?
>
> How exotic ought it be? I'm not entirely sure which characters are
> allowed on windows or any other non-unixes that git supports (are there
> any?)

What you had in your patch is OK: " ' $ The backslash is also a notable
special character, but it is a directory separator on Windows, so it
should not be in the name.

-- Hannes
Bryan Donlan
2008-04-10 06:50:13 UTC
Permalink
Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/lib-git-svn.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 9decd2e..445df78 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -20,12 +20,13 @@ then
fi

svnrepo=$PWD/svnrepo
+export svnrepo

perl -w -e "
use SVN::Core;
use SVN::Repos;
\$SVN::Core::VERSION gt '1.1.0' or exit(42);
-system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or exit(41);
+system(qw/svnadmin create --fs-type fsfs/, \$ENV{svnrepo}) == 0 or exit(41);
" >&3 2>&4
x=$?
if test $x -ne 0
--
1.5.5.33.gc0a39.dirty
Bryan Donlan
2008-04-10 06:50:16 UTC
Permalink
In order to help prevent regressions in the future, rename the trash directory
for all tests to contain an assortment of shell metacharacters. This patch
also corrects two failures that were caused or exposed by this change.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/.gitignore | 2 +-
t/t6200-fmt-merge-msg.sh | 6 +++---
t/t9121-git-svn-fetch-renamed-dir.sh | 12 ++++++------
t/test-lib.sh | 4 ++--
4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/t/.gitignore b/t/.gitignore
index fad67c0..fd07343 100644
--- a/t/.gitignore
+++ b/t/.gitignore
@@ -1 +1 @@
-trash
+/trash directory with characters like $ and " and ' in its name
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 526d7d1..9c0b926 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -82,14 +82,14 @@ test_expect_success 'merge-msg test #1' '
git diff actual expected
'

-cat >expected <<\EOF
-Merge branch 'left' of ../trash
+cat >expected <<EOF
+Merge branch 'left' of ../$test
EOF

test_expect_success 'merge-msg test #2' '

git checkout master &&
- git fetch ../trash left &&
+ git fetch ../"$test" left &&

git fmt-merge-msg <.git/FETCH_HEAD >actual &&
git diff actual expected
diff --git a/t/t9121-git-svn-fetch-renamed-dir.sh b/t/t9121-git-svn-fetch-renamed-dir.sh
index 5143ed6..99230b0 100755
--- a/t/t9121-git-svn-fetch-renamed-dir.sh
+++ b/t/t9121-git-svn-fetch-renamed-dir.sh
@@ -7,14 +7,14 @@ test_description='git-svn can fetch renamed directories'

. ./lib-git-svn.sh

-test_expect_success 'load repository with renamed directory' "
- svnadmin load -q $rawsvnrepo < ../t9121/renamed-dir.dump
- "
+test_expect_success 'load repository with renamed directory' '
+ svnadmin load -q "$rawsvnrepo" < ../t9121/renamed-dir.dump
+ '

-test_expect_success 'init and fetch repository' "
- git svn init $svnrepo/newname &&
+test_expect_success 'init and fetch repository' '
+ git svn init "$svnrepo/newname" &&
git svn fetch
- "
+ '

test_done

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 04e098b..f6b2954 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -411,14 +411,14 @@ fi
. ../GIT-BUILD-OPTIONS

# Test repository
-test=trash
+test="trash directory with characters like \$ and \" and ' in its name"
rm -fr "$test" || {
trap - exit
echo >&5 "FATAL: Cannot prepare test area"
exit 1
}

-test_create_repo $test
+test_create_repo "$test"
cd "$test"

this_test=$(expr "./$0" : '.*/\(t[0-9]*\)-[^/]*$')
--
1.5.5.33.gc0a39.dirty
Bryan Donlan
2008-04-10 06:50:14 UTC
Permalink
This form is not portable across all shells, so replace instances of:

export FOO=bar

with:

FOO=bar
export FOO

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/lib-httpd.sh | 3 +-
t/t1500-rev-parse.sh | 9 ++++---
t/t1501-worktree.sh | 34 ++++++++++++++++---------------
t/t3400-rebase.sh | 3 +-
t/t3500-cherry.sh | 3 +-
t/t5500-fetch-pack.sh | 2 +-
t/t6000lib.sh | 9 +++++--
t/t6010-merge-base.sh | 9 ++++---
t/t7004-tag.sh | 3 +-
t/t9500-gitweb-standalone-no-errors.sh | 16 ++++++++------
10 files changed, 52 insertions(+), 39 deletions(-)

diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 7f206c5..a5c4436 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -61,7 +61,8 @@ prepare_httpd() {
-new -x509 -nodes \
-out $HTTPD_ROOT_PATH/httpd.pem \
-keyout $HTTPD_ROOT_PATH/httpd.pem
- export GIT_SSL_NO_VERIFY=t
+ GIT_SSL_NO_VERIFY=t
+ export GIT_SSL_NO_VERIFY
HTTPD_PARA="$HTTPD_PARA -DSSL"
else
HTTPD_URL=http://127.0.0.1:$LIB_HTTPD_PORT
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 38a2bf0..85da4ca 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -51,8 +51,9 @@ test_rev_parse 'core.bare undefined' false false true

mkdir work || exit 1
cd work || exit 1
-export GIT_DIR=../.git
-export GIT_CONFIG="$(pwd)"/../.git/config
+GIT_DIR=../.git
+GIT_CONFIG="$(pwd)"/../.git/config
+export GIT_DIR GIT_CONFIG

git config core.bare false
test_rev_parse 'GIT_DIR=../.git, core.bare = false' false false true ''
@@ -64,8 +65,8 @@ git config --unset core.bare
test_rev_parse 'GIT_DIR=../.git, core.bare undefined' false false true ''

mv ../.git ../repo.git || exit 1
-export GIT_DIR=../repo.git
-export GIT_CONFIG="$(pwd)"/../repo.git/config
+GIT_DIR=../repo.git
+GIT_CONFIG="$(pwd)"/../repo.git/config

git config core.bare false
test_rev_parse 'GIT_DIR=../repo.git, core.bare = false' false false true ''
diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh
index 7ee3820..2ee88d8 100755
--- a/t/t1501-worktree.sh
+++ b/t/t1501-worktree.sh
@@ -32,24 +32,25 @@ mkdir -p work/sub/dir || exit 1
mv .git repo.git || exit 1

say "core.worktree = relative path"
-export GIT_DIR=repo.git
-export GIT_CONFIG="$(pwd)"/$GIT_DIR/config
+GIT_DIR=repo.git
+GIT_CONFIG="$(pwd)"/$GIT_DIR/config
+export GIT_DIR GIT_CONFIG
unset GIT_WORK_TREE
git config core.worktree ../work
test_rev_parse 'outside' false false false
cd work || exit 1
-export GIT_DIR=../repo.git
-export GIT_CONFIG="$(pwd)"/$GIT_DIR/config
+GIT_DIR=../repo.git
+GIT_CONFIG="$(pwd)"/$GIT_DIR/config
test_rev_parse 'inside' false false true ''
cd sub/dir || exit 1
-export GIT_DIR=../../../repo.git
-export GIT_CONFIG="$(pwd)"/$GIT_DIR/config
+GIT_DIR=../../../repo.git
+GIT_CONFIG="$(pwd)"/$GIT_DIR/config
test_rev_parse 'subdirectory' false false true sub/dir/
cd ../../.. || exit 1

say "core.worktree = absolute path"
-export GIT_DIR=$(pwd)/repo.git
-export GIT_CONFIG=$GIT_DIR/config
+GIT_DIR=$(pwd)/repo.git
+GIT_CONFIG=$GIT_DIR/config
git config core.worktree "$(pwd)/work"
test_rev_parse 'outside' false false false
cd work || exit 1
@@ -59,25 +60,26 @@ test_rev_parse 'subdirectory' false false true sub/dir/
cd ../../.. || exit 1

say "GIT_WORK_TREE=relative path (override core.worktree)"
-export GIT_DIR=$(pwd)/repo.git
-export GIT_CONFIG=$GIT_DIR/config
+GIT_DIR=$(pwd)/repo.git
+GIT_CONFIG=$GIT_DIR/config
git config core.worktree non-existent
-export GIT_WORK_TREE=work
+GIT_WORK_TREE=work
+export GIT_WORK_TREE
test_rev_parse 'outside' false false false
cd work || exit 1
-export GIT_WORK_TREE=.
+GIT_WORK_TREE=.
test_rev_parse 'inside' false false true ''
cd sub/dir || exit 1
-export GIT_WORK_TREE=../..
+GIT_WORK_TREE=../..
test_rev_parse 'subdirectory' false false true sub/dir/
cd ../../.. || exit 1

mv work repo.git/work

say "GIT_WORK_TREE=absolute path, work tree below git dir"
-export GIT_DIR=$(pwd)/repo.git
-export GIT_CONFIG=$GIT_DIR/config
-export GIT_WORK_TREE=$(pwd)/repo.git/work
+GIT_DIR=$(pwd)/repo.git
+GIT_CONFIG=$GIT_DIR/config
+GIT_WORK_TREE=$(pwd)/repo.git/work
test_rev_parse 'outside' false false false
cd repo.git || exit 1
test_rev_parse 'in repo.git' false true false
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 496f4ec..10d7449 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -9,7 +9,8 @@ This test runs git rebase and checks that the author information is not lost.
'
. ./test-lib.sh

-export GIT_AUTHOR_EMAIL=bogus_email_address
+GIT_AUTHOR_EMAIL=bogus_email_address
+export GIT_AUTHOR_EMAIL

test_expect_success \
'prepare repository with topic branches' \
diff --git a/t/t3500-cherry.sh b/t/t3500-cherry.sh
index d0a440f..4911c48 100755
--- a/t/t3500-cherry.sh
+++ b/t/t3500-cherry.sh
@@ -10,7 +10,8 @@ checks that git cherry only returns the second patch in the local branch
'
. ./test-lib.sh

-export GIT_AUTHOR_EMAIL=bogus_email_address
+GIT_AUTHOR_EMAIL=bogus_email_address
+export GIT_AUTHOR_EMAIL

test_expect_success \
'prepare repository with topic branch, and check cherry finds the 2 patches from there' \
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 788b4a5..1700d07 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -31,7 +31,7 @@ add () {
sec=$(($sec+1))
commit=$(echo "$text" | GIT_AUTHOR_DATE=$sec \
git commit-tree $tree $parents 2>>log2.txt)
- export $name=$commit
+ eval "$name=$commit; export $name"
echo $commit > .git/refs/heads/$branch
eval ${branch}TIP=$commit
}
diff --git a/t/t6000lib.sh b/t/t6000lib.sh
index c0baaa5..f55627b 100755
--- a/t/t6000lib.sh
+++ b/t/t6000lib.sh
@@ -49,13 +49,15 @@ as_author()
shift 1
_save=$GIT_AUTHOR_EMAIL

- export GIT_AUTHOR_EMAIL="$_author"
+ GIT_AUTHOR_EMAIL="$_author"
+ export GIT_AUTHOR_EMAIL
"$@"
if test -z "$_save"
then
unset GIT_AUTHOR_EMAIL
else
- export GIT_AUTHOR_EMAIL="$_save"
+ GIT_AUTHOR_EMAIL="$_save"
+ export GIT_AUTHOR_EMAIL
fi
}

@@ -69,7 +71,8 @@ on_committer_date()
{
_date=$1
shift 1
- export GIT_COMMITTER_DATE="$_date"
+ GIT_COMMITTER_DATE="$_date"
+ export GIT_COMMITTER_DATE
"$@"
unset GIT_COMMITTER_DATE
}
diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh
index 96f3d35..b6e57b2 100755
--- a/t/t6010-merge-base.sh
+++ b/t/t6010-merge-base.sh
@@ -13,10 +13,11 @@ T=$(git write-tree)
M=1130000000
Z=+0000

-export GIT_COMMITTER_EMAIL=***@comm.iter.xz
-export GIT_COMMITTER_NAME='C O Mmiter'
-export GIT_AUTHOR_NAME='A U Thor'
-export GIT_AUTHOR_EMAIL=***@au.thor.xz
+GIT_COMMITTER_EMAIL=***@comm.iter.xz
+GIT_COMMITTER_NAME='C O Mmiter'
+GIT_AUTHOR_NAME='A U Thor'
+GIT_AUTHOR_EMAIL=***@au.thor.xz
+export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL

doit() {
OFFSET=$1; shift
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 1a7141e..2dcee7c 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -626,7 +626,8 @@ esac

cp -R ../t7004 ./gpghome
chmod 0700 gpghome
-export GNUPGHOME="$(pwd)/gpghome"
+GNUPGHOME="$(pwd)/gpghome"
+export GNUPGHOME

get_tag_header signed-tag $commit commit $time >expect
echo 'A signed tag message' >>expect
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index 796cd7d..e7b911e 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -39,13 +39,15 @@ EOF
}

gitweb_run () {
- export GATEWAY_INTERFACE="CGI/1.1"
- export HTTP_ACCEPT="*/*"
- export REQUEST_METHOD="GET"
- export QUERY_STRING=""$1""
- export PATH_INFO=""$2""
-
- export GITWEB_CONFIG=$(pwd)/gitweb_config.perl
+ GATEWAY_INTERFACE="CGI/1.1"
+ HTTP_ACCEPT="*/*"
+ REQUEST_METHOD="GET"
+ QUERY_STRING=""$1""
+ PATH_INFO=""$2""
+ export GATEWAY_INTERFACE HTTP_ACCEPT REQUEST_METHOD QUERY_STRING PATH_INFO
+
+ GITWEB_CONFIG=$(pwd)/gitweb_config.perl
+ export GITWEB_CONFIG

# some of git commands write to STDERR on error, but this is not
# written to web server logs, so we are not interested in that:
--
1.5.5.33.gc0a39.dirty
Bryan Donlan
2008-04-10 06:50:15 UTC
Permalink
This fixes the remainder of the issues where the test script itself is at
fault for failing when the git checkout path contains whitespace or other
shell metacharacters.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/t0000-basic.sh | 4 +-
t/t1020-subdirectory.sh | 22 +++++-----
t/t3050-subprojects-fetch.sh | 2 +-
t/t3404-rebase-interactive.sh | 3 +-
t/t5500-fetch-pack.sh | 2 +-
t/t5512-ls-remote.sh | 2 +-
t/t5516-fetch-push.sh | 4 +-
t/t5700-clone-reference.sh | 2 +-
t/t5710-info-alternate.sh | 2 +-
t/t7003-filter-branch.sh | 2 +-
t/t7010-setup.sh | 2 +-
t/t7300-clean.sh | 2 +-
t/t7501-commit.sh | 8 ++--
t/t7504-commit-msg-hook.sh | 23 ++++++-----
t/t7505-prepare-commit-msg-hook.sh | 17 +++++---
t/t9100-git-svn-basic.sh | 54 ++++++++++++------------
t/t9101-git-svn-props.sh | 6 +-
t/t9102-git-svn-deep-rmdir.sh | 6 +-
t/t9103-git-svn-tracked-directory-removed.sh | 30 +++++++-------
t/t9104-git-svn-follow-parent.sh | 50 +++++++++++-----------
t/t9105-git-svn-commit-diff.sh | 12 +++---
t/t9106-git-svn-commit-diff-clobber.sh | 14 +++---
t/t9106-git-svn-dcommit-clobber-series.sh | 6 +-
t/t9107-git-svn-migrate.sh | 48 +++++++++++-----------
t/t9108-git-svn-glob.sh | 8 ++--
t/t9110-git-svn-use-svm-props.sh | 8 ++--
t/t9111-git-svn-use-svnsync-props.sh | 8 ++--
t/t9112-git-svn-md5less-file.sh | 4 +-
t/t9113-git-svn-dcommit-new-file.sh | 6 +-
t/t9114-git-svn-dcommit-merge.sh | 4 +-
t/t9115-git-svn-dcommit-funky-renames.sh | 4 +-
t/t9116-git-svn-log.sh | 4 +-
t/t9117-git-svn-init-clone.sh | 10 ++--
t/t9118-git-svn-funky-branch-names.sh | 12 +++---
t/t9120-git-svn-clone-with-percent-escapes.sh | 2 +-
t/t9500-gitweb-standalone-no-errors.sh | 11 +++--
36 files changed, 205 insertions(+), 199 deletions(-)

diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 27b54cb..690f80a 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -305,10 +305,10 @@ test_expect_success 'absolute path works as expected' '
file="$dir"/index &&
test "$file" = "$(test-absolute-path $dir2/index)" &&
basename=blub &&
- test "$dir/$basename" = $(cd .git && test-absolute-path $basename) &&
+ test "$dir/$basename" = "$(cd .git && test-absolute-path "$basename")" &&
ln -s ../first/file .git/syml &&
sym="$(cd first; pwd -P)"/file &&
- test "$sym" = "$(test-absolute-path $dir2/syml)"
+ test "$sym" = "$(test-absolute-path "$dir2/syml")"
'

test_expect_success 'very long name in the index handled sanely' '
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index b9cef34..fc386ba 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -21,7 +21,7 @@ LF='
'

test_expect_success 'update-index and ls-files' '
- cd $HERE &&
+ cd "$HERE" &&
git update-index --add one &&
case "`git ls-files`" in
one) echo ok one ;;
@@ -41,7 +41,7 @@ test_expect_success 'update-index and ls-files' '
'

test_expect_success 'cat-file' '
- cd $HERE &&
+ cd "$HERE" &&
two=`git ls-files -s dir/two` &&
two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
echo "$two" &&
@@ -54,7 +54,7 @@ test_expect_success 'cat-file' '
rm -f actual dir/actual

test_expect_success 'diff-files' '
- cd $HERE &&
+ cd "$HERE" &&
echo a >>one &&
echo d >>dir/two &&
case "`git diff-files --name-only`" in
@@ -74,7 +74,7 @@ test_expect_success 'diff-files' '
'

test_expect_success 'write-tree' '
- cd $HERE &&
+ cd "$HERE" &&
top=`git write-tree` &&
echo $top &&
cd dir &&
@@ -84,7 +84,7 @@ test_expect_success 'write-tree' '
'

test_expect_success 'checkout-index' '
- cd $HERE &&
+ cd "$HERE" &&
git checkout-index -f -u one &&
cmp one original.one &&
cd dir &&
@@ -93,7 +93,7 @@ test_expect_success 'checkout-index' '
'

test_expect_success 'read-tree' '
- cd $HERE &&
+ cd "$HERE" &&
rm -f one dir/two &&
tree=`git write-tree` &&
git read-tree --reset -u "$tree" &&
@@ -107,27 +107,27 @@ test_expect_success 'read-tree' '
'

test_expect_success 'no file/rev ambiguity check inside .git' '
- cd $HERE &&
+ cd "$HERE" &&
git commit -a -m 1 &&
- cd $HERE/.git &&
+ cd "$HERE"/.git &&
git show -s HEAD
'

test_expect_success 'no file/rev ambiguity check inside a bare repo' '
- cd $HERE &&
+ cd "$HERE" &&
git clone -s --bare .git foo.git &&
cd foo.git && GIT_DIR=. git show -s HEAD
'

# This still does not work as it should...
: test_expect_success 'no file/rev ambiguity check inside a bare repo' '
- cd $HERE &&
+ cd "$HERE" &&
git clone -s --bare .git foo.git &&
cd foo.git && git show -s HEAD
'

test_expect_success 'detection should not be fooled by a symlink' '
- cd $HERE &&
+ cd "$HERE" &&
rm -fr foo.git &&
git clone -s .git another &&
ln -s another yetanother &&
diff --git a/t/t3050-subprojects-fetch.sh b/t/t3050-subprojects-fetch.sh
index 2b21b10..4261e96 100755
--- a/t/t3050-subprojects-fetch.sh
+++ b/t/t3050-subprojects-fetch.sh
@@ -20,7 +20,7 @@ test_expect_success setup '
'

test_expect_success clone '
- git clone file://`pwd`/.git cloned &&
+ git clone "file://$(pwd)/.git" cloned &&
(git rev-parse HEAD; git ls-files -s) >expected &&
(
cd cloned &&
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 9cf873f..b9e3dbd 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -91,9 +91,8 @@ for line in $FAKE_LINES; do
done
EOF

+test_set_editor "$(pwd)/fake-editor.sh"
chmod a+x fake-editor.sh
-VISUAL="$(pwd)/fake-editor.sh"
-export VISUAL

test_expect_success 'no changes are a nop' '
git rebase -i F &&
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 1700d07..140e874 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -129,7 +129,7 @@ pull_to_client 2nd "B" $((64*3))

pull_to_client 3rd "A" $((1*3)) # old fails

-test_expect_success "clone shallow" "git-clone --depth 2 file://`pwd`/. shallow"
+test_expect_success "clone shallow" 'git-clone --depth 2 "file://$(pwd)/." shallow'

(cd shallow; git count-objects -v) > count.shallow

diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index c0dc949..1dd8eed 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -17,7 +17,7 @@ test_expect_success setup '
git show-ref -d | sed -e "s/ / /"
) >expected.all &&

- git remote add self $(pwd)/.git
+ git remote add self "$(pwd)/.git"

'

diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 793ffc6..2b2b2ef 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -105,7 +105,7 @@ test_expect_success 'fetch with insteadOf' '
(
TRASH=$(pwd) &&
cd testrepo &&
- git config url./$TRASH/.insteadOf trash/
+ git config "url./$TRASH/.insteadOf" trash/ &&
git config remote.up.url trash/. &&
git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
git fetch up &&
@@ -146,7 +146,7 @@ test_expect_success 'push with wildcard' '
test_expect_success 'push with insteadOf' '
mk_empty &&
TRASH=$(pwd) &&
- git config url./$TRASH/.insteadOf trash/ &&
+ git config "url./$TRASH/.insteadOf" trash/ &&
git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
(
cd testrepo &&
diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh
index b6a5486..e5619a9 100755
--- a/t/t5700-clone-reference.sh
+++ b/t/t5700-clone-reference.sh
@@ -51,7 +51,7 @@ diff expected current'
cd "$base_dir"

test_expect_success 'cloning with reference (no -l -s)' \
-'git clone --reference B file://`pwd`/A D'
+'git clone --reference B "file://$(pwd)/A" D'

cd "$base_dir"

diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh
index 910ccb4..1abf1a2 100755
--- a/t/t5710-info-alternate.sh
+++ b/t/t5710-info-alternate.sh
@@ -81,7 +81,7 @@ test_valid_repo'
cd "$base_dir"

test_expect_success 'breaking of loops' \
-"echo '$base_dir/B/.git/objects' >> '$base_dir'/A/.git/objects/info/alternates&&
+"echo \"\$base_dir\"/B/.git/objects >> \"\$base_dir\"/A/.git/objects/info/alternates&&
cd C &&
test_valid_repo"

diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index efd658a..fd09030 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -125,7 +125,7 @@ test_expect_success 'use index-filter to move into a subdirectory' '
"git ls-files -s | sed \"s-\\t-&newsubdir/-\" |
GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \
git update-index --index-info &&
- mv \$GIT_INDEX_FILE.new \$GIT_INDEX_FILE" directorymoved &&
+ mv \"\$GIT_INDEX_FILE.new\" \"\$GIT_INDEX_FILE\"" directorymoved &&
test -z "$(git diff HEAD directorymoved:newsubdir)"'

test_expect_success 'stops when msg filter fails' '
diff --git a/t/t7010-setup.sh b/t/t7010-setup.sh
index 02cf7c5..d8a7c79 100755
--- a/t/t7010-setup.sh
+++ b/t/t7010-setup.sh
@@ -122,7 +122,7 @@ test_expect_success 'commit using absolute path names' '

test_expect_success 'log using absolute path names' '
echo bb >>a/b/c/d &&
- git commit -m "bb" $(pwd)/a/b/c/d &&
+ git commit -m "bb" "$(pwd)/a/b/c/d" &&

git log a/b/c/d >f1.txt &&
git log "$(pwd)/a/b/c/d" >f2.txt &&
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index afccfc9..54b1352 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -111,7 +111,7 @@ test_expect_success 'git-clean with absolute path' '
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
would_clean=$(
cd docs &&
- git clean -n $(pwd)/../src |
+ git clean -n "$(pwd)/../src" |
sed -n -e "s|^Would remove ||p"
) &&
test "$would_clean" = ../src/part3.c || {
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index c0288f3..e5fdb63 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -79,8 +79,8 @@ test_expect_success \

cat >editor <<\EOF
#!/bin/sh
-sed -e "s/a file/an amend commit/g" < $1 > $1-
-mv $1- $1
+sed -e "s/a file/an amend commit/g" < "$1" > "$1-"
+mv "$1-" "$1"
EOF
chmod 755 editor

@@ -99,8 +99,8 @@ test_expect_success \

cat >editor <<\EOF
#!/bin/sh
-sed -e "s/amend/older/g" < $1 > $1-
-mv $1- $1
+sed -e "s/amend/older/g" < "$1" > "$1-"
+mv "$1-" "$1"
EOF
chmod 755 editor

diff --git a/t/t7504-commit-msg-hook.sh b/t/t7504-commit-msg-hook.sh
index eff36aa..88577af 100755
--- a/t/t7504-commit-msg-hook.sh
+++ b/t/t7504-commit-msg-hook.sh
@@ -19,6 +19,9 @@ cp FAKE_MSG "$1"
exit 0
EOF
chmod +x fake-editor
+
+## Not using test_set_editor here so we can easily ensure the editor variable
+## is only set for the editor tests
FAKE_EDITOR="$(pwd)/fake-editor"
export FAKE_EDITOR

@@ -27,7 +30,7 @@ test_expect_success 'with no hook (editor)' '
echo "more foo" >> file &&
git add file &&
echo "more foo" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit

'

@@ -44,7 +47,7 @@ test_expect_success '--no-verify with no hook (editor)' '
echo "more bar" > file &&
git add file &&
echo "more bar" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -71,7 +74,7 @@ test_expect_success 'with succeeding hook (editor)' '
echo "more more" >> file &&
git add file &&
echo "more more" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit

'

@@ -88,7 +91,7 @@ test_expect_success '--no-verify with succeeding hook (editor)' '
echo "even more more" >> file &&
git add file &&
echo "even more more" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -111,7 +114,7 @@ test_expect_success 'with failing hook (editor)' '
echo "more another" >> file &&
git add file &&
echo "more another" > FAKE_MSG &&
- ! (GIT_EDITOR="$FAKE_EDITOR" git commit)
+ ! (GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit)

'

@@ -128,7 +131,7 @@ test_expect_success '--no-verify with failing hook (editor)' '
echo "more stuff" >> file &&
git add file &&
echo "more stuff" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -146,7 +149,7 @@ test_expect_success 'with non-executable hook (editor)' '
echo "content again" >> file &&
git add file &&
echo "content again" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit -m "content again"
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -m "content again"

'

@@ -163,7 +166,7 @@ test_expect_success '--no-verify with non-executable hook (editor)' '
echo "even more content" >> file &&
git add file &&
echo "even more content" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -193,7 +196,7 @@ test_expect_success 'hook edits commit message (editor)' '
echo "additional content" >> file &&
git add file &&
echo "additional content" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit &&
commit_msg_is "new message"

'
@@ -212,7 +215,7 @@ test_expect_success "hook doesn't edit commit message (editor)" '
echo "more plus" >> file &&
git add file &&
echo "more plus" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify &&
commit_msg_is "more plus"

'
diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh
index 802aa62..cd6c7c8 100755
--- a/t/t7505-prepare-commit-msg-hook.sh
+++ b/t/t7505-prepare-commit-msg-hook.sh
@@ -18,6 +18,9 @@ cat > fake-editor <<'EOF'
exit 0
EOF
chmod +x fake-editor
+
+## Not using test_set_editor here so we can easily ensure the editor variable
+## is only set for the editor tests
FAKE_EDITOR="$(pwd)/fake-editor"
export FAKE_EDITOR

@@ -58,7 +61,7 @@ test_expect_success 'with hook (-m editor)' '

echo "more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit -e -m "more more" &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -e -m "more more" &&
test "`git log -1 --pretty=format:%s`" = message

'
@@ -85,7 +88,7 @@ test_expect_success 'with hook (-F editor)' '

echo "more" >> file &&
git add file &&
- (echo more more | GIT_EDITOR="$FAKE_EDITOR" git commit -e -F -) &&
+ (echo more more | GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -e -F -) &&
test "`git log -1 --pretty=format:%s`" = message

'
@@ -104,7 +107,7 @@ test_expect_success 'with hook (editor)' '

echo "more more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit &&
test "`git log -1 --pretty=format:%s`" = default

'
@@ -114,7 +117,7 @@ test_expect_success 'with hook (--amend)' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --amend &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --amend &&
test "`git log -1 --pretty=format:%s`" = "$head"

'
@@ -124,7 +127,7 @@ test_expect_success 'with hook (-c)' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit -c $head &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head &&
test "`git log -1 --pretty=format:%s`" = "$head"

'
@@ -139,7 +142,7 @@ test_expect_success 'with failing hook' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- ! GIT_EDITOR="$FAKE_EDITOR" git commit -c $head
+ ! GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head

'

@@ -148,7 +151,7 @@ test_expect_success 'with failing hook (--no-verify)' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- ! GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify -c $head
+ ! GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify -c $head

'

diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 4e24ab3..528c0a9 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -31,16 +31,16 @@ test_expect_success \
echo 'zzz' > bar/zzz &&
echo '#!/bin/sh' > exec.sh &&
chmod +x exec.sh &&
- svn import -m 'import for git-svn' . $svnrepo >/dev/null &&
+ svn import -m 'import for git-svn' . \"\$svnrepo\" >/dev/null &&
cd .. &&
rm -rf import &&
- git-svn init $svnrepo"
+ git-svn init \"\$svnrepo\""

test_expect_success \
'import an SVN revision into git' \
'git-svn fetch'

-test_expect_success "checkout from svn" "svn co $svnrepo '$SVN_TREE'"
+test_expect_success "checkout from svn" "svn co \"\$svnrepo\" \"\$SVN_TREE\""

name='try a deep --rmdir with a commit'
test_expect_success "$name" "
@@ -51,8 +51,8 @@ test_expect_success "$name" "
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch &&
- svn up '$SVN_TREE' &&
- test -d '$SVN_TREE'/dir && test ! -d '$SVN_TREE'/dir/a"
+ svn up \"\$SVN_TREE\" &&
+ test -d \"\$SVN_TREE\"/dir && test ! -d \"\$SVN_TREE\"/dir/a"


name='detect node change from file to directory #1'
@@ -69,7 +69,7 @@ test_expect_success "$name" "

name='detect node change from directory to file #1'
test_expect_success "$name" "
- rm -rf dir '$GIT_DIR'/index &&
+ rm -rf dir \"\$GIT_DIR\"/index &&
git checkout -f -b mybranch2 remotes/git-svn &&
mv bar/zzz zzz &&
rm -rf bar &&
@@ -83,7 +83,7 @@ test_expect_success "$name" "

name='detect node change from file to directory #2'
test_expect_success "$name" "
- rm -f '$GIT_DIR'/index &&
+ rm -f \"\$GIT_DIR\"/index &&
git checkout -f -b mybranch3 remotes/git-svn &&
rm bar/zzz &&
git update-index --remove bar/zzz &&
@@ -97,7 +97,7 @@ test_expect_success "$name" "

name='detect node change from directory to file #2'
test_expect_success "$name" "
- rm -f '$GIT_DIR'/index &&
+ rm -f \"\$GIT_DIR\"/index &&
git checkout -f -b mybranch4 remotes/git-svn &&
rm -rf dir &&
git update-index --remove -- dir/file &&
@@ -111,15 +111,15 @@ test_expect_success "$name" "

name='remove executable bit from a file'
test_expect_success "$name" "
- rm -f '$GIT_DIR'/index &&
+ rm -f \"\$GIT_DIR\"/index &&
git checkout -f -b mybranch5 remotes/git-svn &&
chmod -x exec.sh &&
git update-index exec.sh &&
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test ! -x '$SVN_TREE'/exec.sh"
+ svn up \"\$SVN_TREE\" &&
+ test ! -x \"\$SVN_TREE\"/exec.sh"


name='add executable bit back file'
@@ -129,8 +129,8 @@ test_expect_success "$name" "
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -x '$SVN_TREE'/exec.sh"
+ svn up \"\$SVN_TREE\" &&
+ test -x \"\$SVN_TREE\"/exec.sh"


name='executable file becomes a symlink to bar/zzz (file)'
@@ -141,8 +141,8 @@ test_expect_success "$name" "
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -L '$SVN_TREE'/exec.sh"
+ svn up \"\$SVN_TREE\" &&
+ test -L \"\$SVN_TREE\"/exec.sh"

name='new symlink is added to a file that was also just made executable'

@@ -153,9 +153,9 @@ test_expect_success "$name" "
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -x '$SVN_TREE'/bar/zzz &&
- test -L '$SVN_TREE'/exec-2.sh"
+ svn up \"\$SVN_TREE\" &&
+ test -x \"\$SVN_TREE\"/bar/zzz &&
+ test -L \"\$SVN_TREE\"/exec-2.sh"

name='modify a symlink to become a file'
test_expect_success "$name" "
@@ -166,10 +166,10 @@ test_expect_success "$name" "
git commit -m '$name' &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -f '$SVN_TREE'/exec-2.sh &&
- test ! -L '$SVN_TREE'/exec-2.sh &&
- git diff help $SVN_TREE/exec-2.sh"
+ svn up \"\$SVN_TREE\" &&
+ test -f \"\$SVN_TREE\"/exec-2.sh &&
+ test ! -L \"\$SVN_TREE\"/exec-2.sh &&
+ git diff help \"\$SVN_TREE\"/exec-2.sh"

if test "$have_utf8" = t
then
@@ -190,7 +190,7 @@ name='test fetch functionality (svn => git) with alternate GIT_SVN_ID'
GIT_SVN_ID=alt
export GIT_SVN_ID
test_expect_success "$name" \
- "git-svn init $svnrepo && git-svn fetch &&
+ "git-svn init \"\$svnrepo\" && git-svn fetch &&
git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
git diff a b"
@@ -220,16 +220,16 @@ test_expect_success 'exit if remote refs are ambigious' "
"

test_expect_success 'exit if init-ing a would clobber a URL' "
- svnadmin create ${PWD}/svnrepo2 &&
- svn mkdir -m 'mkdir bar' ${svnrepo}2/bar &&
+ svnadmin create \"\${PWD}/svnrepo2\" &&
+ svn mkdir -m 'mkdir bar' \"\${svnrepo}2/bar\" &&
git config --unset svn-remote.svn.fetch \
'^bar:refs/remotes/git-svn$' &&
- ! git-svn init ${svnrepo}2/bar
+ ! git-svn init \"\${svnrepo}2/bar\"
"

test_expect_success \
'init allows us to connect to another directory in the same repo' "
- git-svn init --minimize-url -i bar $svnrepo/bar &&
+ git-svn init --minimize-url -i bar \"\$svnrepo/bar\" &&
git config --get svn-remote.svn.fetch \
'^bar:refs/remotes/bar$' &&
git config --get svn-remote.svn.fetch \
diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
index d7a7047..fa8b7ee 100755
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
@@ -52,7 +52,7 @@ EOF
cd ..

rm -rf import
-test_expect_success 'checkout working copy from svn' "svn co $svnrepo test_wc"
+test_expect_success 'checkout working copy from svn' "svn co \"\$svnrepo\" test_wc"
test_expect_success 'setup some commits to svn' \
'cd test_wc &&
echo Greetings >> kw.c &&
@@ -66,7 +66,7 @@ test_expect_success 'setup some commits to svn' \
svn commit -m "Propset Id" &&
cd ..'

-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' "git-svn init \"\$svnrepo\""
test_expect_success 'fetch revisions from svn' 'git-svn fetch'

name='test svn:keywords ignoring'
@@ -92,7 +92,7 @@ test_expect_success "propset CR on crlf files" \
test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
"git-svn fetch &&
git pull . remotes/git-svn &&
- svn co $svnrepo new_wc"
+ svn co \"\$svnrepo\" new_wc"

for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
do
diff --git a/t/t9102-git-svn-deep-rmdir.sh b/t/t9102-git-svn-deep-rmdir.sh
index 4e08083..8eaf7d3 100755
--- a/t/t9102-git-svn-deep-rmdir.sh
+++ b/t/t9102-git-svn-deep-rmdir.sh
@@ -9,12 +9,12 @@ test_expect_success 'initialize repo' "
mkdir -p deeply/nested/directory/number/2 &&
echo foo > deeply/nested/directory/number/1/file &&
echo foo > deeply/nested/directory/number/2/another &&
- svn import -m 'import for git-svn' . $svnrepo &&
+ svn import -m 'import for git-svn' . \"\$svnrepo\" &&
cd ..
"

test_expect_success 'mirror via git-svn' "
- git-svn init $svnrepo &&
+ git-svn init \"\$svnrepo\" &&
git-svn fetch &&
git checkout -f -b test-rmdir remotes/git-svn
"
@@ -23,7 +23,7 @@ test_expect_success 'Try a commit on rmdir' "
git rm -f deeply/nested/directory/number/2/another &&
git commit -a -m 'remove another' &&
git-svn set-tree --rmdir HEAD &&
- svn ls -R $svnrepo | grep ^deeply/nested/directory/number/1
+ svn ls -R \"\$svnrepo\" | grep ^deeply/nested/directory/number/1
"


diff --git a/t/t9103-git-svn-tracked-directory-removed.sh b/t/t9103-git-svn-tracked-directory-removed.sh
index 0f0b0fd..c7734e6 100755
--- a/t/t9103-git-svn-tracked-directory-removed.sh
+++ b/t/t9103-git-svn-tracked-directory-removed.sh
@@ -6,34 +6,34 @@
test_description='git-svn tracking removed top-level path'
. ./lib-git-svn.sh

-test_expect_success 'make history for tracking' '
+test_expect_success 'make history for tracking' "
mkdir import &&
mkdir import/trunk &&
echo hello >> import/trunk/README &&
- svn import -m initial import $svnrepo &&
+ svn import -m initial import \"\$svnrepo\" &&
rm -rf import &&
- svn co $svnrepo/trunk trunk &&
+ svn co \"\$svnrepo\"/trunk trunk &&
echo bye bye >> trunk/README &&
- svn rm -m "gone" $svnrepo/trunk &&
+ svn rm -m 'gone' \"\$svnrepo\"/trunk &&
rm -rf trunk &&
mkdir trunk &&
- echo "new" > trunk/FOLLOWME &&
- svn import -m "new trunk" trunk $svnrepo/trunk
-'
+ echo 'new' > trunk/FOLLOWME &&
+ svn import -m 'new trunk' trunk \"\$svnrepo\"/trunk
+"

-test_expect_success 'clone repo with git' '
- git svn clone -s $svnrepo x &&
+test_expect_success 'clone repo with git' "
+ git svn clone -s \"\$svnrepo\" x &&
test -f x/FOLLOWME &&
test ! -f x/README
-'
+"

-test_expect_success 'make sure r2 still has old file' '
+test_expect_success 'make sure r2 still has old file' "
cd x &&
- test -n "$(git svn find-rev r1)" &&
- git reset --hard $(git svn find-rev r1) &&
+ test -n \"\$(git svn find-rev r1)\" &&
+ git reset --hard \$(git svn find-rev r1) &&
test -f README &&
test ! -f FOLLOWME &&
- test x$(git svn find-rev r2) = x
-'
+ test x\$(git svn find-rev r2) = x
+"

test_done
diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index 7ba7630..56b1704 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -11,9 +11,9 @@ test_expect_success 'initialize repo' "
cd import &&
mkdir -p trunk &&
echo hello > trunk/readme &&
- svn import -m 'initial' . $svnrepo &&
+ svn import -m 'initial' . \"\$svnrepo\" &&
cd .. &&
- svn co $svnrepo wc &&
+ svn co \"\$svnrepo\" wc &&
cd wc &&
echo world >> trunk/readme &&
poke trunk/readme &&
@@ -27,7 +27,7 @@ test_expect_success 'initialize repo' "
"

test_expect_success 'init and fetch a moved directory' "
- git-svn init --minimize-url -i thunk $svnrepo/thunk &&
+ git-svn init --minimize-url -i thunk \"\$svnrepo\"/thunk &&
git-svn fetch -i thunk &&
test \"\`git rev-parse --verify refs/remotes/***@2\`\" \
= \"\`git rev-parse --verify refs/remotes/thunk~1\`\" &&
@@ -38,7 +38,7 @@ test_expect_success 'init and fetch a moved directory' "
"

test_expect_success 'init and fetch from one svn-remote' "
- git config svn-remote.svn.url $svnrepo &&
+ git config svn-remote.svn.url \"\$svnrepo\" &&
git config --add svn-remote.svn.fetch \
trunk:refs/remotes/svn/trunk &&
git config --add svn-remote.svn.fetch \
@@ -52,9 +52,9 @@ test_expect_success 'init and fetch from one svn-remote' "

test_expect_success 'follow deleted parent' "
(svn cp -m 'resurrecting trunk as junk' \
- $svnrepo/***@2 $svnrepo/junk ||
+ \"\$svnrepo\"/***@2 \"\$svnrepo\"/junk ||
svn cp -m 'resurrecting trunk as junk' \
- -r2 $svnrepo/trunk $svnrepo/junk) &&
+ -r2 \"\$svnrepo\"/trunk \"\$svnrepo\"/junk) &&
git config --add svn-remote.svn.fetch \
junk:refs/remotes/svn/junk &&
git-svn fetch -i svn/thunk &&
@@ -67,10 +67,10 @@ test_expect_success 'follow deleted parent' "
test_expect_success 'follow larger parent' "
mkdir -p import/trunk/thunk/bump/thud &&
echo hi > import/trunk/thunk/bump/thud/file &&
- svn import -m 'import a larger parent' import $svnrepo/larger-parent &&
- svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger &&
+ svn import -m 'import a larger parent' import \"\$svnrepo\"/larger-parent &&
+ svn cp -m 'hi' \"\$svnrepo\"/larger-parent \"\$svnrepo\"/another-larger &&
git-svn init --minimize-url -i larger \
- $svnrepo/another-larger/trunk/thunk/bump/thud &&
+ \"\$svnrepo\"/another-larger/trunk/thunk/bump/thud &&
git-svn fetch -i larger &&
git rev-parse --verify refs/remotes/larger &&
git rev-parse --verify \
@@ -83,23 +83,23 @@ test_expect_success 'follow larger parent' "
"

test_expect_success 'follow higher-level parent' "
- svn mkdir -m 'follow higher-level parent' $svnrepo/blob &&
- svn co $svnrepo/blob blob &&
+ svn mkdir -m 'follow higher-level parent' \"\$svnrepo\"/blob &&
+ svn co \"\$svnrepo\"/blob blob &&
cd blob &&
echo hi > hi &&
svn add hi &&
svn commit -m 'hihi' &&
cd ..
- svn mkdir -m 'new glob at top level' $svnrepo/glob &&
- svn mv -m 'move blob down a level' $svnrepo/blob $svnrepo/glob/blob &&
- git-svn init --minimize-url -i blob $svnrepo/glob/blob &&
+ svn mkdir -m 'new glob at top level' \"\$svnrepo\"/glob &&
+ svn mv -m 'move blob down a level' \"\$svnrepo\"/blob \"\$svnrepo\"/glob/blob &&
+ git-svn init --minimize-url -i blob \"\$svnrepo\"/glob/blob &&
git-svn fetch -i blob
"

test_expect_success 'follow deleted directory' "
- svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye &&
- svn rm -m 'remove glob' $svnrepo/glob &&
- git-svn init --minimize-url -i glob $svnrepo/glob &&
+ svn mv -m 'bye!' \"\$svnrepo\"/glob/blob/hi \"\$svnrepo\"/glob/blob/bye &&
+ svn rm -m 'remove glob' \"\$svnrepo\"/glob &&
+ git-svn init --minimize-url -i glob \"\$svnrepo\"/glob &&
git-svn fetch -i glob &&
test \"\`git cat-file blob refs/remotes/glob:blob/bye\`\" = hi &&
test \"\`git ls-tree refs/remotes/glob | wc -l \`\" -eq 1
@@ -118,9 +118,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
echo 'bad delete test 2' > \
import/trunk/subversion/bindings/swig/perl/another-larger &&
cd import &&
- svn import -m 'r9270 test' . $svnrepo/r9270 &&
+ svn import -m 'r9270 test' . \"\$svnrepo\"/r9270 &&
cd .. &&
- svn co $svnrepo/r9270/trunk/subversion/bindings/swig/perl r9270 &&
+ svn co \"\$svnrepo\"/r9270/trunk/subversion/bindings/swig/perl r9270 &&
cd r9270 &&
svn mkdir native &&
svn mv t native/t &&
@@ -130,7 +130,7 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
svn commit -m 'reorg test' &&
cd .. &&
git-svn init --minimize-url -i r9270-t \
- $svnrepo/r9270/trunk/subversion/bindings/swig/perl/native/t &&
+ \"\$svnrepo\"/r9270/trunk/subversion/bindings/swig/perl/native/t &&
git-svn fetch -i r9270-t &&
test \`git rev-list r9270-t | wc -l\` -eq 2 &&
test \"\`git ls-tree --name-only r9270-t~1\`\" = \
@@ -138,9 +138,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' "
"

test_expect_success "track initial change if it was only made to parent" "
- svn cp -m 'wheee!' $svnrepo/r9270/trunk $svnrepo/r9270/drunk &&
+ svn cp -m 'wheee!' \"\$svnrepo\"/r9270/trunk \"\$svnrepo\"/r9270/drunk &&
git-svn init --minimize-url -i r9270-d \
- $svnrepo/r9270/drunk/subversion/bindings/swig/perl/native/t &&
+ \"\$svnrepo\"/r9270/drunk/subversion/bindings/swig/perl/native/t &&
git-svn fetch -i r9270-d &&
test \`git rev-list r9270-d | wc -l\` -eq 3 &&
test \"\`git ls-tree --name-only r9270-t\`\" = \
@@ -150,7 +150,7 @@ test_expect_success "track initial change if it was only made to parent" "
"

test_expect_success "track multi-parent paths" "
- svn cp -m 'resurrect /glob' $svnrepo/r9270 $svnrepo/glob &&
+ svn cp -m 'resurrect /glob' \"\$svnrepo\"/r9270 \"\$svnrepo\"/glob &&
git-svn multi-fetch &&
test \`git cat-file commit refs/remotes/glob | \
grep '^parent ' | wc -l\` -eq 2
@@ -161,8 +161,8 @@ test_expect_success "multi-fetch continues to work" "
"

test_expect_success "multi-fetch works off a 'clean' repository" "
- rm -r $GIT_DIR/svn $GIT_DIR/refs/remotes $GIT_DIR/logs &&
- mkdir $GIT_DIR/svn &&
+ rm -r \"\$GIT_DIR/svn\" \"\$GIT_DIR/refs/remotes\" \"\$GIT_DIR/logs\" &&
+ mkdir \"\$GIT_DIR/svn\" &&
git-svn multi-fetch
"

diff --git a/t/t9105-git-svn-commit-diff.sh b/t/t9105-git-svn-commit-diff.sh
index 318e172..4f7f9cc 100755
--- a/t/t9105-git-svn-commit-diff.sh
+++ b/t/t9105-git-svn-commit-diff.sh
@@ -8,7 +8,7 @@ test_expect_success 'initialize repo' "
mkdir import &&
cd import &&
echo hello > readme &&
- svn import -m 'initial' . $svnrepo &&
+ svn import -m 'initial' . \"\$svnrepo\" &&
cd .. &&
echo hello > readme &&
git update-index --add readme &&
@@ -26,17 +26,17 @@ prev=`git rev-parse --verify HEAD^1`

test_expect_success 'test the commit-diff command' "
test -n '$prev' && test -n '$head' &&
- git-svn commit-diff -r1 '$prev' '$head' '$svnrepo' &&
- svn co $svnrepo wc &&
+ git-svn commit-diff -r1 '$prev' '$head' \"\$svnrepo\" &&
+ svn co \"\$svnrepo\" wc &&
cmp readme wc/readme
"

test_expect_success 'commit-diff to a sub-directory (with git-svn config)' "
- svn import -m 'sub-directory' import $svnrepo/subdir &&
- git-svn init --minimize-url $svnrepo/subdir &&
+ svn import -m 'sub-directory' import \"\$svnrepo\"/subdir &&
+ git-svn init --minimize-url \"\$svnrepo\"/subdir &&
git-svn fetch &&
git-svn commit-diff -r3 '$prev' '$head' &&
- svn cat $svnrepo/subdir/readme > readme.2 &&
+ svn cat \"\$svnrepo\"/subdir/readme > readme.2 &&
cmp readme readme.2
"

diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh
index f74ab12..bb544f6 100755
--- a/t/t9106-git-svn-commit-diff-clobber.sh
+++ b/t/t9106-git-svn-commit-diff-clobber.sh
@@ -8,14 +8,14 @@ test_expect_success 'initialize repo' "
mkdir import &&
cd import &&
echo initial > file &&
- svn import -m 'initial' . $svnrepo &&
+ svn import -m 'initial' . \"\$svnrepo\" &&
cd .. &&
echo initial > file &&
git update-index --add file &&
git commit -a -m 'initial'
"
test_expect_success 'commit change from svn side' "
- svn co $svnrepo t.svn &&
+ svn co \"\$svnrepo\" t.svn &&
cd t.svn &&
echo second line from svn >> file &&
poke file &&
@@ -27,7 +27,7 @@ test_expect_success 'commit change from svn side' "
test_expect_success 'commit conflicting change from git' "
echo second line from git >> file &&
git commit -a -m 'second line from git' &&
- ! git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
+ ! git-svn commit-diff -r1 HEAD~1 HEAD \"\$svnrepo\"
"

test_expect_success 'commit complementing change from git' "
@@ -36,14 +36,14 @@ test_expect_success 'commit complementing change from git' "
git commit -a -m 'second line from svn' &&
echo third line from git >> file &&
git commit -a -m 'third line from git' &&
- git-svn commit-diff -r2 HEAD~1 HEAD $svnrepo
+ git-svn commit-diff -r2 HEAD~1 HEAD \"\$svnrepo\"
"

test_expect_success 'dcommit fails to commit because of conflict' "
- git-svn init $svnrepo &&
+ git-svn init \"\$svnrepo\" &&
git-svn fetch &&
git reset --hard refs/remotes/git-svn &&
- svn co $svnrepo t.svn &&
+ svn co \"\$svnrepo\" t.svn &&
cd t.svn &&
echo fourth line from svn >> file &&
poke file &&
@@ -67,7 +67,7 @@ test_expect_success 'dcommit does the svn equivalent of an index merge' "
"

test_expect_success 'commit another change from svn side' "
- svn co $svnrepo t.svn &&
+ svn co \"\$svnrepo\" t.svn &&
cd t.svn &&
echo third line from svn >> file &&
poke file &&
diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh
index ca8a00e..477755a 100755
--- a/t/t9106-git-svn-dcommit-clobber-series.sh
+++ b/t/t9106-git-svn-dcommit-clobber-series.sh
@@ -8,9 +8,9 @@ test_expect_success 'initialize repo' "
mkdir import &&
cd import &&
awk 'BEGIN { for (i = 1; i < 64; i++) { print i } }' > file
- svn import -m 'initial' . $svnrepo &&
+ svn import -m 'initial' . \"\$svnrepo\" &&
cd .. &&
- git svn init $svnrepo &&
+ git svn init \"\$svnrepo\" &&
git svn fetch &&
test -e file
"
@@ -18,7 +18,7 @@ test_expect_success 'initialize repo' "
test_expect_success '(supposedly) non-conflicting change from SVN' "
test x\"\`sed -n -e 58p < file\`\" = x58 &&
test x\"\`sed -n -e 61p < file\`\" = x61 &&
- svn co $svnrepo tmp &&
+ svn co \"\$svnrepo\" tmp &&
cd tmp &&
perl -i -p -e 's/^58\$/5588/' file &&
perl -i -p -e 's/^61\$/6611/' file &&
diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
index 0a41d52..9ab7074 100755
--- a/t/t9107-git-svn-migrate.sh
+++ b/t/t9107-git-svn-migrate.sh
@@ -4,7 +4,7 @@ test_description='git-svn metadata migrations from previous versions'
. ./lib-git-svn.sh

test_expect_success 'setup old-looking metadata' "
- cp $GIT_DIR/config $GIT_DIR/config-old-git-svn &&
+ cp \"\$GIT_DIR\"/config \"\$GIT_DIR\"/config-old-git-svn &&
mkdir import &&
cd import &&
for i in trunk branches/a branches/b \
@@ -12,13 +12,13 @@ test_expect_success 'setup old-looking metadata' "
mkdir -p \$i && \
echo hello >> \$i/README || exit 1
done && \
- svn import -m test . $svnrepo
+ svn import -m test . \"\$svnrepo\"
cd .. &&
- git-svn init $svnrepo &&
+ git-svn init \"\$svnrepo\" &&
git-svn fetch &&
- mv $GIT_DIR/svn/* $GIT_DIR/ &&
- mv $GIT_DIR/svn/.metadata $GIT_DIR/ &&
- rmdir $GIT_DIR/svn &&
+ mv \"\$GIT_DIR\"/svn/* \"\$GIT_DIR\"/ &&
+ mv \"\$GIT_DIR\"/svn/.metadata \"\$GIT_DIR\"/ &&
+ rmdir \"\$GIT_DIR\"/svn &&
git update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn &&
git update-ref refs/heads/svn-HEAD refs/remotes/git-svn &&
git update-ref -d refs/remotes/git-svn refs/remotes/git-svn
@@ -28,20 +28,20 @@ head=`git rev-parse --verify refs/heads/git-svn-HEAD^0`
test_expect_success 'git-svn-HEAD is a real HEAD' "test -n '$head'"

test_expect_success 'initialize old-style (v0) git-svn layout' "
- mkdir -p $GIT_DIR/git-svn/info $GIT_DIR/svn/info &&
- echo $svnrepo > $GIT_DIR/git-svn/info/url &&
- echo $svnrepo > $GIT_DIR/svn/info/url &&
+ mkdir -p \"\$GIT_DIR\"/git-svn/info \"\$GIT_DIR\"/svn/info &&
+ echo \"\$svnrepo\" > \"\$GIT_DIR\"/git-svn/info/url &&
+ echo \"\$svnrepo\" > \"\$GIT_DIR\"/svn/info/url &&
git-svn migrate &&
- ! test -d $GIT_DIR/git-svn &&
+ ! test -d \"\$GIT_DIR\"/git-svn &&
git rev-parse --verify refs/remotes/git-svn^0 &&
git rev-parse --verify refs/remotes/svn^0 &&
- test \`git config --get svn-remote.svn.url\` = '$svnrepo' &&
+ test \"\$(git config --get svn-remote.svn.url)\" = \"\$svnrepo\" &&
test \`git config --get svn-remote.svn.fetch\` = \
':refs/remotes/git-svn'
"

test_expect_success 'initialize a multi-repository repo' "
- git-svn init $svnrepo -T trunk -t tags -b branches &&
+ git-svn init \"\$svnrepo\" -T trunk -t tags -b branches &&
git config --get-all svn-remote.svn.fetch > fetch.out &&
grep '^trunk:refs/remotes/trunk$' fetch.out &&
test -n \"\`git config --get svn-remote.svn.branches \
@@ -76,14 +76,14 @@ test_expect_success 'multi-fetch works on partial urls + paths' "
test_expect_success 'migrate --minimize on old inited layout' "
git config --unset-all svn-remote.svn.fetch &&
git config --unset-all svn-remote.svn.url &&
- rm -rf $GIT_DIR/svn &&
+ rm -rf \"\$GIT_DIR\"/svn &&
for i in \`cat fetch.out\`; do
path=\`expr \$i : '\\([^:]*\\):.*$'\`
ref=\`expr \$i : '[^:]*:refs/remotes/\\(.*\\)$'\`
if test -z \"\$ref\"; then continue; fi
if test -n \"\$path\"; then path=\"/\$path\"; fi
- ( mkdir -p $GIT_DIR/svn/\$ref/info/ &&
- echo $svnrepo\$path > $GIT_DIR/svn/\$ref/info/url ) || exit 1;
+ ( mkdir -p \"\$GIT_DIR\"/svn/\$ref/info/ &&
+ echo \"\$svnrepo\"\$path > \"\$GIT_DIR\"/svn/\$ref/info/url ) || exit 1;
done &&
git-svn migrate --minimize &&
test -z \"\`git config -l |grep -v '^svn-remote\.git-svn\.'\`\" &&
@@ -99,17 +99,17 @@ test_expect_success 'migrate --minimize on old inited layout' "

test_expect_success ".rev_db auto-converted to .rev_map.UUID" "
git-svn fetch -i trunk &&
- test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
- expect=\"\$(ls $GIT_DIR/svn/trunk/.rev_map.*)\" &&
+ test -z \"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_db.* 2>/dev/null)\" &&
+ expect=\"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_map.*)\" &&
test -n \"\$expect\" &&
- rev_db=\$(echo \$expect | sed -e 's,_map,_db,') &&
- convert_to_rev_db \$expect \$rev_db &&
- rm -f \$expect &&
- test -f \$rev_db &&
+ rev_db=\"\$(echo \$expect | sed -e 's,_map,_db,')\" &&
+ convert_to_rev_db \"\$expect\" \"\$rev_db\" &&
+ rm -f \"\$expect\" &&
+ test -f \"\$rev_db\" &&
git-svn fetch -i trunk &&
- test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
- test ! -e $GIT_DIR/svn/trunk/.rev_db &&
- test -f \$expect
+ test -z \"\$(ls \"\$GIT_DIR\"/svn/trunk/.rev_db.* 2>/dev/null)\" &&
+ test ! -e \"\$GIT_DIR\"/svn/trunk/.rev_db &&
+ test -f \"\$expect\"
"

test_done
diff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh
index db4344c..8f03f2d 100755
--- a/t/t9108-git-svn-glob.sh
+++ b/t/t9108-git-svn-glob.sh
@@ -14,8 +14,8 @@ test_expect_success 'test refspec globbing' "
mkdir -p trunk/src/a trunk/src/b trunk/doc &&
echo 'hello world' > trunk/src/a/readme &&
echo 'goodbye world' > trunk/src/b/readme &&
- svn import -m 'initial' trunk $svnrepo/trunk &&
- svn co $svnrepo tmp &&
+ svn import -m 'initial' trunk \"\$svnrepo\"/trunk &&
+ svn co \"\$svnrepo\" tmp &&
cd tmp &&
mkdir branches tags &&
svn add branches tags &&
@@ -38,7 +38,7 @@ test_expect_success 'test refspec globbing' "
poke tags/end/src/b/readme &&
svn commit -m 'nothing to see here'
cd .. &&
- git config --add svn-remote.svn.url $svnrepo &&
+ git config --add svn-remote.svn.url \"\$svnrepo\" &&
git config --add svn-remote.svn.fetch \
'trunk/src/a:refs/remotes/trunk' &&
git config --add svn-remote.svn.branches \
@@ -60,7 +60,7 @@ echo nothing to see here >> expect.two
cat expect.end >> expect.two

test_expect_success 'test left-hand-side only globbing' "
- git config --add svn-remote.two.url $svnrepo &&
+ git config --add svn-remote.two.url \"\$svnrepo\" &&
git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
git config --add svn-remote.two.branches \
'branches/*:refs/remotes/two/branches/*' &&
diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh
index 6235af4..d9ac558 100755
--- a/t/t9110-git-svn-use-svm-props.sh
+++ b/t/t9110-git-svn-use-svm-props.sh
@@ -8,11 +8,11 @@ test_description='git-svn useSvmProps test'
. ./lib-git-svn.sh

test_expect_success 'load svm repo' "
- svnadmin load -q $rawsvnrepo < ../t9110/svm.dump &&
- git-svn init --minimize-url -R arr -i bar $svnrepo/mirror/arr &&
- git-svn init --minimize-url -R argh -i dir $svnrepo/mirror/argh &&
+ svnadmin load -q \"\$rawsvnrepo\" < ../t9110/svm.dump &&
+ git-svn init --minimize-url -R arr -i bar \"\$svnrepo\"/mirror/arr &&
+ git-svn init --minimize-url -R argh -i dir \"\$svnrepo\"/mirror/argh &&
git-svn init --minimize-url -R argh -i e \
- $svnrepo/mirror/argh/a/b/c/d/e &&
+ \"\$svnrepo\"/mirror/argh/a/b/c/d/e &&
git config svn.useSvmProps true &&
git-svn fetch --all
"
diff --git a/t/t9111-git-svn-use-svnsync-props.sh b/t/t9111-git-svn-use-svnsync-props.sh
index ec7dedd..77185bc 100755
--- a/t/t9111-git-svn-use-svnsync-props.sh
+++ b/t/t9111-git-svn-use-svnsync-props.sh
@@ -8,10 +8,10 @@ test_description='git-svn useSvnsyncProps test'
. ./lib-git-svn.sh

test_expect_success 'load svnsync repo' "
- svnadmin load -q $rawsvnrepo < ../t9111/svnsync.dump &&
- git-svn init --minimize-url -R arr -i bar $svnrepo/bar &&
- git-svn init --minimize-url -R argh -i dir $svnrepo/dir &&
- git-svn init --minimize-url -R argh -i e $svnrepo/dir/a/b/c/d/e &&
+ svnadmin load -q \"\$rawsvnrepo\" < ../t9111/svnsync.dump &&
+ git-svn init --minimize-url -R arr -i bar \"\$svnrepo\"/bar &&
+ git-svn init --minimize-url -R argh -i dir \"\$svnrepo\"/dir &&
+ git-svn init --minimize-url -R argh -i e \"\$svnrepo\"/dir/a/b/c/d/e &&
git config svn.useSvnsyncProps true &&
git-svn fetch --all
"
diff --git a/t/t9112-git-svn-md5less-file.sh b/t/t9112-git-svn-md5less-file.sh
index 646a5f0..fb1491d 100755
--- a/t/t9112-git-svn-md5less-file.sh
+++ b/t/t9112-git-svn-md5less-file.sh
@@ -40,8 +40,8 @@ PROPS-END

EOF

-test_expect_success 'load svn dumpfile' "svnadmin load $rawsvnrepo < dumpfile.svn"
+test_expect_success 'load svn dumpfile' "svnadmin load \"\$rawsvnrepo\" < dumpfile.svn"

-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' "git-svn init \"\$svnrepo\""
test_expect_success 'fetch revisions from svn' 'git-svn fetch'
test_done
diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh
index 9ef0db9..b92a64e 100755
--- a/t/t9113-git-svn-dcommit-new-file.sh
+++ b/t/t9113-git-svn-dcommit-new-file.sh
@@ -15,14 +15,14 @@ test_description='git-svn dcommit new files over svn:// test'

start_svnserve () {
svnserve --listen-port $SVNSERVE_PORT \
- --root $rawsvnrepo \
+ --root "$rawsvnrepo" \
--listen-once \
--listen-host 127.0.0.1 &
}

test_expect_success 'start tracking an empty repo' "
- svn mkdir -m 'empty dir' $svnrepo/empty-dir &&
- echo anon-access = write >> $rawsvnrepo/conf/svnserve.conf &&
+ svn mkdir -m 'empty dir' \"\$svnrepo\"/empty-dir &&
+ echo anon-access = write >> \"\$rawsvnrepo\"/conf/svnserve.conf &&
start_svnserve &&
git svn init svn://127.0.0.1:$SVNSERVE_PORT &&
git svn fetch
diff --git a/t/t9114-git-svn-dcommit-merge.sh b/t/t9114-git-svn-dcommit-merge.sh
index 225060b..74b971c 100755
--- a/t/t9114-git-svn-dcommit-merge.sh
+++ b/t/t9114-git-svn-dcommit-merge.sh
@@ -35,7 +35,7 @@ EOF
}

test_expect_success 'setup svn repository' "
- svn co $svnrepo mysvnwork &&
+ svn co \"\$svnrepo\" mysvnwork &&
mkdir -p mysvnwork/trunk &&
cd mysvnwork &&
big_text_block >> trunk/README &&
@@ -45,7 +45,7 @@ test_expect_success 'setup svn repository' "
"

test_expect_success 'setup git mirror and merge' "
- git svn init $svnrepo -t tags -T trunk -b branches &&
+ git svn init \"\$svnrepo\" -t tags -T trunk -b branches &&
git svn fetch &&
git checkout --track -b svn remotes/trunk &&
git checkout -b merge &&
diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh
index 182299c..f83f4f9 100755
--- a/t/t9115-git-svn-dcommit-funky-renames.sh
+++ b/t/t9115-git-svn-dcommit-funky-renames.sh
@@ -8,12 +8,12 @@ test_description='git-svn dcommit can commit renames of files with ugly names'
. ./lib-git-svn.sh

test_expect_success 'load repository with strange names' "
- svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+ svnadmin load -q \"\$rawsvnrepo\" < ../t9115/funky-names.dump &&
start_httpd
"

test_expect_success 'init and fetch repository' "
- git svn init $svnrepo &&
+ git svn init \"\$svnrepo\" &&
git svn fetch &&
git reset --hard git-svn
"
diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh
index e1e8bdf..13081b8 100755
--- a/t/t9116-git-svn-log.sh
+++ b/t/t9116-git-svn-log.sh
@@ -14,9 +14,9 @@ test_expect_success 'setup repository and import' "
mkdir -p \$i && \
echo hello >> \$i/README || exit 1
done && \
- svn import -m test . $svnrepo
+ svn import -m test . \"\$svnrepo\"
cd .. &&
- git-svn init $svnrepo -T trunk -b branches -t tags &&
+ git-svn init \"\$svnrepo\" -T trunk -b branches -t tags &&
git-svn fetch &&
git reset --hard trunk &&
echo bye >> README &&
diff --git a/t/t9117-git-svn-init-clone.sh b/t/t9117-git-svn-init-clone.sh
index d482b40..c924915 100755
--- a/t/t9117-git-svn-init-clone.sh
+++ b/t/t9117-git-svn-init-clone.sh
@@ -16,13 +16,13 @@ cd tmp
test_expect_success 'setup svnrepo' "
mkdir project project/trunk project/branches project/tags &&
echo foo > project/trunk/foo &&
- svn import -m '$test_description' project $svnrepo/project &&
+ svn import -m '$test_description' project \"\$svnrepo\"/project &&
rm -rf project
"

test_expect_success 'basic clone' "
test ! -d trunk &&
- git svn clone $svnrepo/project/trunk &&
+ git svn clone \"\$svnrepo\"/project/trunk &&
test -d trunk/.git/svn &&
test -e trunk/foo &&
rm -rf trunk
@@ -30,7 +30,7 @@ test_expect_success 'basic clone' "

test_expect_success 'clone to target directory' "
test ! -d target &&
- git svn clone $svnrepo/project/trunk target &&
+ git svn clone \"\$svnrepo\"/project/trunk target &&
test -d target/.git/svn &&
test -e target/foo &&
rm -rf target
@@ -38,7 +38,7 @@ test_expect_success 'clone to target directory' "

test_expect_success 'clone with --stdlayout' "
test ! -d project &&
- git svn clone -s $svnrepo/project &&
+ git svn clone -s \"\$svnrepo\"/project &&
test -d project/.git/svn &&
test -e project/foo &&
rm -rf project
@@ -46,7 +46,7 @@ test_expect_success 'clone with --stdlayout' "

test_expect_success 'clone to target directory with --stdlayout' "
test ! -d target &&
- git svn clone -s $svnrepo/project target &&
+ git svn clone -s \"\$svnrepo\"/project target &&
test -d target/.git/svn &&
test -e target/foo &&
rm -rf target
diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
index 640bb06..0f107fc 100755
--- a/t/t9118-git-svn-funky-branch-names.sh
+++ b/t/t9118-git-svn-funky-branch-names.sh
@@ -9,17 +9,17 @@ test_description='git-svn funky branch names'
test_expect_success 'setup svnrepo' "
mkdir project project/trunk project/branches project/tags &&
echo foo > project/trunk/foo &&
- svn import -m '$test_description' project \"$svnrepo/pr ject\" &&
+ svn import -m '\$test_description' project \"\$svnrepo/pr ject\" &&
rm -rf project &&
- svn cp -m 'fun' \"$svnrepo/pr ject/trunk\" \
- \"$svnrepo/pr ject/branches/fun plugin\" &&
- svn cp -m 'more fun!' \"$svnrepo/pr ject/branches/fun plugin\" \
- \"$svnrepo/pr ject/branches/more fun plugin!\" &&
+ svn cp -m 'fun' \"\$svnrepo/pr ject/trunk\" \
+ \"\$svnrepo/pr ject/branches/fun plugin\" &&
+ svn cp -m 'more fun!' \"\$svnrepo/pr ject/branches/fun plugin\" \
+ \"\$svnrepo/pr ject/branches/more fun plugin!\" &&
start_httpd
"

test_expect_success 'test clone with funky branch names' "
- git svn clone -s \"$svnrepo/pr ject\" project &&
+ git svn clone -s \"\$svnrepo/pr ject\" project &&
cd project &&
git rev-parse 'refs/remotes/fun%20plugin' &&
git rev-parse 'refs/remotes/more%20fun%20plugin!' &&
diff --git a/t/t9120-git-svn-clone-with-percent-escapes.sh b/t/t9120-git-svn-clone-with-percent-escapes.sh
index 9a4eabe..1414c0f 100755
--- a/t/t9120-git-svn-clone-with-percent-escapes.sh
+++ b/t/t9120-git-svn-clone-with-percent-escapes.sh
@@ -9,7 +9,7 @@ test_description='git-svn clone with percent escapes'
test_expect_success 'setup svnrepo' "
mkdir project project/trunk project/branches project/tags &&
echo foo > project/trunk/foo &&
- svn import -m '$test_description' project '$svnrepo/pr ject' &&
+ svn import -m \"\$test_description\" project \"\$svnrepo/pr ject\" &&
rm -rf project &&
start_httpd
"
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index e7b911e..405bad5 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -10,6 +10,7 @@ commandline, and checks that it would not write any errors
or warnings to log.'

gitweb_init () {
+ safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
cat >gitweb_config.perl <<EOF
#!/usr/bin/perl

@@ -17,16 +18,16 @@ gitweb_init () {

our \$version = "current";
our \$GIT = "git";
-our \$projectroot = "$(pwd)";
+our \$projectroot = "$safe_pwd";
our \$project_maxdepth = 8;
our \$home_link_str = "projects";
our \$site_name = "[localhost]";
our \$site_header = "";
our \$site_footer = "";
our \$home_text = "indextext.html";
-our @stylesheets = ("file:///$(pwd)/../../gitweb/gitweb.css");
-our \$logo = "file:///$(pwd)/../../gitweb/git-logo.png";
-our \$favicon = "file:///$(pwd)/../../gitweb/git-favicon.png";
+our @stylesheets = ("file:///$safe_pwd/../../gitweb/gitweb.css");
+our \$logo = "file:///$safe_pwd/../../gitweb/git-logo.png";
+our \$favicon = "file:///$safe_pwd/../../gitweb/git-favicon.png";
our \$projects_list = "";
our \$export_ok = "";
our \$strict_export = "";
@@ -53,7 +54,7 @@ gitweb_run () {
# written to web server logs, so we are not interested in that:
# we are interested only in properly formatted errors/warnings
rm -f gitweb.log &&
- perl -- $(pwd)/../../gitweb/gitweb.perl \
+ perl -- "$(pwd)/../../gitweb/gitweb.perl" \
>/dev/null 2>gitweb.log &&
if grep -q -s "^[[]" gitweb.log >/dev/null; then false; else true; fi

--
1.5.5.33.gc0a39.dirty
Bryan Donlan
2008-04-10 06:50:06 UTC
Permalink
This patch series fixes bugs in git and git's testsuite to allow all tests
to pass when the working directory contains whitespace and/or shell
metacharacters.

The first three patches in this series fix bugs in git itself that were
uncovered in the process of fixing the test suite. Each contains additional
tests and/or updates to existing tests to exercise the bug in question.

Patches 4 and 5 set up an abstraction for safe handling of editor variables
in tests when we have odd paths, and 6-8 fix bugs in the test suite itself.
Patch 9 cleans up some instances of the unportable export FOO=bar construct
in the test suite; and 10 arranges for the test suite to always run with the
trash directory name containing various metacharacters, to help prevent
regressions in the future.

Signifigant changes since v1:
* Rebase against master
* Drop some unnecessary quotation additions
* Use "$@" not $@ in editor invocations in the fix to git-send-email, to
match builtin-tag.c
* Be more verbose in the config.c and git-send-email.perl patch commit
messages
* Rename 't/trash' to 't/trash directory' to try to trip up more bugs in
the future
* Add a patch to convert all export FOO=bar to FOO=bar; export FOO in t/*.sh
* Noted why t/t7505-prepare-commit-msg-hook.sh isn't using test_set_editor
in a comment.
* Clarified the purpose and implementation of test_set_editor in a comment.

This series is also available as a git branch:

git pull git://repo.or.cz/git/bdonlan.git tags/wst-submit2

Bryan Donlan (10):
git-rebase.sh: Fix --merge --abort failures when path contains
whitespace
config.c: Escape backslashes in section names properly
git-send-email.perl: Handle shell metacharacters in $EDITOR properly
test-lib.sh: Add a test_set_editor function to safely set $VISUAL
Use test_set_editor in t9001-send-email.sh
test-lib.sh: Fix some missing path quoting
lib-git-svn.sh: Fix quoting issues with paths containing shell
metacharacters
Don't use the export NAME=value form in the test scripts.
Fix tests breaking when checkout path contains shell metacharacters
Rename the test trash directory to contain shell metacharacters.

config.c | 2 +-
git-rebase.sh | 2 +-
git-send-email.perl | 2 +-
t/.gitignore | 2 +-
t/lib-git-svn.sh | 3 +-
t/lib-httpd.sh | 3 +-
t/t0000-basic.sh | 4 +-
t/t1020-subdirectory.sh | 22 +++++-----
t/t1303-wacky-config.sh | 6 +++
t/t1500-rev-parse.sh | 9 ++--
t/t1501-worktree.sh | 34 ++++++++-------
t/t3050-subprojects-fetch.sh | 2 +-
t/t3400-rebase.sh | 3 +-
t/t3404-rebase-interactive.sh | 3 +-
t/t3407-rebase-abort.sh | 55 ++++++++++++++----------
t/t3500-cherry.sh | 3 +-
t/t5500-fetch-pack.sh | 4 +-
t/t5512-ls-remote.sh | 2 +-
t/t5516-fetch-push.sh | 4 +-
t/t5700-clone-reference.sh | 2 +-
t/t5710-info-alternate.sh | 2 +-
t/t6000lib.sh | 9 +++-
t/t6010-merge-base.sh | 9 ++--
t/t6200-fmt-merge-msg.sh | 6 +-
t/t7003-filter-branch.sh | 2 +-
t/t7004-tag.sh | 3 +-
t/t7010-setup.sh | 2 +-
t/t7300-clean.sh | 2 +-
t/t7501-commit.sh | 8 ++--
t/t7504-commit-msg-hook.sh | 23 ++++++-----
t/t7505-prepare-commit-msg-hook.sh | 17 +++++---
t/t9001-send-email.sh | 5 +-
t/t9100-git-svn-basic.sh | 54 ++++++++++++------------
t/t9101-git-svn-props.sh | 6 +-
t/t9102-git-svn-deep-rmdir.sh | 6 +-
t/t9103-git-svn-tracked-directory-removed.sh | 30 +++++++-------
t/t9104-git-svn-follow-parent.sh | 50 +++++++++++-----------
t/t9105-git-svn-commit-diff.sh | 12 +++---
t/t9106-git-svn-commit-diff-clobber.sh | 14 +++---
t/t9106-git-svn-dcommit-clobber-series.sh | 6 +-
t/t9107-git-svn-migrate.sh | 48 +++++++++++-----------
t/t9108-git-svn-glob.sh | 8 ++--
t/t9110-git-svn-use-svm-props.sh | 8 ++--
t/t9111-git-svn-use-svnsync-props.sh | 8 ++--
t/t9112-git-svn-md5less-file.sh | 4 +-
t/t9113-git-svn-dcommit-new-file.sh | 6 +-
t/t9114-git-svn-dcommit-merge.sh | 4 +-
t/t9115-git-svn-dcommit-funky-renames.sh | 4 +-
t/t9116-git-svn-log.sh | 4 +-
t/t9117-git-svn-init-clone.sh | 10 ++--
t/t9118-git-svn-funky-branch-names.sh | 12 +++---
t/t9120-git-svn-clone-with-percent-escapes.sh | 2 +-
t/t9121-git-svn-fetch-renamed-dir.sh | 12 +++---
t/t9500-gitweb-standalone-no-errors.sh | 25 ++++++-----
t/test-lib.sh | 22 +++++++++-
55 files changed, 331 insertions(+), 279 deletions(-)
Bryan Donlan
2008-04-10 06:50:08 UTC
Permalink
If an element of the configuration key name other than the first or last
contains a backslash, it is not escaped on output, but is treated as an escape
sequence on input. Thus, the backslash is lost when re-loading the
configuration.

This patch corrects this by having backslashes escaped properly, and
introduces a new test for this bug.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
config.c | 2 +-
t/t1303-wacky-config.sh | 6 ++++++
2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/config.c b/config.c
index 0624494..6c07245 100644
--- a/config.c
+++ b/config.c
@@ -672,7 +672,7 @@ static int store_write_section(int fd, const char* key)
if (dot) {
strbuf_addf(&sb, "[%.*s \"", (int)(dot - key), key);
for (i = dot - key + 1; i < store.baselen; i++) {
- if (key[i] == '"')
+ if (key[i] == '"' || key[i] == '\\')
strbuf_addch(&sb, '\\');
strbuf_addch(&sb, key[i]);
}
diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh
index 99985dc..f366b53 100755
--- a/t/t1303-wacky-config.sh
+++ b/t/t1303-wacky-config.sh
@@ -34,4 +34,10 @@ test_expect_success 'add key in different section' '
check section2.key bar
'

+SECTION="test.q\"s\\sq'sp e.key"
+test_expect_success 'make sure git-config escapes section names properly' '
+ git config "$SECTION" bar &&
+ check "$SECTION" bar
+'
+
test_done
--
1.5.5.33.gc0a39.dirty
Bryan Donlan
2008-04-10 06:50:12 UTC
Permalink
Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/test-lib.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index d7ad13b..04e098b 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -345,7 +345,7 @@ test_create_repo () {
repo="$1"
mkdir "$repo"
cd "$repo" || error "Cannot setup test environment"
- "$GIT_EXEC_PATH/git" init --template=$GIT_EXEC_PATH/templates/blt/ >/dev/null 2>&1 ||
+ "$GIT_EXEC_PATH/git" init "--template=$GIT_EXEC_PATH/templates/blt/" >/dev/null 2>&1 ||
error "cannot run git init -- have you built things yet?"
mv .git/hooks .git/hooks-disabled
cd "$owd"
--
1.5.5.33.gc0a39.dirty
Bryan Donlan
2008-04-10 06:50:09 UTC
Permalink
This fixes the git-send-perl semantics for launching an editor when
$GIT_EDITOR (or friends) contains shell metacharacters to match
launch_editor() in builtin-tag.c. If we use the current approach
(sh -c '$0 $@' "$EDITOR" files ...), we see it fails when $EDITOR has
shell metacharacters:

$ sh -x -c '$0 $@' "$VISUAL" "foo"
+ "$FAKE_EDITOR" foo
"$FAKE_EDITOR": 1: "$FAKE_EDITOR": not found

Whereas builtin-tag.c will invoke sh -c "$EDITOR \"$@\"".

Thus, this patch changes git-send-email.perl to use the same method as the
C utilities, and additionally updates t/t9001-send-email.sh to test for this bug.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
git-send-email.perl | 2 +-
t/t9001-send-email.sh | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 9e568bf..b502396 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -512,7 +512,7 @@ EOT
close(C);

my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
- system('sh', '-c', '$0 $@', $editor, $compose_filename);
+ system('sh', '-c', $editor.' "$@"', $editor, $compose_filename);

open(C2,">",$compose_filename . ".final")
or die "Failed to open $compose_filename.final : " . $!;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c0973b4..030f66c 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -139,15 +139,19 @@ test_expect_success 'Valid In-Reply-To when prompting' '

test_expect_success 'setup fake editor' '
(echo "#!/bin/sh" &&
- echo "echo fake edit >>\$1"
+ echo "echo fake edit >>\"\$1\""
) >fake-editor &&
chmod +x fake-editor
'

+FAKE_EDITOR="$(pwd)/fake-editor"
+export FAKE_EDITOR
+GIT_EDITOR='"$FAKE_EDITOR"'
+export GIT_EDITOR
+
test_expect_success '--compose works' '
clean_fake_sendmail &&
echo y | \
- GIT_EDITOR=$(pwd)/fake-editor \
GIT_SEND_EMAIL_NOTTY=1 \
git send-email \
--compose --subject foo \
--
1.5.5.33.gc0a39.dirty
Bryan Donlan
2008-04-10 06:50:11 UTC
Permalink
Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/t9001-send-email.sh | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 030f66c..0a65785 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -144,10 +144,7 @@ test_expect_success 'setup fake editor' '
chmod +x fake-editor
'

-FAKE_EDITOR="$(pwd)/fake-editor"
-export FAKE_EDITOR
-GIT_EDITOR='"$FAKE_EDITOR"'
-export GIT_EDITOR
+test_set_editor "$(pwd)/fake-editor"

test_expect_success '--compose works' '
clean_fake_sendmail &&
--
1.5.5.33.gc0a39.dirty
Bryan Donlan
2008-04-10 06:50:10 UTC
Permalink
In particular, this function correctly handles cases where the pwd contains
spaces, quotes, and other troublesome metacharacters.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/test-lib.sh | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7c2a8ba..d7ad13b 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -160,6 +160,22 @@ die () {

trap 'die' exit

+# The semantics of the editor variables are that of invoking
+# sh -c "$EDITOR \"$@\"" files ...
+#
+# If our trash directory contains shell metacharacters, they will be
+# interpreted if we just set $EDITOR directly, so do a little dance with
+# environment variables to work around this.
+#
+# In particular, quoting isn't enough, as the path may contain the same quote
+# that we're using.
+test_set_editor () {
+ FAKE_EDITOR="$1"
+ export FAKE_EDITOR
+ VISUAL='"$FAKE_EDITOR"'
+ export VISUAL
+}
+
test_tick () {
if test -z "${test_tick+set}"
then
--
1.5.5.33.gc0a39.dirty
Bryan Donlan
2008-04-10 06:50:07 UTC
Permalink
Also update t/t3407-rebase-abort.sh to exercise the bug

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
git-rebase.sh | 2 +-
t/t3407-rebase-abort.sh | 55 +++++++++++++++++++++++++++-------------------
2 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index 9b13b83..c43afe5 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -214,7 +214,7 @@ do
else
die "No rebase in progress?"
fi
- git reset --hard $(cat $dotest/orig-head)
+ git reset --hard $(cat "$dotest/orig-head")
rm -r "$dotest"
exit
;;
diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh
index 37944c3..396a354 100755
--- a/t/t3407-rebase-abort.sh
+++ b/t/t3407-rebase-abort.sh
@@ -4,7 +4,13 @@ test_description='git rebase --abort tests'

. ./test-lib.sh

+### Test that we handle strange characters properly
+work_dir="$(pwd)/test \" ' \$ \\ dir"
+
test_expect_success setup '
+ mkdir -p "$work_dir" &&
+ cd "$work_dir" &&
+ git init &&
echo a > a &&
git add a &&
git commit -m a &&
@@ -27,42 +33,45 @@ testrebase() {
type=$1
dotest=$2

- test_expect_success "rebase$type --abort" '
+ test_expect_success "rebase$type --abort" "
+ cd \"\$work_dir\" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d \"\$dotest\" &&
git rebase --abort &&
- test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
- '
+ test \$(git rev-parse to-rebase) = \$(git rev-parse pre-rebase) &&
+ test ! -d \"\$dotest\"
+ "

- test_expect_success "rebase$type --abort after --skip" '
+ test_expect_success "rebase$type --abort after --skip" "
+ cd \"\$work_dir\" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d \"\$dotest\" &&
test_must_fail git rebase --skip &&
- test $(git rev-parse HEAD) = $(git rev-parse master) &&
+ test \$(git rev-parse HEAD) = \$(git rev-parse master) &&
git-rebase --abort &&
- test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
- '
+ test \$(git rev-parse to-rebase) = \$(git rev-parse pre-rebase) &&
+ test ! -d \"\$dotest\"
+ "

- test_expect_success "rebase$type --abort after --continue" '
+ test_expect_success "rebase$type --abort after --continue" "
+ cd \"\$work_dir\" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d \"\$dotest\" &&
echo c > a &&
echo d >> a &&
git add a &&
test_must_fail git rebase --continue &&
- test $(git rev-parse HEAD) != $(git rev-parse master) &&
+ test \$(git rev-parse HEAD) != \$(git rev-parse master) &&
git rebase --abort &&
- test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
- '
+ test \$(git rev-parse to-rebase) = \$(git rev-parse pre-rebase) &&
+ test ! -d \"\$dotest\"
+ "
}

testrebase "" .dotest
--
1.5.5.33.gc0a39.dirty
Junio C Hamano
2008-04-10 07:45:51 UTC
Permalink
Bryan Donlan <***@fushizen.net> writes:

> +### Test that we handle strange characters properly

Thanks for the fix and updated tests.

> +work_dir="$(pwd)/test \" ' \$ \\ dir"
> +
> test_expect_success setup '
> + mkdir -p "$work_dir" &&
> + cd "$work_dir" &&
> + git init &&

As you know that $work_dir and shell variables in general are available
inside test_expect_* framework without anything special, like the above
code,...

> @@ -27,42 +33,45 @@ testrebase() {
> type=$1
> dotest=$2
>
> + test_expect_success "rebase$type --abort" "
> + cd \"\$work_dir\" &&
> # Clean up the state from the previous one
> + git reset --hard pre-rebase &&
> + test_must_fail git rebase$type master &&
> + test -d \"\$dotest\" &&
> ...

this part would become a lot easier to read if you just stayed inside the
original single quoted test script without introducing excessive
backslashes.

I am very inclined to replace t3407 with the following.

diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh
index 37944c3..cadfb23 100755
--- a/t/t3407-rebase-abort.sh
+++ b/t/t3407-rebase-abort.sh
@@ -4,7 +4,13 @@ test_description='git rebase --abort tests'

. ./test-lib.sh

+### Test that we handle strange characters properly
+work_dir="$(pwd)/test \" ' \$ \\ dir"
+
test_expect_success setup '
+ mkdir -p "$work_dir" &&
+ cd "$work_dir" &&
+ git init &&
echo a > a &&
git add a &&
git commit -m a &&
@@ -28,32 +34,35 @@ testrebase() {
dotest=$2

test_expect_success "rebase$type --abort" '
+ cd "$work_dir" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d "$dotest" &&
git rebase --abort &&
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
+ test ! -d "$dotest"
'

test_expect_success "rebase$type --abort after --skip" '
+ cd "$work_dir" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d "$dotest" &&
test_must_fail git rebase --skip &&
test $(git rev-parse HEAD) = $(git rev-parse master) &&
git-rebase --abort &&
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
+ test ! -d "$dotest"
'

test_expect_success "rebase$type --abort after --continue" '
+ cd "$work_dir" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d "$dotest" &&
echo c > a &&
echo d >> a &&
git add a &&
@@ -61,7 +70,7 @@ testrebase() {
test $(git rev-parse HEAD) != $(git rev-parse master) &&
git rebase --abort &&
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
+ test ! -d "$dotest"
'
}
Bryan Donlan
2008-04-10 08:48:20 UTC
Permalink
On Thu, Apr 10, 2008 at 12:45:51AM -0700, Junio C Hamano wrote:
> Bryan Donlan <***@fushizen.net> writes:
[snip]
> > + test_expect_success "rebase$type --abort" "
> > + cd \"\$work_dir\" &&
> > # Clean up the state from the previous one
> > + git reset --hard pre-rebase &&
> > + test_must_fail git rebase$type master &&
> > + test -d \"\$dotest\" &&
> > ...
>
> this part would become a lot easier to read if you just stayed inside the
> original single quoted test script without introducing excessive
> backslashes.

Oh, wow, what was I thinking? I'll fix that up... it must've been rather
late at night when I wrote that or something :)

Also, I saw your note about changing the git-svn tests to single-quoting
rather than escaping everywhere - but only after I hit send. I'll roll
that into the v3 (and probably wait longer than this time, so people
have time to finish reviewing...)

Thanks,

Bryan
Junio C Hamano
2008-04-11 22:37:22 UTC
Permalink
Junio C Hamano <***@pobox.com> writes:

> I am very inclined to replace t3407 with the following.
>
> diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh
> index 37944c3..cadfb23 100755
> --- a/t/t3407-rebase-abort.sh
> +++ b/t/t3407-rebase-abort.sh
> @@ -4,7 +4,13 @@ test_description='git rebase --abort tests'
>
> . ./test-lib.sh
>
> +### Test that we handle strange characters properly
> +work_dir="$(pwd)/test \" ' \$ \\ dir"
> +

Eh, I am sorry, but a slight change of plans. We would probably want to
exclude backslash from the above, so that we do not get inconsistent test
between DOSsy systems and others.

I think your "trash directory" is a reasonable way to test a very common
issue. SP is not all that unusual character to use in a pathname,
especially created from within a GUI-ish environment. So probably we
can do something similar here, like:

work_dir="$(pwd)/test dir"
Bryan Donlan
2008-05-04 05:37:56 UTC
Permalink
Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/test-lib.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index d7ad13b..04e098b 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -345,7 +345,7 @@ test_create_repo () {
repo="$1"
mkdir "$repo"
cd "$repo" || error "Cannot setup test environment"
- "$GIT_EXEC_PATH/git" init --template=$GIT_EXEC_PATH/templates/blt/ >/dev/null 2>&1 ||
+ "$GIT_EXEC_PATH/git" init "--template=$GIT_EXEC_PATH/templates/blt/" >/dev/null 2>&1 ||
error "cannot run git init -- have you built things yet?"
mv .git/hooks .git/hooks-disabled
cd "$owd"
--
1.5.5.1.128.g03a943
Bryan Donlan
2008-05-04 05:37:57 UTC
Permalink
Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/lib-git-svn.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 9decd2e..445df78 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -20,12 +20,13 @@ then
fi

svnrepo=$PWD/svnrepo
+export svnrepo

perl -w -e "
use SVN::Core;
use SVN::Repos;
\$SVN::Core::VERSION gt '1.1.0' or exit(42);
-system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or exit(41);
+system(qw/svnadmin create --fs-type fsfs/, \$ENV{svnrepo}) == 0 or exit(41);
" >&3 2>&4
x=$?
if test $x -ne 0
--
1.5.5.1.128.g03a943
Bryan Donlan
2008-05-04 05:38:00 UTC
Permalink
In order to help prevent regressions in the future, rename the trash directory
for all tests to contain spaces. This patch also corrects two failures that
were caused or exposed by this change.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/.gitignore | 2 +-
t/t6200-fmt-merge-msg.sh | 6 +++---
t/t9121-git-svn-fetch-renamed-dir.sh | 12 ++++++------
t/test-lib.sh | 4 ++--
4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/t/.gitignore b/t/.gitignore
index fad67c0..11ffd91 100644
--- a/t/.gitignore
+++ b/t/.gitignore
@@ -1 +1 @@
-trash
+/trash directory
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 526d7d1..9c0b926 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -82,14 +82,14 @@ test_expect_success 'merge-msg test #1' '
git diff actual expected
'

-cat >expected <<\EOF
-Merge branch 'left' of ../trash
+cat >expected <<EOF
+Merge branch 'left' of ../$test
EOF

test_expect_success 'merge-msg test #2' '

git checkout master &&
- git fetch ../trash left &&
+ git fetch ../"$test" left &&

git fmt-merge-msg <.git/FETCH_HEAD >actual &&
git diff actual expected
diff --git a/t/t9121-git-svn-fetch-renamed-dir.sh b/t/t9121-git-svn-fetch-renamed-dir.sh
index 5143ed6..99230b0 100755
--- a/t/t9121-git-svn-fetch-renamed-dir.sh
+++ b/t/t9121-git-svn-fetch-renamed-dir.sh
@@ -7,14 +7,14 @@ test_description='git-svn can fetch renamed directories'

. ./lib-git-svn.sh

-test_expect_success 'load repository with renamed directory' "
- svnadmin load -q $rawsvnrepo < ../t9121/renamed-dir.dump
- "
+test_expect_success 'load repository with renamed directory' '
+ svnadmin load -q "$rawsvnrepo" < ../t9121/renamed-dir.dump
+ '

-test_expect_success 'init and fetch repository' "
- git svn init $svnrepo/newname &&
+test_expect_success 'init and fetch repository' '
+ git svn init "$svnrepo/newname" &&
git svn fetch
- "
+ '

test_done

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 04e098b..5002fb0 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -411,14 +411,14 @@ fi
. ../GIT-BUILD-OPTIONS

# Test repository
-test=trash
+test="trash directory"
rm -fr "$test" || {
trap - exit
echo >&5 "FATAL: Cannot prepare test area"
exit 1
}

-test_create_repo $test
+test_create_repo "$test"
cd "$test"

this_test=$(expr "./$0" : '.*/\(t[0-9]*\)-[^/]*$')
--
1.5.5.1.128.g03a943
Bryan Donlan
2008-05-04 05:37:59 UTC
Permalink
This fixes the remainder of the issues where the test script itself is at
fault for failing when the git checkout path contains whitespace or other
shell metacharacters.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/t0000-basic.sh | 4 +-
t/t1020-subdirectory.sh | 22 ++--
t/t3050-subprojects-fetch.sh | 2 +-
t/t3404-rebase-interactive.sh | 3 +-
t/t5500-fetch-pack.sh | 2 +-
t/t5512-ls-remote.sh | 2 +-
t/t5516-fetch-push.sh | 6 +-
t/t5700-clone-reference.sh | 2 +-
t/t5710-info-alternate.sh | 4 +-
t/t7003-filter-branch.sh | 2 +-
t/t7010-setup.sh | 2 +-
t/t7300-clean.sh | 2 +-
t/t7501-commit.sh | 8 +-
t/t7504-commit-msg-hook.sh | 23 ++--
t/t7505-prepare-commit-msg-hook.sh | 17 ++-
t/t9100-git-svn-basic.sh | 120 +++++++++---------
t/t9101-git-svn-props.sh | 8 +-
t/t9102-git-svn-deep-rmdir.sh | 20 ++--
t/t9103-git-svn-tracked-directory-removed.sh | 20 ++--
t/t9104-git-svn-follow-parent.sh | 172 ++++++++++++------------
t/t9105-git-svn-commit-diff.sh | 32 +++---
t/t9106-git-svn-commit-diff-clobber.sh | 56 ++++----
t/t9106-git-svn-dcommit-clobber-series.sh | 30 ++--
t/t9107-git-svn-migrate.sh | 124 +++++++++---------
t/t9108-git-svn-glob.sh | 76 ++++++------
t/t9110-git-svn-use-svm-props.sh | 12 +-
t/t9111-git-svn-use-svnsync-props.sh | 12 +-
t/t9112-git-svn-md5less-file.sh | 4 +-
t/t9113-git-svn-dcommit-new-file.sh | 10 +-
t/t9114-git-svn-dcommit-merge.sh | 22 ++--
t/t9115-git-svn-dcommit-funky-renames.sh | 12 +-
t/t9116-git-svn-log.sh | 12 +-
t/t9117-git-svn-init-clone.sh | 30 ++--
t/t9118-git-svn-funky-branch-names.sh | 24 ++--
t/t9120-git-svn-clone-with-percent-escapes.sh | 6 +-
t/t9500-gitweb-standalone-no-errors.sh | 11 +-
36 files changed, 460 insertions(+), 454 deletions(-)

diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 27b54cb..690f80a 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -305,10 +305,10 @@ test_expect_success 'absolute path works as expected' '
file="$dir"/index &&
test "$file" = "$(test-absolute-path $dir2/index)" &&
basename=blub &&
- test "$dir/$basename" = $(cd .git && test-absolute-path $basename) &&
+ test "$dir/$basename" = "$(cd .git && test-absolute-path "$basename")" &&
ln -s ../first/file .git/syml &&
sym="$(cd first; pwd -P)"/file &&
- test "$sym" = "$(test-absolute-path $dir2/syml)"
+ test "$sym" = "$(test-absolute-path "$dir2/syml")"
'

test_expect_success 'very long name in the index handled sanely' '
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index b9cef34..fc386ba 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -21,7 +21,7 @@ LF='
'

test_expect_success 'update-index and ls-files' '
- cd $HERE &&
+ cd "$HERE" &&
git update-index --add one &&
case "`git ls-files`" in
one) echo ok one ;;
@@ -41,7 +41,7 @@ test_expect_success 'update-index and ls-files' '
'

test_expect_success 'cat-file' '
- cd $HERE &&
+ cd "$HERE" &&
two=`git ls-files -s dir/two` &&
two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
echo "$two" &&
@@ -54,7 +54,7 @@ test_expect_success 'cat-file' '
rm -f actual dir/actual

test_expect_success 'diff-files' '
- cd $HERE &&
+ cd "$HERE" &&
echo a >>one &&
echo d >>dir/two &&
case "`git diff-files --name-only`" in
@@ -74,7 +74,7 @@ test_expect_success 'diff-files' '
'

test_expect_success 'write-tree' '
- cd $HERE &&
+ cd "$HERE" &&
top=`git write-tree` &&
echo $top &&
cd dir &&
@@ -84,7 +84,7 @@ test_expect_success 'write-tree' '
'

test_expect_success 'checkout-index' '
- cd $HERE &&
+ cd "$HERE" &&
git checkout-index -f -u one &&
cmp one original.one &&
cd dir &&
@@ -93,7 +93,7 @@ test_expect_success 'checkout-index' '
'

test_expect_success 'read-tree' '
- cd $HERE &&
+ cd "$HERE" &&
rm -f one dir/two &&
tree=`git write-tree` &&
git read-tree --reset -u "$tree" &&
@@ -107,27 +107,27 @@ test_expect_success 'read-tree' '
'

test_expect_success 'no file/rev ambiguity check inside .git' '
- cd $HERE &&
+ cd "$HERE" &&
git commit -a -m 1 &&
- cd $HERE/.git &&
+ cd "$HERE"/.git &&
git show -s HEAD
'

test_expect_success 'no file/rev ambiguity check inside a bare repo' '
- cd $HERE &&
+ cd "$HERE" &&
git clone -s --bare .git foo.git &&
cd foo.git && GIT_DIR=. git show -s HEAD
'

# This still does not work as it should...
: test_expect_success 'no file/rev ambiguity check inside a bare repo' '
- cd $HERE &&
+ cd "$HERE" &&
git clone -s --bare .git foo.git &&
cd foo.git && git show -s HEAD
'

test_expect_success 'detection should not be fooled by a symlink' '
- cd $HERE &&
+ cd "$HERE" &&
rm -fr foo.git &&
git clone -s .git another &&
ln -s another yetanother &&
diff --git a/t/t3050-subprojects-fetch.sh b/t/t3050-subprojects-fetch.sh
index 2b21b10..4261e96 100755
--- a/t/t3050-subprojects-fetch.sh
+++ b/t/t3050-subprojects-fetch.sh
@@ -20,7 +20,7 @@ test_expect_success setup '
'

test_expect_success clone '
- git clone file://`pwd`/.git cloned &&
+ git clone "file://$(pwd)/.git" cloned &&
(git rev-parse HEAD; git ls-files -s) >expected &&
(
cd cloned &&
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 9cf873f..b9e3dbd 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -91,9 +91,8 @@ for line in $FAKE_LINES; do
done
EOF

+test_set_editor "$(pwd)/fake-editor.sh"
chmod a+x fake-editor.sh
-VISUAL="$(pwd)/fake-editor.sh"
-export VISUAL

test_expect_success 'no changes are a nop' '
git rebase -i F &&
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 1700d07..140e874 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -129,7 +129,7 @@ pull_to_client 2nd "B" $((64*3))

pull_to_client 3rd "A" $((1*3)) # old fails

-test_expect_success "clone shallow" "git-clone --depth 2 file://`pwd`/. shallow"
+test_expect_success "clone shallow" 'git-clone --depth 2 "file://$(pwd)/." shallow'

(cd shallow; git count-objects -v) > count.shallow

diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index c0dc949..1dd8eed 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -17,7 +17,7 @@ test_expect_success setup '
git show-ref -d | sed -e "s/ / /"
) >expected.all &&

- git remote add self $(pwd)/.git
+ git remote add self "$(pwd)/.git"

'

diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 0a757d5..3af03d4 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -105,7 +105,7 @@ test_expect_success 'fetch with insteadOf' '
(
TRASH=$(pwd)/ &&
cd testrepo &&
- git config url.$TRASH.insteadOf trash/
+ git config "url.$TRASH.insteadOf" trash/ &&
git config remote.up.url trash/. &&
git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
git fetch up &&
@@ -145,8 +145,8 @@ test_expect_success 'push with wildcard' '

test_expect_success 'push with insteadOf' '
mk_empty &&
- TRASH=$(pwd)/ &&
- git config url.$TRASH.insteadOf trash/ &&
+ TRASH="$(pwd)/" &&
+ git config "url./$TRASH/.insteadOf" trash/ &&
git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
(
cd testrepo &&
diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh
index b6a5486..e5619a9 100755
--- a/t/t5700-clone-reference.sh
+++ b/t/t5700-clone-reference.sh
@@ -51,7 +51,7 @@ diff expected current'
cd "$base_dir"

test_expect_success 'cloning with reference (no -l -s)' \
-'git clone --reference B file://`pwd`/A D'
+'git clone --reference B "file://$(pwd)/A" D'

cd "$base_dir"

diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh
index 910ccb4..ef7127c 100755
--- a/t/t5710-info-alternate.sh
+++ b/t/t5710-info-alternate.sh
@@ -81,9 +81,9 @@ test_valid_repo'
cd "$base_dir"

test_expect_success 'breaking of loops' \
-"echo '$base_dir/B/.git/objects' >> '$base_dir'/A/.git/objects/info/alternates&&
+'echo "$base_dir"/B/.git/objects >> "$base_dir"/A/.git/objects/info/alternates&&
cd C &&
-test_valid_repo"
+test_valid_repo'

cd "$base_dir"

diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index efd658a..fd09030 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -125,7 +125,7 @@ test_expect_success 'use index-filter to move into a subdirectory' '
"git ls-files -s | sed \"s-\\t-&newsubdir/-\" |
GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \
git update-index --index-info &&
- mv \$GIT_INDEX_FILE.new \$GIT_INDEX_FILE" directorymoved &&
+ mv \"\$GIT_INDEX_FILE.new\" \"\$GIT_INDEX_FILE\"" directorymoved &&
test -z "$(git diff HEAD directorymoved:newsubdir)"'

test_expect_success 'stops when msg filter fails' '
diff --git a/t/t7010-setup.sh b/t/t7010-setup.sh
index 02cf7c5..d8a7c79 100755
--- a/t/t7010-setup.sh
+++ b/t/t7010-setup.sh
@@ -122,7 +122,7 @@ test_expect_success 'commit using absolute path names' '

test_expect_success 'log using absolute path names' '
echo bb >>a/b/c/d &&
- git commit -m "bb" $(pwd)/a/b/c/d &&
+ git commit -m "bb" "$(pwd)/a/b/c/d" &&

git log a/b/c/d >f1.txt &&
git log "$(pwd)/a/b/c/d" >f2.txt &&
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index a50492f..bd77239 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -112,7 +112,7 @@ test_expect_success 'git-clean with absolute path' '
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
would_clean=$(
cd docs &&
- git clean -n $(pwd)/../src |
+ git clean -n "$(pwd)/../src" |
sed -n -e "s|^Would remove ||p"
) &&
test "$would_clean" = ../src/part3.c || {
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index c0288f3..e5fdb63 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -79,8 +79,8 @@ test_expect_success \

cat >editor <<\EOF
#!/bin/sh
-sed -e "s/a file/an amend commit/g" < $1 > $1-
-mv $1- $1
+sed -e "s/a file/an amend commit/g" < "$1" > "$1-"
+mv "$1-" "$1"
EOF
chmod 755 editor

@@ -99,8 +99,8 @@ test_expect_success \

cat >editor <<\EOF
#!/bin/sh
-sed -e "s/amend/older/g" < $1 > $1-
-mv $1- $1
+sed -e "s/amend/older/g" < "$1" > "$1-"
+mv "$1-" "$1"
EOF
chmod 755 editor

diff --git a/t/t7504-commit-msg-hook.sh b/t/t7504-commit-msg-hook.sh
index eff36aa..88577af 100755
--- a/t/t7504-commit-msg-hook.sh
+++ b/t/t7504-commit-msg-hook.sh
@@ -19,6 +19,9 @@ cp FAKE_MSG "$1"
exit 0
EOF
chmod +x fake-editor
+
+## Not using test_set_editor here so we can easily ensure the editor variable
+## is only set for the editor tests
FAKE_EDITOR="$(pwd)/fake-editor"
export FAKE_EDITOR

@@ -27,7 +30,7 @@ test_expect_success 'with no hook (editor)' '
echo "more foo" >> file &&
git add file &&
echo "more foo" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit

'

@@ -44,7 +47,7 @@ test_expect_success '--no-verify with no hook (editor)' '
echo "more bar" > file &&
git add file &&
echo "more bar" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -71,7 +74,7 @@ test_expect_success 'with succeeding hook (editor)' '
echo "more more" >> file &&
git add file &&
echo "more more" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit

'

@@ -88,7 +91,7 @@ test_expect_success '--no-verify with succeeding hook (editor)' '
echo "even more more" >> file &&
git add file &&
echo "even more more" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -111,7 +114,7 @@ test_expect_success 'with failing hook (editor)' '
echo "more another" >> file &&
git add file &&
echo "more another" > FAKE_MSG &&
- ! (GIT_EDITOR="$FAKE_EDITOR" git commit)
+ ! (GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit)

'

@@ -128,7 +131,7 @@ test_expect_success '--no-verify with failing hook (editor)' '
echo "more stuff" >> file &&
git add file &&
echo "more stuff" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -146,7 +149,7 @@ test_expect_success 'with non-executable hook (editor)' '
echo "content again" >> file &&
git add file &&
echo "content again" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit -m "content again"
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -m "content again"

'

@@ -163,7 +166,7 @@ test_expect_success '--no-verify with non-executable hook (editor)' '
echo "even more content" >> file &&
git add file &&
echo "even more content" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify

'

@@ -193,7 +196,7 @@ test_expect_success 'hook edits commit message (editor)' '
echo "additional content" >> file &&
git add file &&
echo "additional content" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit &&
commit_msg_is "new message"

'
@@ -212,7 +215,7 @@ test_expect_success "hook doesn't edit commit message (editor)" '
echo "more plus" >> file &&
git add file &&
echo "more plus" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify &&
commit_msg_is "more plus"

'
diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh
index 802aa62..cd6c7c8 100755
--- a/t/t7505-prepare-commit-msg-hook.sh
+++ b/t/t7505-prepare-commit-msg-hook.sh
@@ -18,6 +18,9 @@ cat > fake-editor <<'EOF'
exit 0
EOF
chmod +x fake-editor
+
+## Not using test_set_editor here so we can easily ensure the editor variable
+## is only set for the editor tests
FAKE_EDITOR="$(pwd)/fake-editor"
export FAKE_EDITOR

@@ -58,7 +61,7 @@ test_expect_success 'with hook (-m editor)' '

echo "more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit -e -m "more more" &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -e -m "more more" &&
test "`git log -1 --pretty=format:%s`" = message

'
@@ -85,7 +88,7 @@ test_expect_success 'with hook (-F editor)' '

echo "more" >> file &&
git add file &&
- (echo more more | GIT_EDITOR="$FAKE_EDITOR" git commit -e -F -) &&
+ (echo more more | GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -e -F -) &&
test "`git log -1 --pretty=format:%s`" = message

'
@@ -104,7 +107,7 @@ test_expect_success 'with hook (editor)' '

echo "more more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit &&
test "`git log -1 --pretty=format:%s`" = default

'
@@ -114,7 +117,7 @@ test_expect_success 'with hook (--amend)' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --amend &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --amend &&
test "`git log -1 --pretty=format:%s`" = "$head"

'
@@ -124,7 +127,7 @@ test_expect_success 'with hook (-c)' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- GIT_EDITOR="$FAKE_EDITOR" git commit -c $head &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head &&
test "`git log -1 --pretty=format:%s`" = "$head"

'
@@ -139,7 +142,7 @@ test_expect_success 'with failing hook' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- ! GIT_EDITOR="$FAKE_EDITOR" git commit -c $head
+ ! GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head

'

@@ -148,7 +151,7 @@ test_expect_success 'with failing hook (--no-verify)' '
head=`git rev-parse HEAD` &&
echo "more" >> file &&
git add file &&
- ! GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify -c $head
+ ! GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify -c $head

'

diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 4e24ab3..bdf29c1 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -20,39 +20,39 @@ esac
echo 'define NO_SVN_TESTS to skip git-svn tests'

test_expect_success \
- 'initialize git-svn' "
+ 'initialize git-svn' '
mkdir import &&
cd import &&
echo foo > foo &&
ln -s foo foo.link
mkdir -p dir/a/b/c/d/e &&
- echo 'deep dir' > dir/a/b/c/d/e/file &&
+ echo "deep dir" > dir/a/b/c/d/e/file &&
mkdir bar &&
- echo 'zzz' > bar/zzz &&
- echo '#!/bin/sh' > exec.sh &&
+ echo "zzz" > bar/zzz &&
+ echo "#!/bin/sh" > exec.sh &&
chmod +x exec.sh &&
- svn import -m 'import for git-svn' . $svnrepo >/dev/null &&
+ svn import -m "import for git-svn" . "$svnrepo" >/dev/null &&
cd .. &&
rm -rf import &&
- git-svn init $svnrepo"
+ git-svn init "$svnrepo"'

test_expect_success \
'import an SVN revision into git' \
'git-svn fetch'

-test_expect_success "checkout from svn" "svn co $svnrepo '$SVN_TREE'"
+test_expect_success "checkout from svn" 'svn co "$svnrepo" "$SVN_TREE"'

name='try a deep --rmdir with a commit'
-test_expect_success "$name" "
+test_expect_success "$name" '
git checkout -f -b mybranch remotes/git-svn &&
mv dir/a/b/c/d/e/file dir/file &&
cp dir/file file &&
git update-index --add --remove dir/a/b/c/d/e/file dir/file file &&
- git commit -m '$name' &&
+ git commit -m "$name" &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch &&
- svn up '$SVN_TREE' &&
- test -d '$SVN_TREE'/dir && test ! -d '$SVN_TREE'/dir/a"
+ svn up "$SVN_TREE" &&
+ test -d "$SVN_TREE"/dir && test ! -d "$SVN_TREE"/dir/a'


name='detect node change from file to directory #1'
@@ -68,108 +68,108 @@ test_expect_success "$name" "


name='detect node change from directory to file #1'
-test_expect_success "$name" "
- rm -rf dir '$GIT_DIR'/index &&
+test_expect_success "$name" '
+ rm -rf dir "$GIT_DIR"/index &&
git checkout -f -b mybranch2 remotes/git-svn &&
mv bar/zzz zzz &&
rm -rf bar &&
mv zzz bar &&
git update-index --remove -- bar/zzz &&
git update-index --add -- bar &&
- git commit -m '$name' &&
+ git commit -m "$name" &&
! git-svn set-tree --find-copies-harder --rmdir \
- remotes/git-svn..mybranch2" || true
+ remotes/git-svn..mybranch2' || true


name='detect node change from file to directory #2'
-test_expect_success "$name" "
- rm -f '$GIT_DIR'/index &&
+test_expect_success "$name" '
+ rm -f "$GIT_DIR"/index &&
git checkout -f -b mybranch3 remotes/git-svn &&
rm bar/zzz &&
git update-index --remove bar/zzz &&
mkdir bar/zzz &&
echo yyy > bar/zzz/yyy &&
git update-index --add bar/zzz/yyy &&
- git commit -m '$name' &&
+ git commit -m "$name" &&
! git-svn set-tree --find-copies-harder --rmdir \
- remotes/git-svn..mybranch3" || true
+ remotes/git-svn..mybranch3' || true


name='detect node change from directory to file #2'
-test_expect_success "$name" "
- rm -f '$GIT_DIR'/index &&
+test_expect_success "$name" '
+ rm -f "$GIT_DIR"/index &&
git checkout -f -b mybranch4 remotes/git-svn &&
rm -rf dir &&
git update-index --remove -- dir/file &&
touch dir &&
echo asdf > dir &&
git update-index --add -- dir &&
- git commit -m '$name' &&
+ git commit -m "$name" &&
! git-svn set-tree --find-copies-harder --rmdir \
- remotes/git-svn..mybranch4" || true
+ remotes/git-svn..mybranch4' || true


name='remove executable bit from a file'
-test_expect_success "$name" "
- rm -f '$GIT_DIR'/index &&
+test_expect_success "$name" '
+ rm -f "$GIT_DIR"/index &&
git checkout -f -b mybranch5 remotes/git-svn &&
chmod -x exec.sh &&
git update-index exec.sh &&
- git commit -m '$name' &&
+ git commit -m "$name" &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test ! -x '$SVN_TREE'/exec.sh"
+ svn up "$SVN_TREE" &&
+ test ! -x "$SVN_TREE"/exec.sh'


name='add executable bit back file'
-test_expect_success "$name" "
+test_expect_success "$name" '
chmod +x exec.sh &&
git update-index exec.sh &&
- git commit -m '$name' &&
+ git commit -m "$name" &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -x '$SVN_TREE'/exec.sh"
+ svn up "$SVN_TREE" &&
+ test -x "$SVN_TREE"/exec.sh'


name='executable file becomes a symlink to bar/zzz (file)'
-test_expect_success "$name" "
+test_expect_success "$name" '
rm exec.sh &&
ln -s bar/zzz exec.sh &&
git update-index exec.sh &&
- git commit -m '$name' &&
+ git commit -m "$name" &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -L '$SVN_TREE'/exec.sh"
+ svn up "$SVN_TREE" &&
+ test -L "$SVN_TREE"/exec.sh'

name='new symlink is added to a file that was also just made executable'

-test_expect_success "$name" "
+test_expect_success "$name" '
chmod +x bar/zzz &&
ln -s bar/zzz exec-2.sh &&
git update-index --add bar/zzz exec-2.sh &&
- git commit -m '$name' &&
+ git commit -m "$name" &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -x '$SVN_TREE'/bar/zzz &&
- test -L '$SVN_TREE'/exec-2.sh"
+ svn up "$SVN_TREE" &&
+ test -x "$SVN_TREE"/bar/zzz &&
+ test -L "$SVN_TREE"/exec-2.sh'

name='modify a symlink to become a file'
-test_expect_success "$name" "
+test_expect_success "$name" '
echo git help > help || true &&
rm exec-2.sh &&
cp help exec-2.sh &&
git update-index exec-2.sh &&
- git commit -m '$name' &&
+ git commit -m "$name" &&
git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch5 &&
- svn up '$SVN_TREE' &&
- test -f '$SVN_TREE'/exec-2.sh &&
- test ! -L '$SVN_TREE'/exec-2.sh &&
- git diff help $SVN_TREE/exec-2.sh"
+ svn up "$SVN_TREE" &&
+ test -f "$SVN_TREE"/exec-2.sh &&
+ test ! -L "$SVN_TREE"/exec-2.sh &&
+ git diff help "$SVN_TREE"/exec-2.sh'

if test "$have_utf8" = t
then
@@ -190,10 +190,10 @@ name='test fetch functionality (svn => git) with alternate GIT_SVN_ID'
GIT_SVN_ID=alt
export GIT_SVN_ID
test_expect_success "$name" \
- "git-svn init $svnrepo && git-svn fetch &&
+ 'git-svn init "$svnrepo" && git-svn fetch &&
git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
- git diff a b"
+ git diff a b'

name='check imported tree checksums expected tree checksums'
rm -f expected
@@ -219,22 +219,22 @@ test_expect_success 'exit if remote refs are ambigious' "
! git-svn migrate
"

-test_expect_success 'exit if init-ing a would clobber a URL' "
- svnadmin create ${PWD}/svnrepo2 &&
- svn mkdir -m 'mkdir bar' ${svnrepo}2/bar &&
+test_expect_success 'exit if init-ing a would clobber a URL' '
+ svnadmin create "${PWD}/svnrepo2" &&
+ svn mkdir -m "mkdir bar" "${svnrepo}2/bar" &&
git config --unset svn-remote.svn.fetch \
- '^bar:refs/remotes/git-svn$' &&
- ! git-svn init ${svnrepo}2/bar
- "
+ "^bar:refs/remotes/git-svn$" &&
+ ! git-svn init "${svnrepo}2/bar"
+ '

test_expect_success \
- 'init allows us to connect to another directory in the same repo' "
- git-svn init --minimize-url -i bar $svnrepo/bar &&
+ 'init allows us to connect to another directory in the same repo' '
+ git-svn init --minimize-url -i bar "$svnrepo/bar" &&
git config --get svn-remote.svn.fetch \
- '^bar:refs/remotes/bar$' &&
+ "^bar:refs/remotes/bar$" &&
git config --get svn-remote.svn.fetch \
- '^:refs/remotes/git-svn$'
- "
+ "^:refs/remotes/git-svn$"
+ '

test_expect_success 'able to dcommit to a subdirectory' "
git-svn fetch -i bar &&
diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
index d7a7047..f420796 100755
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
@@ -52,7 +52,7 @@ EOF
cd ..

rm -rf import
-test_expect_success 'checkout working copy from svn' "svn co $svnrepo test_wc"
+test_expect_success 'checkout working copy from svn' 'svn co "$svnrepo" test_wc'
test_expect_success 'setup some commits to svn' \
'cd test_wc &&
echo Greetings >> kw.c &&
@@ -66,7 +66,7 @@ test_expect_success 'setup some commits to svn' \
svn commit -m "Propset Id" &&
cd ..'

-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' 'git-svn init "$svnrepo"'
test_expect_success 'fetch revisions from svn' 'git-svn fetch'

name='test svn:keywords ignoring'
@@ -90,9 +90,9 @@ test_expect_success "propset CR on crlf files" \
cd ..'

test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
- "git-svn fetch &&
+ 'git-svn fetch &&
git pull . remotes/git-svn &&
- svn co $svnrepo new_wc"
+ svn co "$svnrepo" new_wc'

for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
do
diff --git a/t/t9102-git-svn-deep-rmdir.sh b/t/t9102-git-svn-deep-rmdir.sh
index 4e08083..0e7ce34 100755
--- a/t/t9102-git-svn-deep-rmdir.sh
+++ b/t/t9102-git-svn-deep-rmdir.sh
@@ -2,29 +2,29 @@
test_description='git-svn rmdir'
. ./lib-git-svn.sh

-test_expect_success 'initialize repo' "
+test_expect_success 'initialize repo' '
mkdir import &&
cd import &&
mkdir -p deeply/nested/directory/number/1 &&
mkdir -p deeply/nested/directory/number/2 &&
echo foo > deeply/nested/directory/number/1/file &&
echo foo > deeply/nested/directory/number/2/another &&
- svn import -m 'import for git-svn' . $svnrepo &&
+ svn import -m "import for git-svn" . "$svnrepo" &&
cd ..
- "
+ '

-test_expect_success 'mirror via git-svn' "
- git-svn init $svnrepo &&
+test_expect_success 'mirror via git-svn' '
+ git-svn init "$svnrepo" &&
git-svn fetch &&
git checkout -f -b test-rmdir remotes/git-svn
- "
+ '

-test_expect_success 'Try a commit on rmdir' "
+test_expect_success 'Try a commit on rmdir' '
git rm -f deeply/nested/directory/number/2/another &&
- git commit -a -m 'remove another' &&
+ git commit -a -m "remove another" &&
git-svn set-tree --rmdir HEAD &&
- svn ls -R $svnrepo | grep ^deeply/nested/directory/number/1
- "
+ svn ls -R "$svnrepo" | grep ^deeply/nested/directory/number/1
+ '


test_done
diff --git a/t/t9103-git-svn-tracked-directory-removed.sh b/t/t9103-git-svn-tracked-directory-removed.sh
index 0f0b0fd..9ffd845 100755
--- a/t/t9103-git-svn-tracked-directory-removed.sh
+++ b/t/t9103-git-svn-tracked-directory-removed.sh
@@ -10,30 +10,30 @@ test_expect_success 'make history for tracking' '
mkdir import &&
mkdir import/trunk &&
echo hello >> import/trunk/README &&
- svn import -m initial import $svnrepo &&
+ svn import -m initial import "$svnrepo" &&
rm -rf import &&
- svn co $svnrepo/trunk trunk &&
+ svn co "$svnrepo"/trunk trunk &&
echo bye bye >> trunk/README &&
- svn rm -m "gone" $svnrepo/trunk &&
+ svn rm -m "gone" "$svnrepo"/trunk &&
rm -rf trunk &&
mkdir trunk &&
echo "new" > trunk/FOLLOWME &&
- svn import -m "new trunk" trunk $svnrepo/trunk
+ svn import -m "new trunk" trunk "$svnrepo"/trunk
'

test_expect_success 'clone repo with git' '
- git svn clone -s $svnrepo x &&
+ git svn clone -s "$svnrepo" x &&
test -f x/FOLLOWME &&
test ! -f x/README
'

-test_expect_success 'make sure r2 still has old file' '
+test_expect_success 'make sure r2 still has old file' "
cd x &&
- test -n "$(git svn find-rev r1)" &&
- git reset --hard $(git svn find-rev r1) &&
+ test -n \"\$(git svn find-rev r1)\" &&
+ git reset --hard \$(git svn find-rev r1) &&
test -f README &&
test ! -f FOLLOWME &&
- test x$(git svn find-rev r2) = x
-'
+ test x\$(git svn find-rev r2) = x
+"

test_done
diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index 7ba7630..4d964e2 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -6,165 +6,165 @@
test_description='git-svn fetching'
. ./lib-git-svn.sh

-test_expect_success 'initialize repo' "
+test_expect_success 'initialize repo' '
mkdir import &&
cd import &&
mkdir -p trunk &&
echo hello > trunk/readme &&
- svn import -m 'initial' . $svnrepo &&
+ svn import -m "initial" . "$svnrepo" &&
cd .. &&
- svn co $svnrepo wc &&
+ svn co "$svnrepo" wc &&
cd wc &&
echo world >> trunk/readme &&
poke trunk/readme &&
- svn commit -m 'another commit' &&
+ svn commit -m "another commit" &&
svn up &&
svn mv trunk thunk &&
echo goodbye >> thunk/readme &&
poke thunk/readme &&
- svn commit -m 'bye now' &&
+ svn commit -m "bye now" &&
cd ..
- "
+ '

-test_expect_success 'init and fetch a moved directory' "
- git-svn init --minimize-url -i thunk $svnrepo/thunk &&
+test_expect_success 'init and fetch a moved directory' '
+ git-svn init --minimize-url -i thunk "$svnrepo"/thunk &&
git-svn fetch -i thunk &&
- test \"\`git rev-parse --verify refs/remotes/***@2\`\" \
- = \"\`git rev-parse --verify refs/remotes/thunk~1\`\" &&
- test \"\`git cat-file blob refs/remotes/thunk:readme |\
- sed -n -e '3p'\`\" = goodbye &&
- test -z \"\`git config --get svn-remote.svn.fetch \
- '^trunk:refs/remotes/***@2$'\`\"
- "
+ test "`git rev-parse --verify refs/remotes/***@2`" \
+ = "`git rev-parse --verify refs/remotes/thunk~1`" &&
+ test "`git cat-file blob refs/remotes/thunk:readme |\
+ sed -n -e "3p"`" = goodbye &&
+ test -z "`git config --get svn-remote.svn.fetch \
+ "^trunk:refs/remotes/***@2$"`"
+ '

-test_expect_success 'init and fetch from one svn-remote' "
- git config svn-remote.svn.url $svnrepo &&
+test_expect_success 'init and fetch from one svn-remote' '
+ git config svn-remote.svn.url "$svnrepo" &&
git config --add svn-remote.svn.fetch \
trunk:refs/remotes/svn/trunk &&
git config --add svn-remote.svn.fetch \
thunk:refs/remotes/svn/thunk &&
git-svn fetch -i svn/thunk &&
- test \"\`git rev-parse --verify refs/remotes/svn/trunk\`\" \
- = \"\`git rev-parse --verify refs/remotes/svn/thunk~1\`\" &&
- test \"\`git cat-file blob refs/remotes/svn/thunk:readme |\
- sed -n -e '3p'\`\" = goodbye
- "
+ test "`git rev-parse --verify refs/remotes/svn/trunk`" \
+ = "`git rev-parse --verify refs/remotes/svn/thunk~1`" &&
+ test "`git cat-file blob refs/remotes/svn/thunk:readme |\
+ sed -n -e "3p"`" = goodbye
+ '

-test_expect_success 'follow deleted parent' "
- (svn cp -m 'resurrecting trunk as junk' \
- $svnrepo/***@2 $svnrepo/junk ||
- svn cp -m 'resurrecting trunk as junk' \
- -r2 $svnrepo/trunk $svnrepo/junk) &&
+test_expect_success 'follow deleted parent' '
+ (svn cp -m "resurrecting trunk as junk" \
+ "$svnrepo"/***@2 "$svnrepo"/junk ||
+ svn cp -m "resurrecting trunk as junk" \
+ -r2 "$svnrepo"/trunk "$svnrepo"/junk) &&
git config --add svn-remote.svn.fetch \
junk:refs/remotes/svn/junk &&
git-svn fetch -i svn/thunk &&
git-svn fetch -i svn/junk &&
- test -z \"\`git diff svn/junk svn/trunk\`\" &&
- test \"\`git merge-base svn/junk svn/trunk\`\" \
- = \"\`git rev-parse svn/trunk\`\"
- "
+ test -z "`git diff svn/junk svn/trunk`" &&
+ test "`git merge-base svn/junk svn/trunk`" \
+ = "`git rev-parse svn/trunk`"
+ '

-test_expect_success 'follow larger parent' "
+test_expect_success 'follow larger parent' '
mkdir -p import/trunk/thunk/bump/thud &&
echo hi > import/trunk/thunk/bump/thud/file &&
- svn import -m 'import a larger parent' import $svnrepo/larger-parent &&
- svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger &&
+ svn import -m "import a larger parent" import "$svnrepo"/larger-parent &&
+ svn cp -m "hi" "$svnrepo"/larger-parent "$svnrepo"/another-larger &&
git-svn init --minimize-url -i larger \
- $svnrepo/another-larger/trunk/thunk/bump/thud &&
+ "$svnrepo"/another-larger/trunk/thunk/bump/thud &&
git-svn fetch -i larger &&
git rev-parse --verify refs/remotes/larger &&
git rev-parse --verify \
refs/remotes/larger-parent/trunk/thunk/bump/thud &&
- test \"\`git merge-base \
+ test "`git merge-base \
refs/remotes/larger-parent/trunk/thunk/bump/thud \
- refs/remotes/larger\`\" = \
- \"\`git rev-parse refs/remotes/larger\`\"
+ refs/remotes/larger`" = \
+ "`git rev-parse refs/remotes/larger`"
true
- "
+ '

-test_expect_success 'follow higher-level parent' "
- svn mkdir -m 'follow higher-level parent' $svnrepo/blob &&
- svn co $svnrepo/blob blob &&
+test_expect_success 'follow higher-level parent' '
+ svn mkdir -m "follow higher-level parent" "$svnrepo"/blob &&
+ svn co "$svnrepo"/blob blob &&
cd blob &&
echo hi > hi &&
svn add hi &&
- svn commit -m 'hihi' &&
+ svn commit -m "hihi" &&
cd ..
- svn mkdir -m 'new glob at top level' $svnrepo/glob &&
- svn mv -m 'move blob down a level' $svnrepo/blob $svnrepo/glob/blob &&
- git-svn init --minimize-url -i blob $svnrepo/glob/blob &&
+ svn mkdir -m "new glob at top level" "$svnrepo"/glob &&
+ svn mv -m "move blob down a level" "$svnrepo"/blob "$svnrepo"/glob/blob &&
+ git-svn init --minimize-url -i blob "$svnrepo"/glob/blob &&
git-svn fetch -i blob
- "
+ '

-test_expect_success 'follow deleted directory' "
- svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye &&
- svn rm -m 'remove glob' $svnrepo/glob &&
- git-svn init --minimize-url -i glob $svnrepo/glob &&
+test_expect_success 'follow deleted directory' '
+ svn mv -m "bye!" "$svnrepo"/glob/blob/hi "$svnrepo"/glob/blob/bye &&
+ svn rm -m "remove glob" "$svnrepo"/glob &&
+ git-svn init --minimize-url -i glob "$svnrepo"/glob &&
git-svn fetch -i glob &&
- test \"\`git cat-file blob refs/remotes/glob:blob/bye\`\" = hi &&
- test \"\`git ls-tree refs/remotes/glob | wc -l \`\" -eq 1
- "
+ test "`git cat-file blob refs/remotes/glob:blob/bye`" = hi &&
+ test "`git ls-tree refs/remotes/glob | wc -l `" -eq 1
+ '

# ref: r9270 of the Subversion repository: (http://svn.collab.net/repos/svn)
# in trunk/subversion/bindings/swig/perl
-test_expect_success 'follow-parent avoids deleting relevant info' "
+test_expect_success 'follow-parent avoids deleting relevant info' '
mkdir -p import/trunk/subversion/bindings/swig/perl/t &&
for i in a b c ; do \
- echo \$i > import/trunk/subversion/bindings/swig/perl/\$i.pm &&
- echo _\$i > import/trunk/subversion/bindings/swig/perl/t/\$i.t; \
+ echo $i > import/trunk/subversion/bindings/swig/perl/$i.pm &&
+ echo _$i > import/trunk/subversion/bindings/swig/perl/t/$i.t; \
done &&
- echo 'bad delete test' > \
+ echo "bad delete test" > \
import/trunk/subversion/bindings/swig/perl/t/larger-parent &&
- echo 'bad delete test 2' > \
+ echo "bad delete test 2" > \
import/trunk/subversion/bindings/swig/perl/another-larger &&
cd import &&
- svn import -m 'r9270 test' . $svnrepo/r9270 &&
+ svn import -m "r9270 test" . "$svnrepo"/r9270 &&
cd .. &&
- svn co $svnrepo/r9270/trunk/subversion/bindings/swig/perl r9270 &&
+ svn co "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl r9270 &&
cd r9270 &&
svn mkdir native &&
svn mv t native/t &&
- for i in a b c; do svn mv \$i.pm native/\$i.pm; done &&
+ for i in a b c; do svn mv $i.pm native/$i.pm; done &&
echo z >> native/t/c.t &&
poke native/t/c.t &&
- svn commit -m 'reorg test' &&
+ svn commit -m "reorg test" &&
cd .. &&
git-svn init --minimize-url -i r9270-t \
- $svnrepo/r9270/trunk/subversion/bindings/swig/perl/native/t &&
+ "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl/native/t &&
git-svn fetch -i r9270-t &&
- test \`git rev-list r9270-t | wc -l\` -eq 2 &&
- test \"\`git ls-tree --name-only r9270-t~1\`\" = \
- \"\`git ls-tree --name-only r9270-t\`\"
- "
+ test `git rev-list r9270-t | wc -l` -eq 2 &&
+ test "`git ls-tree --name-only r9270-t~1`" = \
+ "`git ls-tree --name-only r9270-t`"
+ '

-test_expect_success "track initial change if it was only made to parent" "
- svn cp -m 'wheee!' $svnrepo/r9270/trunk $svnrepo/r9270/drunk &&
+test_expect_success "track initial change if it was only made to parent" '
+ svn cp -m "wheee!" "$svnrepo"/r9270/trunk "$svnrepo"/r9270/drunk &&
git-svn init --minimize-url -i r9270-d \
- $svnrepo/r9270/drunk/subversion/bindings/swig/perl/native/t &&
+ "$svnrepo"/r9270/drunk/subversion/bindings/swig/perl/native/t &&
git-svn fetch -i r9270-d &&
- test \`git rev-list r9270-d | wc -l\` -eq 3 &&
- test \"\`git ls-tree --name-only r9270-t\`\" = \
- \"\`git ls-tree --name-only r9270-d\`\" &&
- test \"\`git rev-parse r9270-t\`\" = \
- \"\`git rev-parse r9270-d~1\`\"
- "
+ test `git rev-list r9270-d | wc -l` -eq 3 &&
+ test "`git ls-tree --name-only r9270-t`" = \
+ "`git ls-tree --name-only r9270-d`" &&
+ test "`git rev-parse r9270-t`" = \
+ "`git rev-parse r9270-d~1`"
+ '

-test_expect_success "track multi-parent paths" "
- svn cp -m 'resurrect /glob' $svnrepo/r9270 $svnrepo/glob &&
+test_expect_success "track multi-parent paths" '
+ svn cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
git-svn multi-fetch &&
- test \`git cat-file commit refs/remotes/glob | \
- grep '^parent ' | wc -l\` -eq 2
- "
+ test `git cat-file commit refs/remotes/glob | \
+ grep "^parent " | wc -l` -eq 2
+ '

test_expect_success "multi-fetch continues to work" "
git-svn multi-fetch
"

-test_expect_success "multi-fetch works off a 'clean' repository" "
- rm -r $GIT_DIR/svn $GIT_DIR/refs/remotes $GIT_DIR/logs &&
- mkdir $GIT_DIR/svn &&
+test_expect_success "multi-fetch works off a 'clean' repository" '
+ rm -r "$GIT_DIR/svn" "$GIT_DIR/refs/remotes" "$GIT_DIR/logs" &&
+ mkdir "$GIT_DIR/svn" &&
git-svn multi-fetch
- "
+ '

test_debug 'gitk --all &'

diff --git a/t/t9105-git-svn-commit-diff.sh b/t/t9105-git-svn-commit-diff.sh
index 318e172..6323036 100755
--- a/t/t9105-git-svn-commit-diff.sh
+++ b/t/t9105-git-svn-commit-diff.sh
@@ -4,18 +4,18 @@
test_description='git-svn commit-diff'
. ./lib-git-svn.sh

-test_expect_success 'initialize repo' "
+test_expect_success 'initialize repo' '
mkdir import &&
cd import &&
echo hello > readme &&
- svn import -m 'initial' . $svnrepo &&
+ svn import -m "initial" . "$svnrepo" &&
cd .. &&
echo hello > readme &&
git update-index --add readme &&
- git commit -a -m 'initial' &&
+ git commit -a -m "initial" &&
echo world >> readme &&
- git commit -a -m 'another'
- "
+ git commit -a -m "another"
+ '

head=`git rev-parse --verify HEAD^0`
prev=`git rev-parse --verify HEAD^1`
@@ -24,20 +24,20 @@ prev=`git rev-parse --verify HEAD^1`
# commit, so only a basic test of functionality is needed since we've
# already tested commit extensively elsewhere

-test_expect_success 'test the commit-diff command' "
- test -n '$prev' && test -n '$head' &&
- git-svn commit-diff -r1 '$prev' '$head' '$svnrepo' &&
- svn co $svnrepo wc &&
+test_expect_success 'test the commit-diff command' '
+ test -n "$prev" && test -n "$head" &&
+ git-svn commit-diff -r1 "$prev" "$head" "$svnrepo" &&
+ svn co "$svnrepo" wc &&
cmp readme wc/readme
- "
+ '

-test_expect_success 'commit-diff to a sub-directory (with git-svn config)' "
- svn import -m 'sub-directory' import $svnrepo/subdir &&
- git-svn init --minimize-url $svnrepo/subdir &&
+test_expect_success 'commit-diff to a sub-directory (with git-svn config)' '
+ svn import -m "sub-directory" import "$svnrepo"/subdir &&
+ git-svn init --minimize-url "$svnrepo"/subdir &&
git-svn fetch &&
- git-svn commit-diff -r3 '$prev' '$head' &&
- svn cat $svnrepo/subdir/readme > readme.2 &&
+ git-svn commit-diff -r3 "$prev" "$head" &&
+ svn cat "$svnrepo"/subdir/readme > readme.2 &&
cmp readme readme.2
- "
+ '

test_done
diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh
index f74ab12..58a3a7b 100755
--- a/t/t9106-git-svn-commit-diff-clobber.sh
+++ b/t/t9106-git-svn-commit-diff-clobber.sh
@@ -4,56 +4,56 @@
test_description='git-svn commit-diff clobber'
. ./lib-git-svn.sh

-test_expect_success 'initialize repo' "
+test_expect_success 'initialize repo' '
mkdir import &&
cd import &&
echo initial > file &&
- svn import -m 'initial' . $svnrepo &&
+ svn import -m "initial" . "$svnrepo" &&
cd .. &&
echo initial > file &&
git update-index --add file &&
- git commit -a -m 'initial'
- "
-test_expect_success 'commit change from svn side' "
- svn co $svnrepo t.svn &&
+ git commit -a -m "initial"
+ '
+test_expect_success 'commit change from svn side' '
+ svn co "$svnrepo" t.svn &&
cd t.svn &&
echo second line from svn >> file &&
poke file &&
- svn commit -m 'second line from svn' &&
+ svn commit -m "second line from svn" &&
cd .. &&
rm -rf t.svn
- "
+ '

-test_expect_success 'commit conflicting change from git' "
+test_expect_success 'commit conflicting change from git' '
echo second line from git >> file &&
- git commit -a -m 'second line from git' &&
- ! git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
-"
+ git commit -a -m "second line from git" &&
+ ! git-svn commit-diff -r1 HEAD~1 HEAD "$svnrepo"
+'

-test_expect_success 'commit complementing change from git' "
+test_expect_success 'commit complementing change from git' '
git reset --hard HEAD~1 &&
echo second line from svn >> file &&
- git commit -a -m 'second line from svn' &&
+ git commit -a -m "second line from svn" &&
echo third line from git >> file &&
- git commit -a -m 'third line from git' &&
- git-svn commit-diff -r2 HEAD~1 HEAD $svnrepo
- "
+ git commit -a -m "third line from git" &&
+ git-svn commit-diff -r2 HEAD~1 HEAD "$svnrepo"
+ '

-test_expect_success 'dcommit fails to commit because of conflict' "
- git-svn init $svnrepo &&
+test_expect_success 'dcommit fails to commit because of conflict' '
+ git-svn init "$svnrepo" &&
git-svn fetch &&
git reset --hard refs/remotes/git-svn &&
- svn co $svnrepo t.svn &&
+ svn co "$svnrepo" t.svn &&
cd t.svn &&
echo fourth line from svn >> file &&
poke file &&
- svn commit -m 'fourth line from svn' &&
+ svn commit -m "fourth line from svn" &&
cd .. &&
rm -rf t.svn &&
- echo 'fourth line from git' >> file &&
- git commit -a -m 'fourth line from git' &&
+ echo "fourth line from git" >> file &&
+ git commit -a -m "fourth line from git" &&
! git-svn dcommit
- "
+ '

test_expect_success 'dcommit does the svn equivalent of an index merge' "
git reset --hard refs/remotes/git-svn &&
@@ -66,15 +66,15 @@ test_expect_success 'dcommit does the svn equivalent of an index merge' "
git-svn dcommit
"

-test_expect_success 'commit another change from svn side' "
- svn co $svnrepo t.svn &&
+test_expect_success 'commit another change from svn side' '
+ svn co "$svnrepo" t.svn &&
cd t.svn &&
echo third line from svn >> file &&
poke file &&
- svn commit -m 'third line from svn' &&
+ svn commit -m "third line from svn" &&
cd .. &&
rm -rf t.svn
- "
+ '

test_expect_success 'multiple dcommit from git-svn will not clobber svn' "
git reset --hard refs/remotes/git-svn &&
diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh
index ca8a00e..a400dc7 100755
--- a/t/t9106-git-svn-dcommit-clobber-series.sh
+++ b/t/t9106-git-svn-dcommit-clobber-series.sh
@@ -4,30 +4,30 @@
test_description='git-svn dcommit clobber series'
. ./lib-git-svn.sh

-test_expect_success 'initialize repo' "
+test_expect_success 'initialize repo' '
mkdir import &&
cd import &&
- awk 'BEGIN { for (i = 1; i < 64; i++) { print i } }' > file
- svn import -m 'initial' . $svnrepo &&
+ awk "BEGIN { for (i = 1; i < 64; i++) { print i } }" > file
+ svn import -m "initial" . "$svnrepo" &&
cd .. &&
- git svn init $svnrepo &&
+ git svn init "$svnrepo" &&
git svn fetch &&
test -e file
- "
+ '

-test_expect_success '(supposedly) non-conflicting change from SVN' "
- test x\"\`sed -n -e 58p < file\`\" = x58 &&
- test x\"\`sed -n -e 61p < file\`\" = x61 &&
- svn co $svnrepo tmp &&
+test_expect_success '(supposedly) non-conflicting change from SVN' '
+ test x"`sed -n -e 58p < file`" = x58 &&
+ test x"`sed -n -e 61p < file`" = x61 &&
+ svn co "$svnrepo" tmp &&
cd tmp &&
- perl -i -p -e 's/^58\$/5588/' file &&
- perl -i -p -e 's/^61\$/6611/' file &&
+ perl -i -p -e "s/^58$/5588/" file &&
+ perl -i -p -e "s/^61$/6611/" file &&
poke file &&
- test x\"\`sed -n -e 58p < file\`\" = x5588 &&
- test x\"\`sed -n -e 61p < file\`\" = x6611 &&
- svn commit -m '58 => 5588, 61 => 6611' &&
+ test x"`sed -n -e 58p < file`" = x5588 &&
+ test x"`sed -n -e 61p < file`" = x6611 &&
+ svn commit -m "58 => 5588, 61 => 6611" &&
cd ..
- "
+ '

test_expect_success 'some unrelated changes to git' "
echo hi > life &&
diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
index 0a41d52..d9b553a 100755
--- a/t/t9107-git-svn-migrate.sh
+++ b/t/t9107-git-svn-migrate.sh
@@ -3,61 +3,61 @@
test_description='git-svn metadata migrations from previous versions'
. ./lib-git-svn.sh

-test_expect_success 'setup old-looking metadata' "
- cp $GIT_DIR/config $GIT_DIR/config-old-git-svn &&
+test_expect_success 'setup old-looking metadata' '
+ cp "$GIT_DIR"/config "$GIT_DIR"/config-old-git-svn &&
mkdir import &&
cd import &&
for i in trunk branches/a branches/b \
tags/0.1 tags/0.2 tags/0.3; do
- mkdir -p \$i && \
- echo hello >> \$i/README || exit 1
+ mkdir -p $i && \
+ echo hello >> $i/README || exit 1
done && \
- svn import -m test . $svnrepo
+ svn import -m test . "$svnrepo"
cd .. &&
- git-svn init $svnrepo &&
+ git-svn init "$svnrepo" &&
git-svn fetch &&
- mv $GIT_DIR/svn/* $GIT_DIR/ &&
- mv $GIT_DIR/svn/.metadata $GIT_DIR/ &&
- rmdir $GIT_DIR/svn &&
+ mv "$GIT_DIR"/svn/* "$GIT_DIR"/ &&
+ mv "$GIT_DIR"/svn/.metadata "$GIT_DIR"/ &&
+ rmdir "$GIT_DIR"/svn &&
git update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn &&
git update-ref refs/heads/svn-HEAD refs/remotes/git-svn &&
git update-ref -d refs/remotes/git-svn refs/remotes/git-svn
- "
+ '

head=`git rev-parse --verify refs/heads/git-svn-HEAD^0`
test_expect_success 'git-svn-HEAD is a real HEAD' "test -n '$head'"

-test_expect_success 'initialize old-style (v0) git-svn layout' "
- mkdir -p $GIT_DIR/git-svn/info $GIT_DIR/svn/info &&
- echo $svnrepo > $GIT_DIR/git-svn/info/url &&
- echo $svnrepo > $GIT_DIR/svn/info/url &&
+test_expect_success 'initialize old-style (v0) git-svn layout' '
+ mkdir -p "$GIT_DIR"/git-svn/info "$GIT_DIR"/svn/info &&
+ echo "$svnrepo" > "$GIT_DIR"/git-svn/info/url &&
+ echo "$svnrepo" > "$GIT_DIR"/svn/info/url &&
git-svn migrate &&
- ! test -d $GIT_DIR/git-svn &&
+ ! test -d "$GIT_DIR"/git-svn &&
git rev-parse --verify refs/remotes/git-svn^0 &&
git rev-parse --verify refs/remotes/svn^0 &&
- test \`git config --get svn-remote.svn.url\` = '$svnrepo' &&
- test \`git config --get svn-remote.svn.fetch\` = \
- ':refs/remotes/git-svn'
- "
+ test "$(git config --get svn-remote.svn.url)" = "$svnrepo" &&
+ test `git config --get svn-remote.svn.fetch` = \
+ ":refs/remotes/git-svn"
+ '

-test_expect_success 'initialize a multi-repository repo' "
- git-svn init $svnrepo -T trunk -t tags -b branches &&
+test_expect_success 'initialize a multi-repository repo' '
+ git-svn init "$svnrepo" -T trunk -t tags -b branches &&
git config --get-all svn-remote.svn.fetch > fetch.out &&
- grep '^trunk:refs/remotes/trunk$' fetch.out &&
- test -n \"\`git config --get svn-remote.svn.branches \
- '^branches/\*:refs/remotes/\*$'\`\" &&
- test -n \"\`git config --get svn-remote.svn.tags \
- '^tags/\*:refs/remotes/tags/\*$'\`\" &&
+ grep "^trunk:refs/remotes/trunk$" fetch.out &&
+ test -n "`git config --get svn-remote.svn.branches \
+ "^branches/\*:refs/remotes/\*$"`" &&
+ test -n "`git config --get svn-remote.svn.tags \
+ "^tags/\*:refs/remotes/tags/\*$"`" &&
git config --unset svn-remote.svn.branches \
- '^branches/\*:refs/remotes/\*$' &&
+ "^branches/\*:refs/remotes/\*$" &&
git config --unset svn-remote.svn.tags \
- '^tags/\*:refs/remotes/tags/\*$' &&
- git config --add svn-remote.svn.fetch 'branches/a:refs/remotes/a' &&
- git config --add svn-remote.svn.fetch 'branches/b:refs/remotes/b' &&
+ "^tags/\*:refs/remotes/tags/\*$" &&
+ git config --add svn-remote.svn.fetch "branches/a:refs/remotes/a" &&
+ git config --add svn-remote.svn.fetch "branches/b:refs/remotes/b" &&
for i in tags/0.1 tags/0.2 tags/0.3; do
git config --add svn-remote.svn.fetch \
- \$i:refs/remotes/\$i || exit 1; done
- "
+ $i:refs/remotes/$i || exit 1; done
+ '

# refs should all be different, but the trees should all be the same:
test_expect_success 'multi-fetch works on partial urls + paths' "
@@ -73,43 +73,43 @@ test_expect_success 'multi-fetch works on partial urls + paths' "
refs/remotes/\$j\`\" ||exit 1; done; done
"

-test_expect_success 'migrate --minimize on old inited layout' "
+test_expect_success 'migrate --minimize on old inited layout' '
git config --unset-all svn-remote.svn.fetch &&
git config --unset-all svn-remote.svn.url &&
- rm -rf $GIT_DIR/svn &&
- for i in \`cat fetch.out\`; do
- path=\`expr \$i : '\\([^:]*\\):.*$'\`
- ref=\`expr \$i : '[^:]*:refs/remotes/\\(.*\\)$'\`
- if test -z \"\$ref\"; then continue; fi
- if test -n \"\$path\"; then path=\"/\$path\"; fi
- ( mkdir -p $GIT_DIR/svn/\$ref/info/ &&
- echo $svnrepo\$path > $GIT_DIR/svn/\$ref/info/url ) || exit 1;
+ rm -rf "$GIT_DIR"/svn &&
+ for i in `cat fetch.out`; do
+ path=`expr $i : "\([^:]*\):.*$"`
+ ref=`expr $i : "[^:]*:refs/remotes/\(.*\)$"`
+ if test -z "$ref"; then continue; fi
+ if test -n "$path"; then path="/$path"; fi
+ ( mkdir -p "$GIT_DIR"/svn/$ref/info/ &&
+ echo "$svnrepo"$path > "$GIT_DIR"/svn/$ref/info/url ) || exit 1;
done &&
git-svn migrate --minimize &&
- test -z \"\`git config -l |grep -v '^svn-remote\.git-svn\.'\`\" &&
+ test -z "`git config -l |grep -v "^svn-remote\.git-svn\."`" &&
git config --get-all svn-remote.svn.fetch > fetch.out &&
- grep '^trunk:refs/remotes/trunk$' fetch.out &&
- grep '^branches/a:refs/remotes/a$' fetch.out &&
- grep '^branches/b:refs/remotes/b$' fetch.out &&
- grep '^tags/0\.1:refs/remotes/tags/0\.1$' fetch.out &&
- grep '^tags/0\.2:refs/remotes/tags/0\.2$' fetch.out &&
- grep '^tags/0\.3:refs/remotes/tags/0\.3$' fetch.out
- grep '^:refs/remotes/git-svn' fetch.out
- "
+ grep "^trunk:refs/remotes/trunk$" fetch.out &&
+ grep "^branches/a:refs/remotes/a$" fetch.out &&
+ grep "^branches/b:refs/remotes/b$" fetch.out &&
+ grep "^tags/0\.1:refs/remotes/tags/0\.1$" fetch.out &&
+ grep "^tags/0\.2:refs/remotes/tags/0\.2$" fetch.out &&
+ grep "^tags/0\.3:refs/remotes/tags/0\.3$" fetch.out
+ grep "^:refs/remotes/git-svn" fetch.out
+ '

-test_expect_success ".rev_db auto-converted to .rev_map.UUID" "
+test_expect_success ".rev_db auto-converted to .rev_map.UUID" '
git-svn fetch -i trunk &&
- test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
- expect=\"\$(ls $GIT_DIR/svn/trunk/.rev_map.*)\" &&
- test -n \"\$expect\" &&
- rev_db=\$(echo \$expect | sed -e 's,_map,_db,') &&
- convert_to_rev_db \$expect \$rev_db &&
- rm -f \$expect &&
- test -f \$rev_db &&
+ test -z "$(ls "$GIT_DIR"/svn/trunk/.rev_db.* 2>/dev/null)" &&
+ expect="$(ls "$GIT_DIR"/svn/trunk/.rev_map.*)" &&
+ test -n "$expect" &&
+ rev_db="$(echo $expect | sed -e "s,_map,_db,")" &&
+ convert_to_rev_db "$expect" "$rev_db" &&
+ rm -f "$expect" &&
+ test -f "$rev_db" &&
git-svn fetch -i trunk &&
- test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
- test ! -e $GIT_DIR/svn/trunk/.rev_db &&
- test -f \$expect
- "
+ test -z "$(ls "$GIT_DIR"/svn/trunk/.rev_db.* 2>/dev/null)" &&
+ test ! -e "$GIT_DIR"/svn/trunk/.rev_db &&
+ test -f "$expect"
+ '

test_done
diff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh
index db4344c..f6f71d0 100755
--- a/t/t9108-git-svn-glob.sh
+++ b/t/t9108-git-svn-glob.sh
@@ -10,77 +10,77 @@ start a new branch
initial
EOF

-test_expect_success 'test refspec globbing' "
+test_expect_success 'test refspec globbing' '
mkdir -p trunk/src/a trunk/src/b trunk/doc &&
- echo 'hello world' > trunk/src/a/readme &&
- echo 'goodbye world' > trunk/src/b/readme &&
- svn import -m 'initial' trunk $svnrepo/trunk &&
- svn co $svnrepo tmp &&
+ echo "hello world" > trunk/src/a/readme &&
+ echo "goodbye world" > trunk/src/b/readme &&
+ svn import -m "initial" trunk "$svnrepo"/trunk &&
+ svn co "$svnrepo" tmp &&
cd tmp &&
mkdir branches tags &&
svn add branches tags &&
svn cp trunk branches/start &&
- svn commit -m 'start a new branch' &&
+ svn commit -m "start a new branch" &&
svn up &&
- echo 'hi' >> branches/start/src/b/readme &&
+ echo "hi" >> branches/start/src/b/readme &&
poke branches/start/src/b/readme &&
- echo 'hey' >> branches/start/src/a/readme &&
+ echo "hey" >> branches/start/src/a/readme &&
poke branches/start/src/a/readme &&
- svn commit -m 'hi' &&
+ svn commit -m "hi" &&
svn up &&
svn cp branches/start tags/end &&
- echo 'bye' >> tags/end/src/b/readme &&
+ echo "bye" >> tags/end/src/b/readme &&
poke tags/end/src/b/readme &&
- echo 'aye' >> tags/end/src/a/readme &&
+ echo "aye" >> tags/end/src/a/readme &&
poke tags/end/src/a/readme &&
- svn commit -m 'the end' &&
- echo 'byebye' >> tags/end/src/b/readme &&
+ svn commit -m "the end" &&
+ echo "byebye" >> tags/end/src/b/readme &&
poke tags/end/src/b/readme &&
- svn commit -m 'nothing to see here'
+ svn commit -m "nothing to see here"
cd .. &&
- git config --add svn-remote.svn.url $svnrepo &&
+ git config --add svn-remote.svn.url "$svnrepo" &&
git config --add svn-remote.svn.fetch \
- 'trunk/src/a:refs/remotes/trunk' &&
+ "trunk/src/a:refs/remotes/trunk" &&
git config --add svn-remote.svn.branches \
- 'branches/*/src/a:refs/remotes/branches/*' &&
+ "branches/*/src/a:refs/remotes/branches/*" &&
git config --add svn-remote.svn.tags\
- 'tags/*/src/a:refs/remotes/tags/*' &&
+ "tags/*/src/a:refs/remotes/tags/*" &&
git-svn multi-fetch &&
git log --pretty=oneline refs/remotes/tags/end | \
- sed -e 's/^.\{41\}//' > output.end &&
+ sed -e "s/^.\{41\}//" > output.end &&
cmp expect.end output.end &&
- test \"\`git rev-parse refs/remotes/tags/end~1\`\" = \
- \"\`git rev-parse refs/remotes/branches/start\`\" &&
- test \"\`git rev-parse refs/remotes/branches/start~2\`\" = \
- \"\`git rev-parse refs/remotes/trunk\`\"
- "
+ test "`git rev-parse refs/remotes/tags/end~1`" = \
+ "`git rev-parse refs/remotes/branches/start`" &&
+ test "`git rev-parse refs/remotes/branches/start~2`" = \
+ "`git rev-parse refs/remotes/trunk`"
+ '

echo try to try > expect.two
echo nothing to see here >> expect.two
cat expect.end >> expect.two

-test_expect_success 'test left-hand-side only globbing' "
- git config --add svn-remote.two.url $svnrepo &&
+test_expect_success 'test left-hand-side only globbing' '
+ git config --add svn-remote.two.url "$svnrepo" &&
git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
git config --add svn-remote.two.branches \
- 'branches/*:refs/remotes/two/branches/*' &&
+ "branches/*:refs/remotes/two/branches/*" &&
git config --add svn-remote.two.tags \
- 'tags/*:refs/remotes/two/tags/*' &&
+ "tags/*:refs/remotes/two/tags/*" &&
cd tmp &&
- echo 'try try' >> tags/end/src/b/readme &&
+ echo "try try" >> tags/end/src/b/readme &&
poke tags/end/src/b/readme &&
- svn commit -m 'try to try'
+ svn commit -m "try to try"
cd .. &&
git-svn fetch two &&
- test \`git rev-list refs/remotes/two/tags/end | wc -l\` -eq 6 &&
- test \`git rev-list refs/remotes/two/branches/start | wc -l\` -eq 3 &&
- test \`git rev-parse refs/remotes/two/branches/start~2\` = \
- \`git rev-parse refs/remotes/two/trunk\` &&
- test \`git rev-parse refs/remotes/two/tags/end~3\` = \
- \`git rev-parse refs/remotes/two/branches/start\` &&
+ test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 &&
+ test `git rev-list refs/remotes/two/branches/start | wc -l` -eq 3 &&
+ test `git rev-parse refs/remotes/two/branches/start~2` = \
+ `git rev-parse refs/remotes/two/trunk` &&
+ test `git rev-parse refs/remotes/two/tags/end~3` = \
+ `git rev-parse refs/remotes/two/branches/start` &&
git log --pretty=oneline refs/remotes/two/tags/end | \
- sed -e 's/^.\{41\}//' > output.two &&
+ sed -e "s/^.\{41\}//" > output.two &&
cmp expect.two output.two
- "
+ '

test_done
diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh
index 6235af4..047659f 100755
--- a/t/t9110-git-svn-use-svm-props.sh
+++ b/t/t9110-git-svn-use-svm-props.sh
@@ -7,15 +7,15 @@ test_description='git-svn useSvmProps test'

. ./lib-git-svn.sh

-test_expect_success 'load svm repo' "
- svnadmin load -q $rawsvnrepo < ../t9110/svm.dump &&
- git-svn init --minimize-url -R arr -i bar $svnrepo/mirror/arr &&
- git-svn init --minimize-url -R argh -i dir $svnrepo/mirror/argh &&
+test_expect_success 'load svm repo' '
+ svnadmin load -q "$rawsvnrepo" < ../t9110/svm.dump &&
+ git-svn init --minimize-url -R arr -i bar "$svnrepo"/mirror/arr &&
+ git-svn init --minimize-url -R argh -i dir "$svnrepo"/mirror/argh &&
git-svn init --minimize-url -R argh -i e \
- $svnrepo/mirror/argh/a/b/c/d/e &&
+ "$svnrepo"/mirror/argh/a/b/c/d/e &&
git config svn.useSvmProps true &&
git-svn fetch --all
- "
+ '

uuid=161ce429-a9dd-4828-af4a-52023f968c89

diff --git a/t/t9111-git-svn-use-svnsync-props.sh b/t/t9111-git-svn-use-svnsync-props.sh
index ec7dedd..a8d74dc 100755
--- a/t/t9111-git-svn-use-svnsync-props.sh
+++ b/t/t9111-git-svn-use-svnsync-props.sh
@@ -7,14 +7,14 @@ test_description='git-svn useSvnsyncProps test'

. ./lib-git-svn.sh

-test_expect_success 'load svnsync repo' "
- svnadmin load -q $rawsvnrepo < ../t9111/svnsync.dump &&
- git-svn init --minimize-url -R arr -i bar $svnrepo/bar &&
- git-svn init --minimize-url -R argh -i dir $svnrepo/dir &&
- git-svn init --minimize-url -R argh -i e $svnrepo/dir/a/b/c/d/e &&
+test_expect_success 'load svnsync repo' '
+ svnadmin load -q "$rawsvnrepo" < ../t9111/svnsync.dump &&
+ git-svn init --minimize-url -R arr -i bar "$svnrepo"/bar &&
+ git-svn init --minimize-url -R argh -i dir "$svnrepo"/dir &&
+ git-svn init --minimize-url -R argh -i e "$svnrepo"/dir/a/b/c/d/e &&
git config svn.useSvnsyncProps true &&
git-svn fetch --all
- "
+ '

uuid=161ce429-a9dd-4828-af4a-52023f968c89

diff --git a/t/t9112-git-svn-md5less-file.sh b/t/t9112-git-svn-md5less-file.sh
index 646a5f0..d470a92 100755
--- a/t/t9112-git-svn-md5less-file.sh
+++ b/t/t9112-git-svn-md5less-file.sh
@@ -40,8 +40,8 @@ PROPS-END

EOF

-test_expect_success 'load svn dumpfile' "svnadmin load $rawsvnrepo < dumpfile.svn"
+test_expect_success 'load svn dumpfile' 'svnadmin load "$rawsvnrepo" < dumpfile.svn'

-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' 'git-svn init "$svnrepo"'
test_expect_success 'fetch revisions from svn' 'git-svn fetch'
test_done
diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh
index 9ef0db9..31c929b 100755
--- a/t/t9113-git-svn-dcommit-new-file.sh
+++ b/t/t9113-git-svn-dcommit-new-file.sh
@@ -15,18 +15,18 @@ test_description='git-svn dcommit new files over svn:// test'

start_svnserve () {
svnserve --listen-port $SVNSERVE_PORT \
- --root $rawsvnrepo \
+ --root "$rawsvnrepo" \
--listen-once \
--listen-host 127.0.0.1 &
}

-test_expect_success 'start tracking an empty repo' "
- svn mkdir -m 'empty dir' $svnrepo/empty-dir &&
- echo anon-access = write >> $rawsvnrepo/conf/svnserve.conf &&
+test_expect_success 'start tracking an empty repo' '
+ svn mkdir -m "empty dir" "$svnrepo"/empty-dir &&
+ echo anon-access = write >> "$rawsvnrepo"/conf/svnserve.conf &&
start_svnserve &&
git svn init svn://127.0.0.1:$SVNSERVE_PORT &&
git svn fetch
- "
+ '

test_expect_success 'create files in new directory with dcommit' "
mkdir git-new-dir &&
diff --git a/t/t9114-git-svn-dcommit-merge.sh b/t/t9114-git-svn-dcommit-merge.sh
index 225060b..61d7781 100755
--- a/t/t9114-git-svn-dcommit-merge.sh
+++ b/t/t9114-git-svn-dcommit-merge.sh
@@ -34,35 +34,35 @@ cat << EOF
EOF
}

-test_expect_success 'setup svn repository' "
- svn co $svnrepo mysvnwork &&
+test_expect_success 'setup svn repository' '
+ svn co "$svnrepo" mysvnwork &&
mkdir -p mysvnwork/trunk &&
cd mysvnwork &&
big_text_block >> trunk/README &&
svn add trunk &&
- svn ci -m 'first commit' trunk &&
+ svn ci -m "first commit" trunk &&
cd ..
- "
+ '

-test_expect_success 'setup git mirror and merge' "
- git svn init $svnrepo -t tags -T trunk -b branches &&
+test_expect_success 'setup git mirror and merge' '
+ git svn init "$svnrepo" -t tags -T trunk -b branches &&
git svn fetch &&
git checkout --track -b svn remotes/trunk &&
git checkout -b merge &&
echo new file > new_file &&
git add new_file &&
- git commit -a -m 'New file' &&
+ git commit -a -m "New file" &&
echo hello >> README &&
- git commit -a -m 'hello' &&
+ git commit -a -m "hello" &&
echo add some stuff >> new_file &&
- git commit -a -m 'add some stuff' &&
+ git commit -a -m "add some stuff" &&
git checkout svn &&
mv -f README tmp &&
echo friend > README &&
cat tmp >> README &&
- git commit -a -m 'friend' &&
+ git commit -a -m "friend" &&
git pull . merge
- "
+ '

test_debug 'gitk --all & sleep 1'

diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh
index 182299c..298445f 100755
--- a/t/t9115-git-svn-dcommit-funky-renames.sh
+++ b/t/t9115-git-svn-dcommit-funky-renames.sh
@@ -7,16 +7,16 @@ test_description='git-svn dcommit can commit renames of files with ugly names'

. ./lib-git-svn.sh

-test_expect_success 'load repository with strange names' "
- svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+test_expect_success 'load repository with strange names' '
+ svnadmin load -q "$rawsvnrepo" < ../t9115/funky-names.dump &&
start_httpd
- "
+ '

-test_expect_success 'init and fetch repository' "
- git svn init $svnrepo &&
+test_expect_success 'init and fetch repository' '
+ git svn init "$svnrepo" &&
git svn fetch &&
git reset --hard git-svn
- "
+ '

test_expect_success 'create file in existing ugly and empty dir' '
mkdir "#{bad_directory_name}" &&
diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh
index e1e8bdf..4b2cc87 100755
--- a/t/t9116-git-svn-log.sh
+++ b/t/t9116-git-svn-log.sh
@@ -6,17 +6,17 @@
test_description='git-svn log tests'
. ./lib-git-svn.sh

-test_expect_success 'setup repository and import' "
+test_expect_success 'setup repository and import' '
mkdir import &&
cd import &&
for i in trunk branches/a branches/b \
tags/0.1 tags/0.2 tags/0.3; do
- mkdir -p \$i && \
- echo hello >> \$i/README || exit 1
+ mkdir -p $i && \
+ echo hello >> $i/README || exit 1
done && \
- svn import -m test . $svnrepo
+ svn import -m test . "$svnrepo"
cd .. &&
- git-svn init $svnrepo -T trunk -b branches -t tags &&
+ git-svn init "$svnrepo" -T trunk -b branches -t tags &&
git-svn fetch &&
git reset --hard trunk &&
echo bye >> README &&
@@ -37,7 +37,7 @@ test_expect_success 'setup repository and import' "
echo try >> README &&
git commit -a -m try &&
git svn dcommit
- "
+ '

test_expect_success 'run log' "
git reset --hard a &&
diff --git a/t/t9117-git-svn-init-clone.sh b/t/t9117-git-svn-init-clone.sh
index d482b40..7a689bb 100755
--- a/t/t9117-git-svn-init-clone.sh
+++ b/t/t9117-git-svn-init-clone.sh
@@ -13,43 +13,43 @@ rm -r .git
mkdir tmp
cd tmp

-test_expect_success 'setup svnrepo' "
+test_expect_success 'setup svnrepo' '
mkdir project project/trunk project/branches project/tags &&
echo foo > project/trunk/foo &&
- svn import -m '$test_description' project $svnrepo/project &&
+ svn import -m "$test_description" project "$svnrepo"/project &&
rm -rf project
- "
+ '

-test_expect_success 'basic clone' "
+test_expect_success 'basic clone' '
test ! -d trunk &&
- git svn clone $svnrepo/project/trunk &&
+ git svn clone "$svnrepo"/project/trunk &&
test -d trunk/.git/svn &&
test -e trunk/foo &&
rm -rf trunk
- "
+ '

-test_expect_success 'clone to target directory' "
+test_expect_success 'clone to target directory' '
test ! -d target &&
- git svn clone $svnrepo/project/trunk target &&
+ git svn clone "$svnrepo"/project/trunk target &&
test -d target/.git/svn &&
test -e target/foo &&
rm -rf target
- "
+ '

-test_expect_success 'clone with --stdlayout' "
+test_expect_success 'clone with --stdlayout' '
test ! -d project &&
- git svn clone -s $svnrepo/project &&
+ git svn clone -s "$svnrepo"/project &&
test -d project/.git/svn &&
test -e project/foo &&
rm -rf project
- "
+ '

-test_expect_success 'clone to target directory with --stdlayout' "
+test_expect_success 'clone to target directory with --stdlayout' '
test ! -d target &&
- git svn clone -s $svnrepo/project target &&
+ git svn clone -s "$svnrepo"/project target &&
test -d target/.git/svn &&
test -e target/foo &&
rm -rf target
- "
+ '

test_done
diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
index 640bb06..3281cbd 100755
--- a/t/t9118-git-svn-funky-branch-names.sh
+++ b/t/t9118-git-svn-funky-branch-names.sh
@@ -6,25 +6,25 @@
test_description='git-svn funky branch names'
. ./lib-git-svn.sh

-test_expect_success 'setup svnrepo' "
+test_expect_success 'setup svnrepo' '
mkdir project project/trunk project/branches project/tags &&
echo foo > project/trunk/foo &&
- svn import -m '$test_description' project \"$svnrepo/pr ject\" &&
+ svn import -m "$test_description" project "$svnrepo/pr ject" &&
rm -rf project &&
- svn cp -m 'fun' \"$svnrepo/pr ject/trunk\" \
- \"$svnrepo/pr ject/branches/fun plugin\" &&
- svn cp -m 'more fun!' \"$svnrepo/pr ject/branches/fun plugin\" \
- \"$svnrepo/pr ject/branches/more fun plugin!\" &&
+ svn cp -m "fun" "$svnrepo/pr ject/trunk" \
+ "$svnrepo/pr ject/branches/fun plugin" &&
+ svn cp -m "more fun!" "$svnrepo/pr ject/branches/fun plugin" \
+ "$svnrepo/pr ject/branches/more fun plugin!" &&
start_httpd
- "
+ '

-test_expect_success 'test clone with funky branch names' "
- git svn clone -s \"$svnrepo/pr ject\" project &&
+test_expect_success 'test clone with funky branch names' '
+ git svn clone -s "$svnrepo/pr ject" project &&
cd project &&
- git rev-parse 'refs/remotes/fun%20plugin' &&
- git rev-parse 'refs/remotes/more%20fun%20plugin!' &&
+ git rev-parse "refs/remotes/fun%20plugin" &&
+ git rev-parse "refs/remotes/more%20fun%20plugin!" &&
cd ..
- "
+ '

test_expect_success 'test dcommit to funky branch' "
cd project &&
diff --git a/t/t9120-git-svn-clone-with-percent-escapes.sh b/t/t9120-git-svn-clone-with-percent-escapes.sh
index 9a4eabe..5979e13 100755
--- a/t/t9120-git-svn-clone-with-percent-escapes.sh
+++ b/t/t9120-git-svn-clone-with-percent-escapes.sh
@@ -6,13 +6,13 @@
test_description='git-svn clone with percent escapes'
. ./lib-git-svn.sh

-test_expect_success 'setup svnrepo' "
+test_expect_success 'setup svnrepo' '
mkdir project project/trunk project/branches project/tags &&
echo foo > project/trunk/foo &&
- svn import -m '$test_description' project '$svnrepo/pr ject' &&
+ svn import -m "$test_description" project "$svnrepo/pr ject" &&
rm -rf project &&
start_httpd
-"
+'

if test "$SVN_HTTPD_PORT" = ""
then
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index 3dc261d..ae7082b 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -10,6 +10,7 @@ commandline, and checks that it would not write any errors
or warnings to log.'

gitweb_init () {
+ safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
cat >gitweb_config.perl <<EOF
#!/usr/bin/perl

@@ -17,16 +18,16 @@ gitweb_init () {

our \$version = "current";
our \$GIT = "git";
-our \$projectroot = "$(pwd)";
+our \$projectroot = "$safe_pwd";
our \$project_maxdepth = 8;
our \$home_link_str = "projects";
our \$site_name = "[localhost]";
our \$site_header = "";
our \$site_footer = "";
our \$home_text = "indextext.html";
-our @stylesheets = ("file:///$(pwd)/../../gitweb/gitweb.css");
-our \$logo = "file:///$(pwd)/../../gitweb/git-logo.png";
-our \$favicon = "file:///$(pwd)/../../gitweb/git-favicon.png";
+our @stylesheets = ("file:///$safe_pwd/../../gitweb/gitweb.css");
+our \$logo = "file:///$safe_pwd/../../gitweb/git-logo.png";
+our \$favicon = "file:///$safe_pwd/../../gitweb/git-favicon.png";
our \$projects_list = "";
our \$export_ok = "";
our \$strict_export = "";
@@ -53,7 +54,7 @@ gitweb_run () {
# written to web server logs, so we are not interested in that:
# we are interested only in properly formatted errors/warnings
rm -f gitweb.log &&
- perl -- $(pwd)/../../gitweb/gitweb.perl \
+ perl -- "$(pwd)/../../gitweb/gitweb.perl" \
>/dev/null 2>gitweb.log &&
if grep -q -s "^[[]" gitweb.log >/dev/null; then false; else true; fi

--
1.5.5.1.128.g03a943
Johannes Sixt
2008-05-05 07:04:08 UTC
Permalink
Bryan Donlan schrieb:
> This fixes the remainder of the issues where the test script itself is at
> fault for failing when the git checkout path contains whitespace or other
> shell metacharacters.

Maybe a note along these lines would be in order:

The majority of git svn tests used the idiom

test_expect_success "title" "test script using $svnrepo"

These were changed to have the test script in single-quotes:

test_expect_success "title" 'test script using "$svnrepo"'

(which makes the patch so large). One consequence of this change is that
in the verbose test output the value of $svnrepo (and in some cases other
variables, too) is no longer expanded, i.e. previously we saw

* expecting success:
test script using /path/to/git/t/trash/svnrepo

but now it is:

* expecting success:
test script using "$svnrepo"


>
> Signed-off-by: Bryan Donlan <***@fushizen.net>

> test_expect_success 'push with insteadOf' '
> mk_empty &&
> - TRASH=$(pwd)/ &&
> - git config url.$TRASH.insteadOf trash/ &&
> + TRASH="$(pwd)/" &&

This one would not be necessary, but I don't mind.

> -test_expect_success 'make sure r2 still has old file' '
> +test_expect_success 'make sure r2 still has old file' "
> cd x &&
> - test -n "$(git svn find-rev r1)" &&
> - git reset --hard $(git svn find-rev r1) &&
> + test -n \"\$(git svn find-rev r1)\" &&
> + git reset --hard \$(git svn find-rev r1) &&
> test -f README &&
> test ! -f FOLLOWME &&
> - test x$(git svn find-rev r2) = x
> -'
> + test x\$(git svn find-rev r2) = x
> +"

Why did you change the quoting from sq to dq here?

> diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
> index 3dc261d..ae7082b 100755
> --- a/t/t9500-gitweb-standalone-no-errors.sh
> +++ b/t/t9500-gitweb-standalone-no-errors.sh
> @@ -10,6 +10,7 @@ commandline, and checks that it would not write any errors
> or warnings to log.'
>
> gitweb_init () {
> + safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"

How portable is this? (Just asking...)

-- Hannes
Bryan Donlan
2008-05-04 05:37:58 UTC
Permalink
This form is not portable across all shells, so replace instances of:

export FOO=bar

with:

FOO=bar
export FOO

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/lib-httpd.sh | 3 +-
t/t1500-rev-parse.sh | 9 ++++---
t/t1501-worktree.sh | 34 ++++++++++++++++---------------
t/t3400-rebase.sh | 3 +-
t/t3500-cherry.sh | 3 +-
t/t5500-fetch-pack.sh | 2 +-
t/t6000lib.sh | 9 +++++--
t/t6010-merge-base.sh | 9 ++++---
t/t7004-tag.sh | 3 +-
t/t9500-gitweb-standalone-no-errors.sh | 16 ++++++++------
10 files changed, 52 insertions(+), 39 deletions(-)

diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 7f206c5..a5c4436 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -61,7 +61,8 @@ prepare_httpd() {
-new -x509 -nodes \
-out $HTTPD_ROOT_PATH/httpd.pem \
-keyout $HTTPD_ROOT_PATH/httpd.pem
- export GIT_SSL_NO_VERIFY=t
+ GIT_SSL_NO_VERIFY=t
+ export GIT_SSL_NO_VERIFY
HTTPD_PARA="$HTTPD_PARA -DSSL"
else
HTTPD_URL=http://127.0.0.1:$LIB_HTTPD_PORT
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 38a2bf0..85da4ca 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -51,8 +51,9 @@ test_rev_parse 'core.bare undefined' false false true

mkdir work || exit 1
cd work || exit 1
-export GIT_DIR=../.git
-export GIT_CONFIG="$(pwd)"/../.git/config
+GIT_DIR=../.git
+GIT_CONFIG="$(pwd)"/../.git/config
+export GIT_DIR GIT_CONFIG

git config core.bare false
test_rev_parse 'GIT_DIR=../.git, core.bare = false' false false true ''
@@ -64,8 +65,8 @@ git config --unset core.bare
test_rev_parse 'GIT_DIR=../.git, core.bare undefined' false false true ''

mv ../.git ../repo.git || exit 1
-export GIT_DIR=../repo.git
-export GIT_CONFIG="$(pwd)"/../repo.git/config
+GIT_DIR=../repo.git
+GIT_CONFIG="$(pwd)"/../repo.git/config

git config core.bare false
test_rev_parse 'GIT_DIR=../repo.git, core.bare = false' false false true ''
diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh
index 7ee3820..2ee88d8 100755
--- a/t/t1501-worktree.sh
+++ b/t/t1501-worktree.sh
@@ -32,24 +32,25 @@ mkdir -p work/sub/dir || exit 1
mv .git repo.git || exit 1

say "core.worktree = relative path"
-export GIT_DIR=repo.git
-export GIT_CONFIG="$(pwd)"/$GIT_DIR/config
+GIT_DIR=repo.git
+GIT_CONFIG="$(pwd)"/$GIT_DIR/config
+export GIT_DIR GIT_CONFIG
unset GIT_WORK_TREE
git config core.worktree ../work
test_rev_parse 'outside' false false false
cd work || exit 1
-export GIT_DIR=../repo.git
-export GIT_CONFIG="$(pwd)"/$GIT_DIR/config
+GIT_DIR=../repo.git
+GIT_CONFIG="$(pwd)"/$GIT_DIR/config
test_rev_parse 'inside' false false true ''
cd sub/dir || exit 1
-export GIT_DIR=../../../repo.git
-export GIT_CONFIG="$(pwd)"/$GIT_DIR/config
+GIT_DIR=../../../repo.git
+GIT_CONFIG="$(pwd)"/$GIT_DIR/config
test_rev_parse 'subdirectory' false false true sub/dir/
cd ../../.. || exit 1

say "core.worktree = absolute path"
-export GIT_DIR=$(pwd)/repo.git
-export GIT_CONFIG=$GIT_DIR/config
+GIT_DIR=$(pwd)/repo.git
+GIT_CONFIG=$GIT_DIR/config
git config core.worktree "$(pwd)/work"
test_rev_parse 'outside' false false false
cd work || exit 1
@@ -59,25 +60,26 @@ test_rev_parse 'subdirectory' false false true sub/dir/
cd ../../.. || exit 1

say "GIT_WORK_TREE=relative path (override core.worktree)"
-export GIT_DIR=$(pwd)/repo.git
-export GIT_CONFIG=$GIT_DIR/config
+GIT_DIR=$(pwd)/repo.git
+GIT_CONFIG=$GIT_DIR/config
git config core.worktree non-existent
-export GIT_WORK_TREE=work
+GIT_WORK_TREE=work
+export GIT_WORK_TREE
test_rev_parse 'outside' false false false
cd work || exit 1
-export GIT_WORK_TREE=.
+GIT_WORK_TREE=.
test_rev_parse 'inside' false false true ''
cd sub/dir || exit 1
-export GIT_WORK_TREE=../..
+GIT_WORK_TREE=../..
test_rev_parse 'subdirectory' false false true sub/dir/
cd ../../.. || exit 1

mv work repo.git/work

say "GIT_WORK_TREE=absolute path, work tree below git dir"
-export GIT_DIR=$(pwd)/repo.git
-export GIT_CONFIG=$GIT_DIR/config
-export GIT_WORK_TREE=$(pwd)/repo.git/work
+GIT_DIR=$(pwd)/repo.git
+GIT_CONFIG=$GIT_DIR/config
+GIT_WORK_TREE=$(pwd)/repo.git/work
test_rev_parse 'outside' false false false
cd repo.git || exit 1
test_rev_parse 'in repo.git' false true false
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 496f4ec..10d7449 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -9,7 +9,8 @@ This test runs git rebase and checks that the author information is not lost.
'
. ./test-lib.sh

-export GIT_AUTHOR_EMAIL=bogus_email_address
+GIT_AUTHOR_EMAIL=bogus_email_address
+export GIT_AUTHOR_EMAIL

test_expect_success \
'prepare repository with topic branches' \
diff --git a/t/t3500-cherry.sh b/t/t3500-cherry.sh
index d0a440f..4911c48 100755
--- a/t/t3500-cherry.sh
+++ b/t/t3500-cherry.sh
@@ -10,7 +10,8 @@ checks that git cherry only returns the second patch in the local branch
'
. ./test-lib.sh

-export GIT_AUTHOR_EMAIL=bogus_email_address
+GIT_AUTHOR_EMAIL=bogus_email_address
+export GIT_AUTHOR_EMAIL

test_expect_success \
'prepare repository with topic branch, and check cherry finds the 2 patches from there' \
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 788b4a5..1700d07 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -31,7 +31,7 @@ add () {
sec=$(($sec+1))
commit=$(echo "$text" | GIT_AUTHOR_DATE=$sec \
git commit-tree $tree $parents 2>>log2.txt)
- export $name=$commit
+ eval "$name=$commit; export $name"
echo $commit > .git/refs/heads/$branch
eval ${branch}TIP=$commit
}
diff --git a/t/t6000lib.sh b/t/t6000lib.sh
index c0baaa5..f55627b 100755
--- a/t/t6000lib.sh
+++ b/t/t6000lib.sh
@@ -49,13 +49,15 @@ as_author()
shift 1
_save=$GIT_AUTHOR_EMAIL

- export GIT_AUTHOR_EMAIL="$_author"
+ GIT_AUTHOR_EMAIL="$_author"
+ export GIT_AUTHOR_EMAIL
"$@"
if test -z "$_save"
then
unset GIT_AUTHOR_EMAIL
else
- export GIT_AUTHOR_EMAIL="$_save"
+ GIT_AUTHOR_EMAIL="$_save"
+ export GIT_AUTHOR_EMAIL
fi
}

@@ -69,7 +71,8 @@ on_committer_date()
{
_date=$1
shift 1
- export GIT_COMMITTER_DATE="$_date"
+ GIT_COMMITTER_DATE="$_date"
+ export GIT_COMMITTER_DATE
"$@"
unset GIT_COMMITTER_DATE
}
diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh
index 96f3d35..b6e57b2 100755
--- a/t/t6010-merge-base.sh
+++ b/t/t6010-merge-base.sh
@@ -13,10 +13,11 @@ T=$(git write-tree)
M=1130000000
Z=+0000

-export GIT_COMMITTER_EMAIL=***@comm.iter.xz
-export GIT_COMMITTER_NAME='C O Mmiter'
-export GIT_AUTHOR_NAME='A U Thor'
-export GIT_AUTHOR_EMAIL=***@au.thor.xz
+GIT_COMMITTER_EMAIL=***@comm.iter.xz
+GIT_COMMITTER_NAME='C O Mmiter'
+GIT_AUTHOR_NAME='A U Thor'
+GIT_AUTHOR_EMAIL=***@au.thor.xz
+export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL

doit() {
OFFSET=$1; shift
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 1a7141e..2dcee7c 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -626,7 +626,8 @@ esac

cp -R ../t7004 ./gpghome
chmod 0700 gpghome
-export GNUPGHOME="$(pwd)/gpghome"
+GNUPGHOME="$(pwd)/gpghome"
+export GNUPGHOME

get_tag_header signed-tag $commit commit $time >expect
echo 'A signed tag message' >>expect
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index 061a259..3dc261d 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -39,13 +39,15 @@ EOF
}

gitweb_run () {
- export GATEWAY_INTERFACE="CGI/1.1"
- export HTTP_ACCEPT="*/*"
- export REQUEST_METHOD="GET"
- export QUERY_STRING=""$1""
- export PATH_INFO=""$2""
-
- export GITWEB_CONFIG=$(pwd)/gitweb_config.perl
+ GATEWAY_INTERFACE="CGI/1.1"
+ HTTP_ACCEPT="*/*"
+ REQUEST_METHOD="GET"
+ QUERY_STRING=""$1""
+ PATH_INFO=""$2""
+ export GATEWAY_INTERFACE HTTP_ACCEPT REQUEST_METHOD QUERY_STRING PATH_INFO
+
+ GITWEB_CONFIG=$(pwd)/gitweb_config.perl
+ export GITWEB_CONFIG

# some of git commands write to STDERR on error, but this is not
# written to web server logs, so we are not interested in that:
--
1.5.5.1.128.g03a943
Bryan Donlan
2008-05-04 05:37:50 UTC
Permalink
This patch series fixes bugs in git and git's testsuite to allow all tests
to pass when the working directory contains whitespace and/or shell
metacharacters.

The first three patches in this series fix bugs in git itself that were
uncovered in the process of fixing the test suite. Each contains additional
tests and/or updates to existing tests to exercise the bug in question.

Patches 4 and 5 set up an abstraction for safe handling of editor variables
in tests when we have odd paths; and 6-7 fix bugs in the test libraries.
Patch 8 cleans up some instances of the unportable export FOO=bar construct
in the test suite; patch 9 fixes the remaining individual tests to be
space-sane, and finally 10 arranges for the test suite to always run with the
trash directory name containing spaces, to help prevent regressions in the
future.

Significant changes since v2:
* Use only spaces in the trash dir names for Windows compatibility
* Avoid ugliness like \"\$GIT_DIR\"

This series is also available by:
git pull git://repo.or.cz/git/bdonlan.git wst-submit3

Sorry for the long delay in updating the series; I've been consumed with
schoolwork lately :)

Since it was mentioned providing conversion scripts was useful in review, here
is a hacky script I put together to help fixup the quotation:

http://fushizen.net/~bd/requote.pl

This script was applied on t/t*svn*.sh, then followed by a few manual fixes,
review, and git add -i to change only the chunks that I had made worse in the
previous patches. Note however that the conversion of "->' in places makes for
a large diff...

Bryan Donlan (10):
git-rebase.sh: Fix --merge --abort failures when path contains
whitespace
config.c: Escape backslashes in section names properly
git-send-email.perl: Handle shell metacharacters in $EDITOR properly
test-lib.sh: Add a test_set_editor function to safely set $VISUAL
Use test_set_editor in t9001-send-email.sh
test-lib.sh: Fix some missing path quoting
lib-git-svn.sh: Fix quoting issues with paths containing shell
metacharacters
Don't use the export NAME=value form in the test scripts.
Fix tests breaking when checkout path contains shell metacharacters
Rename the test trash directory to contain spaces.

config.c | 2 +-
git-rebase.sh | 2 +-
git-send-email.perl | 2 +-
t/.gitignore | 2 +-
t/lib-git-svn.sh | 3 +-
t/lib-httpd.sh | 3 +-
t/t0000-basic.sh | 4 +-
t/t1020-subdirectory.sh | 22 ++--
t/t1303-wacky-config.sh | 6 +
t/t1500-rev-parse.sh | 9 +-
t/t1501-worktree.sh | 34 +++---
t/t3050-subprojects-fetch.sh | 2 +-
t/t3400-rebase.sh | 3 +-
t/t3404-rebase-interactive.sh | 3 +-
t/t3407-rebase-abort.sh | 33 +++--
t/t3500-cherry.sh | 3 +-
t/t5500-fetch-pack.sh | 4 +-
t/t5512-ls-remote.sh | 2 +-
t/t5516-fetch-push.sh | 6 +-
t/t5700-clone-reference.sh | 2 +-
t/t5710-info-alternate.sh | 4 +-
t/t6000lib.sh | 9 +-
t/t6010-merge-base.sh | 9 +-
t/t6200-fmt-merge-msg.sh | 6 +-
t/t7003-filter-branch.sh | 2 +-
t/t7004-tag.sh | 3 +-
t/t7010-setup.sh | 2 +-
t/t7300-clean.sh | 2 +-
t/t7501-commit.sh | 8 +-
t/t7504-commit-msg-hook.sh | 23 ++--
t/t7505-prepare-commit-msg-hook.sh | 17 ++-
t/t9001-send-email.sh | 5 +-
t/t9100-git-svn-basic.sh | 120 +++++++++---------
t/t9101-git-svn-props.sh | 8 +-
t/t9102-git-svn-deep-rmdir.sh | 20 ++--
t/t9103-git-svn-tracked-directory-removed.sh | 20 ++--
t/t9104-git-svn-follow-parent.sh | 172 ++++++++++++------------
t/t9105-git-svn-commit-diff.sh | 32 +++---
t/t9106-git-svn-commit-diff-clobber.sh | 56 ++++----
t/t9106-git-svn-dcommit-clobber-series.sh | 30 ++--
t/t9107-git-svn-migrate.sh | 124 +++++++++---------
t/t9108-git-svn-glob.sh | 76 ++++++------
t/t9110-git-svn-use-svm-props.sh | 12 +-
t/t9111-git-svn-use-svnsync-props.sh | 12 +-
t/t9112-git-svn-md5less-file.sh | 4 +-
t/t9113-git-svn-dcommit-new-file.sh | 10 +-
t/t9114-git-svn-dcommit-merge.sh | 22 ++--
t/t9115-git-svn-dcommit-funky-renames.sh | 12 +-
t/t9116-git-svn-log.sh | 12 +-
t/t9117-git-svn-init-clone.sh | 30 ++--
t/t9118-git-svn-funky-branch-names.sh | 24 ++--
t/t9120-git-svn-clone-with-percent-escapes.sh | 6 +-
t/t9121-git-svn-fetch-renamed-dir.sh | 12 +-
t/t9500-gitweb-standalone-no-errors.sh | 25 ++--
t/test-lib.sh | 22 +++-
55 files changed, 575 insertions(+), 523 deletions(-)
Bryan Donlan
2008-05-04 05:37:54 UTC
Permalink
In particular, this function correctly handles cases where the pwd contains
spaces, quotes, and other troublesome metacharacters.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/test-lib.sh | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7c2a8ba..d7ad13b 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -160,6 +160,22 @@ die () {

trap 'die' exit

+# The semantics of the editor variables are that of invoking
+# sh -c "$EDITOR \"$@\"" files ...
+#
+# If our trash directory contains shell metacharacters, they will be
+# interpreted if we just set $EDITOR directly, so do a little dance with
+# environment variables to work around this.
+#
+# In particular, quoting isn't enough, as the path may contain the same quote
+# that we're using.
+test_set_editor () {
+ FAKE_EDITOR="$1"
+ export FAKE_EDITOR
+ VISUAL='"$FAKE_EDITOR"'
+ export VISUAL
+}
+
test_tick () {
if test -z "${test_tick+set}"
then
--
1.5.5.1.128.g03a943
Bryan Donlan
2008-05-04 05:37:55 UTC
Permalink
Signed-off-by: Bryan Donlan <***@fushizen.net>
---
t/t9001-send-email.sh | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 030f66c..0a65785 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -144,10 +144,7 @@ test_expect_success 'setup fake editor' '
chmod +x fake-editor
'

-FAKE_EDITOR="$(pwd)/fake-editor"
-export FAKE_EDITOR
-GIT_EDITOR='"$FAKE_EDITOR"'
-export GIT_EDITOR
+test_set_editor "$(pwd)/fake-editor"

test_expect_success '--compose works' '
clean_fake_sendmail &&
--
1.5.5.1.128.g03a943
Bryan Donlan
2008-05-04 05:37:53 UTC
Permalink
This fixes the git-send-perl semantics for launching an editor when
$GIT_EDITOR (or friends) contains shell metacharacters to match
launch_editor() in builtin-tag.c. If we use the current approach
(sh -c '$0 $@' "$EDITOR" files ...), we see it fails when $EDITOR has
shell metacharacters:

$ sh -x -c '$0 $@' "$VISUAL" "foo"
+ "$FAKE_EDITOR" foo
"$FAKE_EDITOR": 1: "$FAKE_EDITOR": not found

Whereas builtin-tag.c will invoke sh -c "$EDITOR \"$@\"".

Thus, this patch changes git-send-email.perl to use the same method as the
C utilities, and additionally updates t/t9001-send-email.sh to test for this bug.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
git-send-email.perl | 2 +-
t/t9001-send-email.sh | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 9e568bf..b502396 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -512,7 +512,7 @@ EOT
close(C);

my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
- system('sh', '-c', '$0 $@', $editor, $compose_filename);
+ system('sh', '-c', $editor.' "$@"', $editor, $compose_filename);

open(C2,">",$compose_filename . ".final")
or die "Failed to open $compose_filename.final : " . $!;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c0973b4..030f66c 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -139,15 +139,19 @@ test_expect_success 'Valid In-Reply-To when prompting' '

test_expect_success 'setup fake editor' '
(echo "#!/bin/sh" &&
- echo "echo fake edit >>\$1"
+ echo "echo fake edit >>\"\$1\""
) >fake-editor &&
chmod +x fake-editor
'

+FAKE_EDITOR="$(pwd)/fake-editor"
+export FAKE_EDITOR
+GIT_EDITOR='"$FAKE_EDITOR"'
+export GIT_EDITOR
+
test_expect_success '--compose works' '
clean_fake_sendmail &&
echo y | \
- GIT_EDITOR=$(pwd)/fake-editor \
GIT_SEND_EMAIL_NOTTY=1 \
git send-email \
--compose --subject foo \
--
1.5.5.1.128.g03a943
Bryan Donlan
2008-05-04 05:37:51 UTC
Permalink
Also update t/t3407-rebase-abort.sh to exercise the bug

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
git-rebase.sh | 2 +-
t/t3407-rebase-abort.sh | 33 +++++++++++++++++++++------------
2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index 9b13b83..c43afe5 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -214,7 +214,7 @@ do
else
die "No rebase in progress?"
fi
- git reset --hard $(cat $dotest/orig-head)
+ git reset --hard $(cat "$dotest/orig-head")
rm -r "$dotest"
exit
;;
diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh
index 37944c3..1777ffe 100755
--- a/t/t3407-rebase-abort.sh
+++ b/t/t3407-rebase-abort.sh
@@ -4,7 +4,13 @@ test_description='git rebase --abort tests'

. ./test-lib.sh

+### Test that we handle space characters properly
+work_dir="$(pwd)/test dir"
+
test_expect_success setup '
+ mkdir -p "$work_dir" &&
+ cd "$work_dir" &&
+ git init &&
echo a > a &&
git add a &&
git commit -m a &&
@@ -28,32 +34,35 @@ testrebase() {
dotest=$2

test_expect_success "rebase$type --abort" '
+ cd "$work_dir" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d "$dotest" &&
git rebase --abort &&
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
+ test ! -d "$dotest"
'

test_expect_success "rebase$type --abort after --skip" '
+ cd "$work_dir" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d "$dotest" &&
test_must_fail git rebase --skip &&
test $(git rev-parse HEAD) = $(git rev-parse master) &&
git-rebase --abort &&
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
+ test ! -d "$dotest"
'

test_expect_success "rebase$type --abort after --continue" '
+ cd "$work_dir" &&
# Clean up the state from the previous one
- git reset --hard pre-rebase
- test_must_fail git rebase'"$type"' master &&
- test -d '$dotest' &&
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test -d "$dotest" &&
echo c > a &&
echo d >> a &&
git add a &&
@@ -61,7 +70,7 @@ testrebase() {
test $(git rev-parse HEAD) != $(git rev-parse master) &&
git rebase --abort &&
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
- test ! -d '$dotest'
+ test ! -d "$dotest"
'
}

--
1.5.5.1.128.g03a943
Bryan Donlan
2008-05-04 05:37:52 UTC
Permalink
If an element of the configuration key name other than the first or last
contains a backslash, it is not escaped on output, but is treated as an escape
sequence on input. Thus, the backslash is lost when re-loading the
configuration.

This patch corrects this by having backslashes escaped properly, and
introduces a new test for this bug.

Signed-off-by: Bryan Donlan <***@fushizen.net>
---
config.c | 2 +-
t/t1303-wacky-config.sh | 6 ++++++
2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/config.c b/config.c
index b0ada51..f0ac456 100644
--- a/config.c
+++ b/config.c
@@ -680,7 +680,7 @@ static int store_write_section(int fd, const char* key)
if (dot) {
strbuf_addf(&sb, "[%.*s \"", (int)(dot - key), key);
for (i = dot - key + 1; i < store.baselen; i++) {
- if (key[i] == '"')
+ if (key[i] == '"' || key[i] == '\\')
strbuf_addch(&sb, '\\');
strbuf_addch(&sb, key[i]);
}
diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh
index 99985dc..f366b53 100755
--- a/t/t1303-wacky-config.sh
+++ b/t/t1303-wacky-config.sh
@@ -34,4 +34,10 @@ test_expect_success 'add key in different section' '
check section2.key bar
'

+SECTION="test.q\"s\\sq'sp e.key"
+test_expect_success 'make sure git-config escapes section names properly' '
+ git config "$SECTION" bar &&
+ check "$SECTION" bar
+'
+
test_done
--
1.5.5.1.128.g03a943
Johannes Sixt
2008-05-05 07:03:49 UTC
Permalink
Bryan Donlan schrieb:
> This patch series fixes bugs in git and git's testsuite to allow all tests
> to pass when the working directory contains whitespace and/or shell
> metacharacters.

Thanks a lot, it's appreciated.

> Bryan Donlan (10):
> git-rebase.sh: Fix --merge --abort failures when path contains
> whitespace
> config.c: Escape backslashes in section names properly
> git-send-email.perl: Handle shell metacharacters in $EDITOR properly
> test-lib.sh: Add a test_set_editor function to safely set $VISUAL
> Use test_set_editor in t9001-send-email.sh
> test-lib.sh: Fix some missing path quoting
> lib-git-svn.sh: Fix quoting issues with paths containing shell
> metacharacters
> Don't use the export NAME=value form in the test scripts.
> Fix tests breaking when checkout path contains shell metacharacters
> Rename the test trash directory to contain spaces.

The last patch breaks t9400-git-cvsserver-server.sh on my system:

* expecting success: cat request-anonymous | git-cvsserver --strict-paths
pserver $SERVERDIR >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU$"
* FAIL 9: req_Root (strict paths)
cat request-anonymous | git-cvsserver --strict-paths pserver
$SERVERDIR >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU$"

D-Quoting $SERVERDIR helps. ;)

Please post an incremental diff when you resend it. Feel free to add:

Tested-by: Johannes Sixt <***@telecom.at>

-- Hannes
Avery Pennarun
2008-04-23 19:42:35 UTC
Permalink
From: Jeff King <***@peff.net>

On Tue, Apr 22, 2008 at 12:51:14PM -0400, Avery Pennarun wrote:

> Do you think git would benefit from having a generalized version of
> this script? Basically, the user provides a "munge" script on the
> command line, and there's a git-filter-branch mode for auto-munging
> (with a cache) every file in every checkin. Even if it's *only* ever
> used for CRLF, I can imagine this being useful to a lot of people.

It was easy enough to work up the patch below, which allows

git filter-branch --blob-filter 'tr a-z A-Z'

However, it's _still_ horribly slow. Shell script is nice and flexible,
but running a tight loop like this is just painful. I suspect
filter-branch in something like perl would be a lot faster and just as
flexible (you could even do it in C, but you'd probably have to invent a
little domain-specific scripting language).

It is still much better performance than a tree filter, though:

$ cd git && time git filter-branch --tree-filter '
find . -type f | while read f; do
tr a-z A-Z <"$f" >tmp
mv tmp "$f"
done
' HEAD~10..HEAD

real 4m38.626s
user 1m32.726s
sys 2m51.163s

$ cd git && git filter-branch --blob-filter 'tr a-z A-Z' HEAD~10..HEAD
real 1m40.809s
user 0m36.822s
sys 1m14.273s

Lots of system time in both. I'm sure we spend a fair bit of time
hitting our very large map and blob-cache directories, which would be
much more nicely implemented as associative arrays in memory (if we were
using a more featureful language).

Anyway, here is the patch. I don't know if it is even worth applying,
since it is still painfully slow.

Acked-by: Johannes Schindelin <***@gmx.de>
---
git-filter-branch.sh | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index ea59015..980c431 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -54,6 +54,23 @@ EOF

eval "$functions"

+munge_blobs() {
+ while read mode sha1 stage path
+ do
+ if ! test -r "$workdir/../blob-cache/$sha1"
+ then
+ new=`git cat-file blob $sha1 |
+ eval "$filter_blob" |
+ git hash-object -w --stdin`
+ printf $new >$workdir/../blob-cache/$sha1
+ fi
+ printf "%s %s\t%s\n" \
+ "$mode" \
+ $(cat "$workdir/../blob-cache/$sha1") \
+ "$path"
+ done
+}
+
# When piped a commit, output a script to set the ident of either
# "author" or "committer

@@ -105,6 +122,7 @@ tempdir=.git-rewrite
filter_env=
filter_tree=
filter_index=
+filter_blob=
filter_parent=
filter_msg=cat
filter_commit='git commit-tree "$@"'
@@ -150,6 +168,9 @@ do
--index-filter)
filter_index="$OPTARG"
;;
+ --blob-filter)
+ filter_blob="$OPTARG"
+ ;;
--parent-filter)
filter_parent="$OPTARG"
;;
@@ -227,6 +248,9 @@ ret=0
# map old->new commit ids for rewriting parents
mkdir ../map || die "Could not create map/ directory"

+# cache rewritten blobs for blob filter
+mkdir ../blob-cache || die "Could not create blob-cache/ directory"
+
case "$filter_subdir" in
"")
git rev-list --reverse --topo-order --default HEAD \
@@ -295,6 +319,12 @@ while read commit parents; do
eval "$filter_index" < /dev/null ||
die "index filter failed: $filter_index"

+ if test -n "$filter_blob"; then
+ git ls-files --stage |
+ munge_blobs |
+ git update-index --index-info
+ fi
+
parentstr=
for parent in $parents; do
for reparent in $(map "$parent"); do
--
1.5.4.3
Avery Pennarun
2008-04-23 19:42:37 UTC
Permalink
Signed-off-by: Avery Pennarun <***@gmail.com>
---
Documentation/git-filter-branch.txt | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt
index 2a78549..367f119 100644
--- a/Documentation/git-filter-branch.txt
+++ b/Documentation/git-filter-branch.txt
@@ -12,6 +12,7 @@ SYNOPSIS
[--index-filter <command>] [--parent-filter <command>]
[--msg-filter <command>] [--commit-filter <command>]
[--tag-name-filter <command>] [--subdirectory-filter <directory>]
+ [--blob-filter <command]
[--original <namespace>] [-d <directory>] [-f | --force]
[<rev-list options>...]

@@ -143,6 +144,15 @@ definition impossible to preserve signatures at any rate.)
The result will contain that directory (and only that) as its
project root.

+--blob-filter <command>::
+ This is the filter for modifying the contents of each file (blob)
+ in the tree. The contents of a file are provided on stdin, and
+ the new file contents should be provided on stdout. For efficiency,
+ the before/after results of a given blob are only calculated once
+ and then cached, so your filter must always return the same output
+ blob for any given input blob. You might use this filter for
+ converting CRLF to LF in all your files, for example.
+
--original <namespace>::
Use this option to set the namespace where the original commits
will be stored. The default value is 'refs/original'.
@@ -185,6 +195,13 @@ git filter-branch --index-filter 'git update-index --remove filename' HEAD

Now, you will get the rewritten history saved in HEAD.

+To convert CRLF to LF in all your files using the "fromdos" program (be
+careful: this will attempt to modify binary files too!):
+
+----------------------------------------------
+git filter-branch --blob-filter 'fromdos' HEAD
+----------------------------------------------
+
To set a commit (which typically is at the tip of another
history) to be the parent of the current initial commit, in
order to paste the other history behind the current history:
--
1.5.4.3
Avery Pennarun
2008-04-23 19:42:36 UTC
Permalink
The main loop of munge_blobs() had to fork-exec "cat" every time through the
loop, even when a blob was already cached. Let's use the sh builtin 'read'
instead for a huge speedup.

cd git
time git filter-branch --blob-filter 'tr a-z A-Z' HEAD~10..HEAD

(original --blob-filter)
real 3m58.569s
user 0m22.900s
sys 3m32.030s

(with 'cat' calls removed)
real 1m11.931s
user 0m8.520s
sys 1m2.900s

(with 'cat' calls removed and blob cache already filled)
real 0m19.660s
user 0m3.930s
sys 0m15.720s

Signed-off-by: Avery Pennarun <***@gmail.com>
---
git-filter-branch.sh | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 980c431..37ac99d 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -57,16 +57,18 @@ eval "$functions"
munge_blobs() {
while read mode sha1 stage path
do
- if ! test -r "$workdir/../blob-cache/$sha1"
+ if ! test -r "$cachedir/$sha1"
then
- new=`git cat-file blob $sha1 |
- eval "$filter_blob" |
- git hash-object -w --stdin`
- printf $new >$workdir/../blob-cache/$sha1
+ new=$(git cat-file blob $sha1 |
+ eval "$filter_blob" |
+ git hash-object -w --stdin)
+ printf $new >$cachedir/$sha1
+ else
+ read new <"$cachedir/$sha1"
fi
printf "%s %s\t%s\n" \
"$mode" \
- $(cat "$workdir/../blob-cache/$sha1") \
+ "$new" \
"$path"
done
}
@@ -108,6 +110,7 @@ USAGE="[--env-filter <command>] [--tree-filter <command>] \
[--index-filter <command>] [--parent-filter <command>] \
[--msg-filter <command>] [--commit-filter <command>] \
[--tag-name-filter <command>] [--subdirectory-filter <directory>] \
+[--blob-filter <command>] \
[--original <namespace>] [-d <directory>] [-f | --force] \
[<rev-list options>...]"

@@ -249,7 +252,8 @@ ret=0
mkdir ../map || die "Could not create map/ directory"

# cache rewritten blobs for blob filter
-mkdir ../blob-cache || die "Could not create blob-cache/ directory"
+cachedir="$workdir/../blob-cache"
+mkdir "$cachedir" || die "Could not create blob-cache/ directory"

case "$filter_subdir" in
"")
--
1.5.4.3
Johannes Schindelin
2008-04-23 20:05:19 UTC
Permalink
Hi,

On Wed, 23 Apr 2008, Avery Pennarun wrote:

> From: Jeff King <***@peff.net>
>
> On Tue, Apr 22, 2008 at 12:51:14PM -0400, Avery Pennarun wrote:
>
> > Do you think git would benefit from having a generalized version of
> > this script? Basically, the user provides a "munge" script on the
> > command line, and there's a git-filter-branch mode for auto-munging
> > (with a cache) every file in every checkin. Even if it's *only* ever
> > used for CRLF, I can imagine this being useful to a lot of people.
>
> It was easy enough to work up the patch below, which allows
>
> git filter-branch --blob-filter 'tr a-z A-Z'
>
> However, it's _still_ horribly slow. Shell script is nice and flexible,
> but running a tight loop like this is just painful. I suspect
> filter-branch in something like perl would be a lot faster and just as
> flexible (you could even do it in C, but you'd probably have to invent a
> little domain-specific scripting language).
>
> It is still much better performance than a tree filter, though:
>
> $ cd git && time git filter-branch --tree-filter '
> find . -type f | while read f; do
> tr a-z A-Z <"$f" >tmp
> mv tmp "$f"
> done
> ' HEAD~10..HEAD
>
> real 4m38.626s
> user 1m32.726s
> sys 2m51.163s
>
> $ cd git && git filter-branch --blob-filter 'tr a-z A-Z' HEAD~10..HEAD
> real 1m40.809s
> user 0m36.822s
> sys 1m14.273s
>
> Lots of system time in both. I'm sure we spend a fair bit of time
> hitting our very large map and blob-cache directories, which would be
> much more nicely implemented as associative arrays in memory (if we were
> using a more featureful language).
>
> Anyway, here is the patch. I don't know if it is even worth applying,
> since it is still painfully slow.

Not all of this belongs in the commit messaage.

> Acked-by: Johannes Schindelin <***@gmx.de>

This does.

A good general rule is: if you think it would be funny/strange to read
this message in the output of "git log", it should be changed.

Ciao,
Dscho
Avery Pennarun
2008-04-23 20:12:25 UTC
Permalink
On 4/23/08, Johannes Schindelin <***@gmx.de> wrote:
> Not all of this belongs in the commit messaage.
>
> > Acked-by: Johannes Schindelin <***@gmx.de>
>
> This does.
>
> A good general rule is: if you think it would be funny/strange to read
> this message in the output of "git log", it should be changed.

I felt uncomfortable modifying the message attached to Jeff's patch
(which actually does pretty clearly explain what's going on), since
it's not mine. If he wants to send me a better commit message,
that'll be fine too.

Have fun,

Avery
Johannes Schindelin
2008-04-23 20:14:16 UTC
Permalink
Hi,

On Wed, 23 Apr 2008, Avery Pennarun wrote:

> On 4/23/08, Johannes Schindelin <***@gmx.de> wrote:
> > Not all of this belongs in the commit messaage.
> >
> > > Acked-by: Johannes Schindelin <***@gmx.de>
> >
> > This does.
> >
> > A good general rule is: if you think it would be funny/strange to
> > read this message in the output of "git log", it should be changed.
>
> I felt uncomfortable modifying the message attached to Jeff's patch
> (which actually does pretty clearly explain what's going on), since
> it's not mine. If he wants to send me a better commit message,
> that'll be fine too.

Well, I think that you would do a good job rephrasing this as a proper
commit message :-)

Ciao,
Dscho
Avery Pennarun
2008-04-23 20:18:10 UTC
Permalink
From: Jeff King <***@peff.net>

This patch allows

git filter-branch --blob-filter 'tr a-z A-Z'

However, it's _still_ horribly slow. Shell script is nice and flexible,
but running a tight loop like this is just painful. I suspect
filter-branch in something like perl would be a lot faster and just as
flexible.

It is still much better performance than a tree filter, though:

$ cd git && time git filter-branch --tree-filter '
find . -type f | while read f; do
tr a-z A-Z <"$f" >tmp
mv tmp "$f"
done
' HEAD~10..HEAD

real 4m38.626s
user 1m32.726s
sys 2m51.163s

$ cd git && git filter-branch --blob-filter 'tr a-z A-Z' HEAD~10..HEAD
real 1m40.809s
user 0m36.822s
sys 1m14.273s

Acked-by: Johannes Schindelin <***@gmx.de>
---
git-filter-branch.sh | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index ea59015..980c431 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -54,6 +54,23 @@ EOF

eval "$functions"

+munge_blobs() {
+ while read mode sha1 stage path
+ do
+ if ! test -r "$workdir/../blob-cache/$sha1"
+ then
+ new=`git cat-file blob $sha1 |
+ eval "$filter_blob" |
+ git hash-object -w --stdin`
+ printf $new >$workdir/../blob-cache/$sha1
+ fi
+ printf "%s %s\t%s\n" \
+ "$mode" \
+ $(cat "$workdir/../blob-cache/$sha1") \
+ "$path"
+ done
+}
+
# When piped a commit, output a script to set the ident of either
# "author" or "committer

@@ -105,6 +122,7 @@ tempdir=.git-rewrite
filter_env=
filter_tree=
filter_index=
+filter_blob=
filter_parent=
filter_msg=cat
filter_commit='git commit-tree "$@"'
@@ -150,6 +168,9 @@ do
--index-filter)
filter_index="$OPTARG"
;;
+ --blob-filter)
+ filter_blob="$OPTARG"
+ ;;
--parent-filter)
filter_parent="$OPTARG"
;;
@@ -227,6 +248,9 @@ ret=0
# map old->new commit ids for rewriting parents
mkdir ../map || die "Could not create map/ directory"

+# cache rewritten blobs for blob filter
+mkdir ../blob-cache || die "Could not create blob-cache/ directory"
+
case "$filter_subdir" in
"")
git rev-list --reverse --topo-order --default HEAD \
@@ -295,6 +319,12 @@ while read commit parents; do
eval "$filter_index" < /dev/null ||
die "index filter failed: $filter_index"

+ if test -n "$filter_blob"; then
+ git ls-files --stage |
+ munge_blobs |
+ git update-index --index-info
+ fi
+
parentstr=
for parent in $parents; do
for reparent in $(map "$parent"); do
--
1.5.4.3
Johannes Schindelin
2008-04-23 20:22:58 UTC
Permalink
Hi,

On Wed, 23 Apr 2008, Avery Pennarun wrote:

> From: Jeff King <***@peff.net>
>
> This patch allows
>
> git filter-branch --blob-filter 'tr a-z A-Z'
>
> However, it's _still_ horribly slow. Shell script is nice and flexible,
> but running a tight loop like this is just painful. I suspect
> filter-branch in something like perl would be a lot faster and just as
> flexible.
>
> It is still much better performance than a tree filter, though:
>
> $ cd git && time git filter-branch --tree-filter '
> find . -type f | while read f; do
> tr a-z A-Z <"$f" >tmp
> mv tmp "$f"
> done
> ' HEAD~10..HEAD
>
> real 4m38.626s
> user 1m32.726s
> sys 2m51.163s
>
> $ cd git && git filter-branch --blob-filter 'tr a-z A-Z' HEAD~10..HEAD
> real 1m40.809s
> user 0m36.822s
> sys 1m14.273s
>
> Acked-by: Johannes Schindelin <***@gmx.de>
> ---

Thanks, I really appreciate it.

Ciao,
Dscho
Jeff King
2008-04-23 21:55:01 UTC
Permalink
On Wed, Apr 23, 2008 at 04:18:10PM -0400, Avery Pennarun wrote:

> From: Jeff King <***@peff.net>
>
> This patch allows
>
> git filter-branch --blob-filter 'tr a-z A-Z'

The commit message munging you did is fine.

However, I think Johannes Sixt's question about providing the pathname
needs to be resolved. As it is now, the blob-filter is impossible to use
in a mixed binary/text repository, short of the undocumented $path magic
that you described. And I am a little uncomfortable just adding the
$path as he suggested because of the subtle bug it introduces.

-Peff
Avery Pennarun
2008-04-23 22:07:03 UTC
Permalink
On 4/23/08, Jeff King <***@peff.net> wrote:
> On Wed, Apr 23, 2008 at 04:18:10PM -0400, Avery Pennarun wrote:
>
> > From: Jeff King <***@peff.net>
> >
> > This patch allows
> >
> > git filter-branch --blob-filter 'tr a-z A-Z'
>
> The commit message munging you did is fine.
>
> However, I think Johannes Sixt's question about providing the pathname
> needs to be resolved. As it is now, the blob-filter is impossible to use
> in a mixed binary/text repository, short of the undocumented $path magic
> that you described. And I am a little uncomfortable just adding the
> $path as he suggested because of the subtle bug it introduces.

It is indeed a very subtle bug; so subtle, in fact, that I never
expect to experience it myself :)

I think it would be fine to index into the cache using $path$sha1,
which would seem to resolve this issue. The catch is that $path isn't
a very good cachefile name. I'd suggest doing an md5sum or something
on it, but that would result in an extra fork for every file, which
brings us back to our original level of slowness (or worse).

Hmm, I gues using a cachefile like $sha1/$path would work; it requires
a "mkdir -p", but only when *filling* the cache.

Avery
Jeff King
2008-04-24 01:33:00 UTC
Permalink
On Wed, Apr 23, 2008 at 06:07:03PM -0400, Avery Pennarun wrote:

> I think it would be fine to index into the cache using $path$sha1,
> which would seem to resolve this issue. The catch is that $path isn't
> a very good cachefile name. I'd suggest doing an md5sum or something
> on it, but that would result in an extra fork for every file, which
> brings us back to our original level of slowness (or worse).
>
> Hmm, I gues using a cachefile like $sha1/$path would work; it requires
> a "mkdir -p", but only when *filling* the cache.

Keep in mind that $path can have slashes. So you actually need to:

mkdir -p `dirname $sha1/$path`
echo $new >$sha1/$path

-Peff
Bart Trojanowski
2008-04-24 00:57:48 UTC
Permalink
make git status act similar to git log and git diff by presenting long
output in a pager.

Signed-off-by: Bart Trojanowski <***@jukie.net>
---
git.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git.c b/git.c
index c4e4644..89b431f 100644
--- a/git.c
+++ b/git.c
@@ -347,7 +347,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "shortlog", cmd_shortlog, USE_PAGER },
{ "show-branch", cmd_show_branch, RUN_SETUP },
{ "show", cmd_show, RUN_SETUP | USE_PAGER },
- { "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
+ { "status", cmd_status, RUN_SETUP | NEED_WORK_TREE | USE_PAGER },
{ "stripspace", cmd_stripspace },
{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
{ "tag", cmd_tag, RUN_SETUP },
--
1.5.5.1.80.g0f8afae
Johannes Schindelin
2008-04-24 08:21:04 UTC
Permalink
Hi,

On Wed, 23 Apr 2008, Bart Trojanowski wrote:

> make git status act similar to git log and git diff by presenting long
> output in a pager.

Heh. The first thing I do on new machines is to compile and install Git.
The second is "git config --global alias.ps '-p status'" :-)

So I obviously like your patch.

Ciao,
Dscho
Matt Graham
2008-04-24 13:12:51 UTC
Permalink
On Thu, Apr 24, 2008 at 4:21 AM, Johannes Schindelin
<***@gmx.de> wrote:
> Hi,
>
> On Wed, 23 Apr 2008, Bart Trojanowski wrote:
>
> > make git status act similar to git log and git diff by presenting long
> > output in a pager.
>
> Heh. The first thing I do on new machines is to compile and install Git.
> The second is "git config --global alias.ps '-p status'" :-)
>
> So I obviously like your patch.

Yes. This also helps those of use who didn't know you could alias
status to always page and were constantly typing git status |less.
Thanks!
Loading...