All of lore.kernel.org
 help / color / mirror / Atom feed
* git notes and core.editor config
@ 2011-01-11 10:11 Jeenu V
  2011-01-11 10:31 ` Johan Herland
  0 siblings, 1 reply; 6+ messages in thread
From: Jeenu V @ 2011-01-11 10:11 UTC (permalink / raw)
  To: git

My core.editor value in $HOME/.gitconfig is set to

  [core]
      editor = vi "+set tw=72 spell"

so that I've text width of 72 with spell check turned on. I haven't
found problems with any git commands that invoke editor, but notes.
'git notes' seems to invoke the vi for me with 3 separate arguments
instead of just one: "+set, tw=72, and spell". In other words, I don't
think it honors shell quoting for editor config variable.

Could this be a bug?

-- 
Jeenu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git notes and core.editor config
  2011-01-11 10:11 git notes and core.editor config Jeenu V
@ 2011-01-11 10:31 ` Johan Herland
  2011-01-11 11:14   ` Jeenu V
  0 siblings, 1 reply; 6+ messages in thread
From: Johan Herland @ 2011-01-11 10:31 UTC (permalink / raw)
  To: Jeenu V; +Cc: git

On Tuesday 11 January 2011, Jeenu V wrote:
> My core.editor value in $HOME/.gitconfig is set to
>
>   [core]
>       editor = vi "+set tw=72 spell"
>
> so that I've text width of 72 with spell check turned on. I haven't
> found problems with any git commands that invoke editor, but notes.
> 'git notes' seems to invoke the vi for me with 3 separate arguments
> instead of just one: "+set, tw=72, and spell". In other words, I
> don't think it honors shell quoting for editor config variable.
>
> Could this be a bug?

Indeed, it could, but I cannot immediately see what causes it. In 
current 'master', builtin/notes.c launches the editor like this:

  if (launch_editor(path, &(msg->buf), NULL)) ...

while builtin/commit.c lauches the editor like this:

  if (launch_editor(git_path(commit_editmsg), NULL, env)) ...

In both cases, the details of interpreting core.editor is left to 
git_default_core_config(), and passed to launch_editor() using the 
editor_program global variable. AFAICS there is no difference between 
how "notes" and "commit" interprets core.editor.

What Git version are you running?


...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git notes and core.editor config
  2011-01-11 10:31 ` Johan Herland
@ 2011-01-11 11:14   ` Jeenu V
  2011-01-11 12:26     ` Thomas Rast
  2011-01-11 12:36     ` Johan Herland
  0 siblings, 2 replies; 6+ messages in thread
From: Jeenu V @ 2011-01-11 11:14 UTC (permalink / raw)
  To: Johan Herland; +Cc: git

On Tue, Jan 11, 2011 at 4:01 PM, Johan Herland <johan@herland.net> wrote:
> On Tuesday 11 January 2011, Jeenu V wrote:
>> My core.editor value in $HOME/.gitconfig is set to
>>
>>   [core]
>>       editor = vi "+set tw=72 spell"
>>
>> so that I've text width of 72 with spell check turned on. I haven't
>> found problems with any git commands that invoke editor, but notes.
>> 'git notes' seems to invoke the vi for me with 3 separate arguments
>> instead of just one: "+set, tw=72, and spell". In other words, I
>> don't think it honors shell quoting for editor config variable.
>>
>> Could this be a bug?
>
> Indeed, it could, but I cannot immediately see what causes it. In
> current 'master', builtin/notes.c launches the editor like this:
>
>  if (launch_editor(path, &(msg->buf), NULL)) ...
>
> while builtin/commit.c lauches the editor like this:
>
>  if (launch_editor(git_path(commit_editmsg), NULL, env)) ...
>
> In both cases, the details of interpreting core.editor is left to
> git_default_core_config(), and passed to launch_editor() using the
> editor_program global variable. AFAICS there is no difference between
> how "notes" and "commit" interprets core.editor.
>
> What Git version are you running?

$ git --version
git version 1.7.0.4

-- 
Jeenu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git notes and core.editor config
  2011-01-11 11:14   ` Jeenu V
