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

Re: [PATCH v3 03/10] config: Make git_config() more flexible

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Feb 18, 2009, 21:30 UTC
Message-ID
<94a0d4530902181330o298fce1am31d9d15145956d78@mail.gmail.com>
In-Reply-To
<7viqn7v47s.fsf@gitster.siamese.dyndns.org>
On Wed, Feb 18, 2009 at 11:13 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> Currently git_config() returns an error if there is no repo config file
>> available (cwd is not a git repo); it will correctly parse the system
>> and global config files, but still return an error.
>
> Currently it does???
>
> Here is what I get from using the command from master and next:
>
>    $ cd /var/tmp
>    $ ls -d /.git /var/.git /var/tmp/.git /var/tmp/config
>    ls: /.git: No such file or directory
>    ls: /var/.git: No such file or directory
>    ls: /var/tmp/.git: No such file or directory
>    ls: /var/tmp/config: No such file or directory
>    $ git config -l >/dev/null ; echo $?
>    0
>    $ git config alias.co; echo $?
>    checkout
>    0

This patch doesn't alter the behavior of 'git config', it's for git_config() (the function). At this point cmd_config() will return an exit code of 0 even if there's an error on git_config() when no exclusive file is specified.

Show 13 quoted lines
> I have $HOME/.gitconfig (where the alias comes from) and no system wide
> configuration file.
>
> Also the patch is mistitled.  Whatever you are trying to say about the
> current problem which I do not seem to get, and whatever different
> behaviour from the current one you are trying to implement (which is not
> quite clear from the above log message), it is not about making it more
> flexible.
>
> The patch text suggests you are trying to change the function's exit
> status so the title would be "git-config: report errors correctly in its
> exit status", but it is unspecified in your commit log message what
> definition of "correctly" you are using in this patch.

What I'm trying to do is "Make git_config() don't return an error when there's no repo config file if there are other config files available"... I thought there was no short way to say that =/

-- 
Felipe Contreras
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 16 in “config: Codestyle cleanups.”
  1. 01/10 config: Codestyle cleanups.Felipe Contreras, Feb 17, 2009
  2. 02/10 config: Cleanup editor action.Felipe Contreras, Feb 17, 2009
  3. 03/10 config: Make git_config() more flexible.Felipe Contreras, Feb 17, 2009
  4. 04/10 config: Trivial rename in preparation for parseopt.Felipe Contreras, Feb 17, 2009
  5. 05/10 config: Reorganize get_color*.Felipe Contreras, Feb 17, 2009
  6. 06/10 config: Use parseopt.Felipe Contreras, Feb 17, 2009
  7. 07/10 config: Disallow --getcolor* and other actions.Felipe Contreras, Feb 17, 2009
  8. 08/10 config: Disallow multiple config file locations.Felipe Contreras, Feb 17, 2009
  9. 09/10 config: Disallow multiple variable types.Felipe Contreras, Feb 17, 2009
  10. 10/10 config: Don't allow extra arguments for -e or -l.Felipe Contreras, Feb 17, 2009
  11. Junio C HamanoFeb 18, 2009
  12. Felipe ContrerasFeb 18, 2009
  13. Junio C HamanoFeb 18, 2009
  14. Sverre RabbelierFeb 17, 2009
  15. Felipe ContrerasFeb 18, 2009
  16. Junio C HamanoFeb 18, 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.