librelist archives

« back to archive

Getting a repository's config

Getting a repository's config

From:
Carlos Martín Nieto
Date:
2011-04-05 @ 12:17
Hi all,

 I'm trying to integrate configuration parsing with the repository
structure. On git_repository_open{,2,3}, the .git/config file is read
in, and you can get this configuration with git_repository_config.

 The final configuration options for a repository are the 'merge' of
${prefix}/etc/gitconfig $HOME/.gitconfig and $REPODIR/config. Merging
the global and repo configs is not a problem, as long as getenv exists
(which I'm not sure it does under Windows, but that's a different
discussion).

 The information in the git-config man page refers specifically to how
it looks for files, but it should be valid for all git
commands. git.git doesn't have a problem, as its library is configured
at the same time as its binaries, but what should libgit2 use as
system file? Having to tell the user to merge manually is not very
elegant. How do people feel about a LIBGIT2_SYSTEM_CONFIG environment
variable which the user should set (user here being a user of the
library).

   cmn