@ 2011-01-11 12:26     ` Thomas Rast
  2011-01-11 12:36     ` Johan Herland
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Rast @ 2011-01-11 12:26 UTC (permalink / raw)
  To: Jeenu V; +Cc: Johan Herland, git

Jeenu V wrote:
> On Tue, Jan 11, 2011 at 4:01 PM, Johan Herland <johan@herland.net> wrote:
> >> In other words, I
> >> don't think [git-notes] honors shell quoting for editor config variable.
> >
> > Indeed, it could, but I cannot immediately see what causes it. In
> > current 'master', builtin/notes.c launches the editor like this:
> >
> >  if (launch_editor(path, &(msg->buf), NULL)) ...
> >
> > while builtin/commit.c lauches the editor like this:
> >
> >  if (launch_editor(git_path(commit_editmsg), NULL, env)) ...
[...]
> $ git --version
> git version 1.7.0.4

git-notes was a script before 1.7.1, and that was indeed buggy in that
it used the editor as

  ${GIT_EDITOR:-${core_editor:-${VISUAL:-${EDITOR:-vi}}}} "$MSG_FILE"

instead of using git_editor() from git-sh-setup, which would have gone
through eval.

The builtin version of git-notes does not have this problem.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git notes and core.editor config
  2011-01-11 11:14   ` Jeenu V
  2011-01-11 12:26     ` Thomas Rast
@ 2011-01-11 12:36     ` Johan Herland
  2011-01-11 13:12       ` Jeenu V
  1 sibling, 1 reply; 6+ messages in thread
From: Johan Herland @ 2011-01-11 12:36 UTC (permalink / raw)
  To: Jeenu V; +Cc: git

On Tuesday 11 January 2011, Jeenu V wrote:
> On Tue, Jan 11, 2011 at 4:01 PM, Johan Herland <johan@herland.net> 
wrote:
> > On Tuesday 11 January 2011, Jeenu V wrote:
> >> My core.editor value in $HOME/.gitconfig is set to
> >>
> >>   [core]
> >>       editor = vi "+set tw=72 spell"
> >>
> >> so that I've text width of 72 with spell check turned on. I
> >> haven't found problems with any git commands that invoke editor,
> >> but notes. 'git notes' seems to invoke the vi for me with 3
> >> separate arguments instead of just one: "+set, tw=72, and spell".
> >> In other words, I don't think it honors shell quoting for editor
> >> config variable.
> >>
> >> Could this be a bug?
> >
> > What Git version are you running?
>
> $ git --version
> git version 1.7.0.4

Ah, there's your problem. In v1.7.1 "git notes" was builtin-ified (it 
used to be a shell script, but was reimplemented in C), so you're still 
running the shell script version of "git notes". I believe upgrading 
will solve your problem (as well as making "git notes" more 
featureful).


...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git notes and core.editor config
  2011-01-11 12:36     ` Johan Herland
@ 2011-01-11 13:12       ` Jeenu V
  0 siblings, 0 replies; 6+ messages in thread
From: Jeenu V @ 2011-01-11 13:12 UTC (permalink / raw)
  To: Johan Herland; +Cc: git

On Tue, Jan 11, 2011 at 6:06 PM, Johan Herland <johan@herland.net> wrote:
>> $ git --version
>> git version 1.7.0.4
>
> Ah, there's your problem. In v1.7.1 "git notes" was builtin-ified (it
> used to be a shell script, but was reimplemented in C), so you're still
> running the shell script version of "git notes". I believe upgrading
> will solve your problem (as well as making "git notes" more
> featureful).
>

Alright, I'll try upgrading then. Thanks.

-- 
Jeenu

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-01-11 13:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-11 10:11 git notes and core.editor config Jeenu V
2011-01-11 10:31 ` Johan Herland
2011-01-11 11:14   ` Jeenu V
2011-01-11 12:26     ` Thomas Rast
2011-01-11 12:36     ` Johan Herland
2011-01-11 13:12       ` Jeenu V

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.