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