mirror of
https://github.com/git/git.git
synced 2024-11-28 04:23:30 +08:00
Merge branch 'maint'
* maint: git-svn: fix find-rev error message when missing arg t0021: tr portability fix for Solaris launch_editor(): allow spaces in the filename git rebase --abort: always restore the right commit
This commit is contained in:
commit
b81a7b5887
@ -50,12 +50,15 @@ void launch_editor(const char *path, struct strbuf *buffer, const char *const *e
|
||||
size_t len = strlen(editor);
|
||||
int i = 0;
|
||||
const char *args[6];
|
||||
struct strbuf arg0;
|
||||
|
||||
strbuf_init(&arg0, 0);
|
||||
if (strcspn(editor, "$ \t'") != len) {
|
||||
/* there are specials */
|
||||
strbuf_addf(&arg0, "%s \"$@\"", editor);
|
||||
args[i++] = "sh";
|
||||
args[i++] = "-c";
|
||||
args[i++] = "$0 \"$@\"";
|
||||
args[i++] = arg0.buf;
|
||||
}
|
||||
args[i++] = editor;
|
||||
args[i++] = path;
|
||||
@ -63,6 +66,7 @@ void launch_editor(const char *path, struct strbuf *buffer, const char *const *e
|
||||
|
||||
if (run_command_v_opt_cd_env(args, 0, NULL, env))
|
||||
die("There was a problem with the editor %s.", editor);
|
||||
strbuf_release(&arg0);
|
||||
}
|
||||
|
||||
if (!buffer)
|
||||
|
@ -522,7 +522,8 @@ sub cmd_dcommit {
|
||||
}
|
||||
|
||||
sub cmd_find_rev {
|
||||
my $revision_or_hash = shift;
|
||||
my $revision_or_hash = shift or die "SVN or git revision required ",
|
||||
"as a command-line argument\n";
|
||||
my $result;
|
||||
if ($revision_or_hash =~ /^r\d+$/) {
|
||||
my $head = shift;
|
||||
|
@ -5,7 +5,9 @@ test_description='blob conversion via gitattributes'
|
||||
. ./test-lib.sh
|
||||
|
||||
cat <<\EOF >rot13.sh
|
||||
tr '[a-zA-Z]' '[n-za-mN-ZA-M]'
|
||||
tr \
|
||||
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \
|
||||
'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
|
||||
EOF
|
||||
chmod +x rot13.sh
|
||||
|
||||
|
@ -89,6 +89,33 @@ do
|
||||
'
|
||||
done
|
||||
|
||||
test_expect_success 'editor with a space' '
|
||||
|
||||
if echo "echo space > \"\$1\"" > "e space.sh"
|
||||
then
|
||||
chmod a+x "e space.sh" &&
|
||||
GIT_EDITOR="./e\ space.sh" git commit --amend &&
|
||||
test space = "$(git show -s --pretty=format:%s)"
|
||||
else
|
||||
say "Skipping; FS does not support spaces in filenames"
|
||||
fi
|
||||
|
||||
'
|
||||
|
||||
unset GIT_EDITOR
|
||||
test_expect_success 'core.editor with a space' '
|
||||
|
||||
if test -f "e space.sh"
|
||||
then
|
||||
git config core.editor \"./e\ space.sh\" &&
|
||||
git commit --amend &&
|
||||
test space = "$(git show -s --pretty=format:%s)"
|
||||
else
|
||||
say "Skipping; FS does not support spaces in filenames"
|
||||
fi
|
||||
|
||||
'
|
||||
|
||||
TERM="$OLD_TERM"
|
||||
|
||||
test_done
|
||||
|
Loading…
Reference in New Issue
Block a user