git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-sh-setup.sh: make GIT_EDITOR/core.editor/VISUAL/EDITOR accept commands

From
David Kastrup <dak@gnu.org>
Date
Aug 1, 2007, 23:55 UTC
Message-ID
<85wswex11h.fsf@lola.goethe.zz>
In-Reply-To
<7vy7gu3kuh.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
Show 15 quoted lines
> David Kastrup <dak@gnu.org> writes:
>
>> David Kastrup <dak@gnu.org> writes:
>>
>>> The previous code only allowed specifying a single executable rather
>>> than a complete command like "emacsclient --alternate-editor vi" in
>>
>> Oops, won't apply cleanly.  I found that I had already made a
>> different (trivial) patch previously.  Let me try again and fold that
>> patch in manually.
>
> It is not just "won't apply".  What if GIT_DIR had spaces (which
> is fine) and single-quotes in it?  Wouldn't it percolate down to
> $@ because it becomes the leading directory of the temporary
> file name?  And you quote '"$@"' and eval it, now what happens?

The eval removes the outer single quotes and then evaluates the remaining "$@" which leaves the original argument structure completely intact: What got passed into git_editor as 3 arguments will remain as 3 arguments, and even multiple embedded spaces in one argument will get preserved perfectly.

If you don't believe me, throw whatever you want at it.
-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Previous: Junio C HamanoNext: Matthias Lederhofer
Message 14 of 16 in “Interpreting EDITOR/VISUAL environment variables.”
  1. David KastrupAug 1, 2007
  2. Junio C HamanoAug 1, 2007
  3. Yann DirsonAug 1, 2007
  4. David KastrupAug 1, 2007
  5. David KastrupAug 1, 2007
  6. Junio C HamanoAug 1, 2007
  7. git-sh-setup.sh: make GIT_EDITOR/core.editor/VISUAL/EDITOR accept commandsDavid Kastrup, Aug 1, 2007
  8. David KastrupAug 1, 2007
  9. git-sh-setup.sh: make GIT_EDITOR/core.editor/VISUAL/EDITOR accept commandsDavid Kastrup, Aug 1, 2007
  10. Junio C HamanoAug 1, 2007
  11. Junio C HamanoAug 1, 2007
  12. David KastrupAug 1, 2007
  13. Junio C HamanoAug 2, 2007
  14. David KastrupAug 1, 2007
  15. Matthias LederhoferAug 2, 2007
  16. David KastrupAug 2, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.