git-svn: search --authors-prog in PATH too
authorAndreas Heiduk <asheiduk@gmail.com>
Sun, 4 Mar 2018 11:22:36 +0000 (12:22 +0100)
committerEric Wong <e@80x24.org>
Thu, 5 Apr 2018 06:55:02 +0000 (06:55 +0000)
In 36db1eddf9 ("git-svn: add --authors-prog option", 2009-05-14) the path
to authors-prog was made absolute because git-svn changes the current
directory in some situations. This makes sense if the program is part of
the repository but prevents searching via $PATH.

The old behaviour is still retained, but if the file does not exists, then
authors-prog is searched for in $PATH as any other command.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Eric Wong <e@80x24.org>
Documentation/git-svn.txt
git-svn.perl
index 636e09048e8846b813166737ef58eef96eb3a3c4..b858374649b641bbdbb876b9614ee0add88c7db2 100644 (file)
@@ -657,6 +657,11 @@ config key: svn.authorsfile
        expected to return a single line of the form "Name <email>",
        which will be treated as if included in the authors file.
 +
+Due to historical reasons a relative 'filename' is first searched
+relative to the current directory for 'init' and 'clone' and relative
+to the root of the working tree for 'fetch'. If 'filename' is
+not found, it is searched like any other command in '$PATH'.
++
 [verse]
 config key: svn.authorsProg
 
index a6b6c3e40c180e58186f9ef8af5c6fd6fc654080..050f2a36f414f147f3bde3cc9f69639d5a36a975 100755 (executable)
@@ -374,7 +374,8 @@ sub term_init {
 usage(1) unless defined $cmd;
 load_authors() if $_authors;
 if (defined $_authors_prog) {
-       $_authors_prog = "'" . File::Spec->rel2abs($_authors_prog) . "'";
+       my $abs_file = File::Spec->rel2abs($_authors_prog);
+       $_authors_prog = "'" . $abs_file . "'" if -x $abs_file;
 }
 
 unless ($cmd =~ /^(?:clone|init|multi-init|commit-diff)$/) {