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

Re: [PATCH (Apple Git) 12/13] Enable support for Xcode.app-bundled gitconfig

From
Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date
Jan 30, 2019, 22:01 UTC
Message-ID
<8507DB9E-A76E-4038-BDB6-110066865C1E@apple.com>
In-Reply-To
<EE1DF652-C42D-4106-8A81-55262EC578D0@apple.com>
Show 44 quoted lines
> On Jan 30, 2019, at 13:09, Jeremy Huddleston Sequoia <jeremyhu@apple.com> wrote:
> 
> 
> 
>> On Jan 30, 2019, at 11:32, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>> 
>> Hi Jeremy,
>> 
>> On Tue, 29 Jan 2019, Jeremy Huddleston Sequoia wrote:
>> 
>>>> On Jan 29, 2019, at 3:10 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>>> 
>>>> Jeremy Huddleston Sequoia <jeremyhu@apple.com> writes:
>>>> 
>>>>> Useful for setting up osxkeychain in Xcode.app's gitconfig
>>>>> 
>>>>> Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
>>>>> ---
>>>> 
>>>> A concern shared with 13/13 is this.
>>>> 
>>>> While it may not hurt too much to look at one extra location even on
>>>> non-Apple platform, it probably is a mistake to have this xcode
>>>> specific change in generic part of the system like config.c or
>>>> attr.c.  For that matter, would it make sense to force Apple uses to
>>>> look at one extra location in the first place?  In other words, we
>>>> already have "system wide" location (i.e. system_path(ETC_GITCONFIG))
>>>> defined so system owners can give reasonable default to its users.
>>>> The value of not using that facility and instead adding yet another
>>>> place is dubious.
>>> 
>>> This allows for per-distribution configuration and could be useful for
>>> other applications as well that want customizations specific to their
>>> install of git.  For our specific use case, we do not want to munge the
>>> system policy when installing Xcode.  Prior to doing things this way, we
>>> were just changing the default in our distributed git binary, but this
>>> seems a bit more flexible.
>> 
>> I think you misunderstood Junio, thinking that he referred to
>> /etc/gitconfig. He did not. system_path(ETC_GITCONFIG) refers to
>> <prefix>/etc/gitconfig, where <prefix> is that runtime prefix when
>> compiled with RUNTIME_PREFIX.
> 
> Oh!  Awesome.  I didn't even notice this was a thing.  That would exactly solve our use case.  I'll give that a whirl.  That likely allows us to eliminate these two patches completely!
Unfortunately, I was quick to celebrate.  This picks up the bundled file instead of a system-wide file.  I'd love it if we could still honor system-wide config/attributes in addition to RUNTIME_PREFIX-relative ones (eg: user overrides system which overrides distribution).  I worry that as is, we'd stop referencing the system-wide configs which might confuse users.
Is that something you'd be interested in, or should we just continue to maintain our separate patches?
Show 78 quoted lines
> 
>> So you can definitely have your own per-distribution configuration: it
>> lives in that very <prefix>/etc/gitconfig where the portable Git is
>> installed.
>> 
>> And since we have that nice facility, I agree with Junio that we probably
>> do not even need an extra config, certainly not one just introduced for
>> XCode.
>> 
>> Ciao,
>> Johannes
>> 
>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> config.c | 13 +++++++++++++
>>>>> config.h |  2 ++
>>>>> 2 files changed, 15 insertions(+)
>>>>> 
>>>>> diff --git a/config.c b/config.c
>>>>> index ff521eb27a..656bfef8ab 100644
>>>>> --- a/config.c
>>>>> +++ b/config.c
>>>>> @@ -1631,6 +1631,14 @@ const char *git_etc_gitconfig(void)
>>>>> 	return system_wide;
>>>>> }
>>>>> 
>>>>> +const char *git_xcode_gitconfig(void)
>>>>> +{
>>>>> +	static const char *xcode_config;
>>>>> +	if (!xcode_config)
>>>>> +		xcode_config = system_path("share/git-core/gitconfig");
>>>>> +	return xcode_config;
>>>>> +}
>>>>> +
>>>>> /*
>>>>> * Parse environment variable 'k' as a boolean (in various
>>>>> * possible spellings); if missing, use the default value 'def'.
>>>>> @@ -1673,6 +1681,11 @@ static int do_git_config_sequence(const struct config_options *opts,
>>>>> 	else
>>>>> 		repo_config = NULL;
>>>>> 
>>>>> +	current_parsing_scope = CONFIG_SCOPE_XCODE;
>>>>> +	if (git_config_system() && git_xcode_gitconfig() && !access_or_die(git_xcode_gitconfig(), R_OK, 0))
>>>>> +		ret += git_config_from_file(fn, git_xcode_gitconfig(),
>>>>> +					    data);
>>>>> +
>>>>> 	current_parsing_scope = CONFIG_SCOPE_SYSTEM;
>>>>> 	if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK, 0))
>>>>> 		ret += git_config_from_file(fn, git_etc_gitconfig(),
>>>>> diff --git a/config.h b/config.h
>>>>> index ee5d3fa7b4..f848423d28 100644
>>>>> --- a/config.h
>>>>> +++ b/config.h
>>>>> @@ -115,6 +115,7 @@ extern int git_config_rename_section_in_file(const char *, const char *, const c
>>>>> extern int git_config_copy_section(const char *, const char *);
>>>>> extern int git_config_copy_section_in_file(const char *, const char *, const char *);
>>>>> extern const char *git_etc_gitconfig(void);
>>>>> +extern const char *git_xcode_gitconfig(void);
>>>>> extern int git_env_bool(const char *, int);
>>>>> extern unsigned long git_env_ulong(const char *, unsigned long);
>>>>> extern int git_config_system(void);
>>>>> @@ -131,6 +132,7 @@ enum config_scope {
>>>>> 	CONFIG_SCOPE_GLOBAL,
>>>>> 	CONFIG_SCOPE_REPO,
>>>>> 	CONFIG_SCOPE_CMDLINE,
>>>>> +	CONFIG_SCOPE_XCODE,
>>>>> };
>>>>> 
>>>>> extern enum config_scope current_config_scope(void);
>>> 
>>> 
> 
Previous: Jeremy Huddleston SequoiaNext: Jonathan Nieder
Message 46 of 63 in “Differences between git-2.20.1 and Apple Git-116”
  1. 00/13 Differences between git-2.20.1 and Apple Git-116Jeremy Huddleston Sequoia, Jan 29, 2019
  2. 05/13 t5701: git --version can have SP in itJeremy Huddleston Sequoia, Jan 29, 2019
  3. Johannes SchindelinJan 30, 2019
  4. Jeremy Huddleston SequoiaJan 30, 2019
  5. 08/13 git mergetool/difftool doesn't list 'opendiff' as an available tool on 10.8Jeremy Huddleston Sequoia, Jan 29, 2019
  6. Johannes SchindelinJan 30, 2019
  7. 06/13 Set Apple Git version during buildJeremy Huddleston Sequoia, Jan 29, 2019
  8. Johannes SchindelinJan 30, 2019
  9. Jeremy Huddleston SequoiaJan 30, 2019
  10. 09/13 Use symbolic links rather than hard links for files in libexecJeremy Huddleston Sequoia, Jan 29, 2019
  11. brian m. carlsonJan 30, 2019
  12. Jeremy Huddleston SequoiaJan 30, 2019
  13. Johannes SchindelinJan 30, 2019
  14. Jeremy Huddleston SequoiaJan 30, 2019
  15. 01/13 .gitignore: Remove *.s as it matches *.S on case insensitive filesystemJeremy Huddleston Sequoia, Jan 29, 2019
  16. Eric SunshineJan 30, 2019
  17. Jeremy Huddleston SequoiaJan 30, 2019
  18. Eric SunshineJan 30, 2019
  19. Eric SunshineJan 30, 2019
  20. Johannes SchindelinJan 30, 2019
  21. Jeremy Huddleston SequoiaJan 30, 2019
  22. Junio C HamanoJan 31, 2019
  23. Jeremy SequoiaJan 31, 2019
  24. Eric SunshineJan 31, 2019
  25. Junio C HamanoJan 30, 2019
  26. 04/13 t4014: git --version can have SP in itJeremy Huddleston Sequoia, Jan 29, 2019
  27. Junio C HamanoJan 29, 2019
  28. Johannes SchindelinJan 30, 2019
  29. 10/13 Support for Xcode.app co-exestince and relocationJeremy Huddleston Sequoia, Jan 29, 2019
  30. Johannes SchindelinJan 30, 2019
  31. Jeremy Huddleston SequoiaJan 30, 2019
  32. 07/13 HTML documentation is not provided with Apple's git. Make the error message more on point.Jeremy Huddleston Sequoia, Jan 29, 2019
  33. Junio C HamanoJan 29, 2019
  34. Johannes SchindelinJan 30, 2019
  35. Junio C HamanoJan 30, 2019
  36. Johannes SchindelinJan 30, 2019
  37. 03/13 t0500: New regression test for git add of a path that contains a .git directoryJeremy Huddleston Sequoia, Jan 29, 2019
  38. Eric SunshineJan 30, 2019
  39. Johannes SchindelinJan 30, 2019
  40. Jeremy Huddleston SequoiaJan 30, 2019
  41. 12/13 Enable support for Xcode.app-bundled gitconfigJeremy Huddleston Sequoia, Jan 29, 2019
  42. Junio C HamanoJan 29, 2019
  43. Jeremy Huddleston SequoiaJan 29, 2019
  44. Johannes SchindelinJan 30, 2019
  45. Jeremy Huddleston SequoiaJan 30, 2019
  46. Jeremy Huddleston SequoiaJan 30, 2019
  47. Jonathan NiederJan 31, 2019
  48. Jeremy Huddleston SequoiaJan 31, 2019
  49. Junio C HamanoJan 31, 2019
  50. brian m. carlsonJan 30, 2019
  51. 13/13 Enable support for Xcode.app-bundled gitattributesJeremy Huddleston Sequoia, Jan 29, 2019
  52. 02/13 test-lib: Export PERL5LIB for testing git-svnJeremy Huddleston Sequoia, Jan 29, 2019
  53. Junio C HamanoJan 29, 2019
  54. Jeremy Huddleston SequoiaJan 29, 2019
  55. SZEDER GáborJan 29, 2019
  56. Jeremy SequoiaJan 30, 2019
  57. Junio C HamanoJan 30, 2019
  58. Carlo ArenasJan 30, 2019
  59. Johannes SchindelinJan 30, 2019
  60. Jeremy SequoiaJan 30, 2019
  61. 11/13 Fix problem found from running the test suite.Jeremy Huddleston Sequoia, Jan 29, 2019
  62. Junio C HamanoJan 29, 2019
  63. Eric WongJan 29, 2019

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.