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

Re: [PATCH v3] config: Add new option to open an editor.

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Feb 7, 2009, 21:50 UTC
Message-ID
<94a0d4530902071350h4caab5a8s597ed099d232dde9@mail.gmail.com>
In-Reply-To
<7vskmque25.fsf@gitster.siamese.dyndns.org>
On Sat, Feb 7, 2009 at 11:34 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 22 quoted lines
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>>>> I think it should, how expensive would it be to call
>>>> git_config(git_default_config, NULL) when it has been loaded already?
>>>
>>> We would not need the complete git_default_config(), would we?
>>
>> Nope, just core.editor. But I don't know how to load only that.
>
> The most expensive part is to actually open and parse the files into
> tokens, not strcmp/prefixcmp the parsed tokens and flipping internal bits
> and storing value in const char * variables.
>
> But you need to be careful about correctness issues.  I do not want
> launch_editor() to run git_config().  The caller, other than the caller
> you happen to be interested in this thread, may already have read the
> config and overrode some of the bits with what was given from the command
> line.  Calling git_config() overwrite the bits and will break these
> callers.
>
> I think the right thing to do is to call git_config() immediately before
> you call launch_editor() in your patch.

Right, also for some reason the caller might actually call a specific editor and not the one configured, but that would require more changes to editor.c

For now I guess this patch should be fine (re-sending).
-- 
Felipe Contreras
Previous: Junio C HamanoNext: Felipe Contreras
Message 22 of 25 in “config: Add new option to open an editor.”
  1. config: Add new option to open an editor.Felipe Contreras, Feb 3, 2009
  2. Johannes SchindelinFeb 3, 2009
  3. Felipe ContrerasFeb 3, 2009
  4. Johannes SchindelinFeb 3, 2009
  5. Felipe ContrerasFeb 3, 2009
  6. config: Add new option to open an editor.Felipe Contreras, Feb 3, 2009
  7. Johannes SchindelinFeb 3, 2009
  8. Felipe ContrerasFeb 3, 2009
  9. Jeff KingFeb 4, 2009
  10. Felipe ContrerasFeb 4, 2009
  11. Jeff KingFeb 4, 2009
  12. Felipe ContrerasFeb 4, 2009
  13. config: Add new option to open an editor.Felipe Contreras, Feb 4, 2009
  14. Junio C HamanoFeb 4, 2009
  15. Felipe ContrerasFeb 4, 2009
  16. Johannes SchindelinFeb 4, 2009
  17. Johannes SchindelinFeb 4, 2009
  18. Felipe ContrerasFeb 7, 2009
  19. Johannes SchindelinFeb 7, 2009
  20. Felipe ContrerasFeb 7, 2009
  21. Junio C HamanoFeb 7, 2009
  22. Felipe ContrerasFeb 7, 2009
  23. config: Add new option to open an editor.Felipe Contreras, Feb 7, 2009
  24. Johannes SchindelinFeb 4, 2009
  25. Felipe ContrerasFeb 4, 2009

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.