shears: allow overriding the editor via GIT_EDITOR

If the GIT_EDITOR variable was already exported, `git var GIT_EDITOR`
would pick up the *already-overridden* editor, causing an infinite loop.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2017-07-03 17:37:23 +02:00
Родитель a7b41a048f
Коммит 0877f5dd76
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -585,15 +585,15 @@ setup () {
git config alias..r "!sh \"$this\"" &&
generate_script > "$git_dir"/SHEARS-SCRIPT &&
GIT_EDITOR="$(cd "$git_dir" && pwd)/SHEARS-EDITOR" &&
cat > "$GIT_EDITOR" << EOF &&
shears_editor="$(cd "$git_dir" && pwd)/SHEARS-EDITOR" &&
cat > "$shears_editor" << EOF &&
#!/bin/sh
exec "$this" edit "$(git var GIT_EDITOR)" "\$@"
EOF
chmod +x "$GIT_EDITOR" &&
GIT_EDITOR="\"$GIT_EDITOR\"" &&
GIT_SEQUENCE_EDITOR="$GIT_EDITOR" &&
chmod +x "$shears_editor" &&
GIT_EDITOR="\"$shears_editor\"" &&
GIT_SEQUENCE_EDITOR="$shears_editor" &&
export GIT_EDITOR GIT_SEQUENCE_EDITOR
}