]> git.ipfire.org Git - thirdparty/git.git/commit - http.c
http_init(): Fix config file parsing
authorJunio C Hamano <gitster@pobox.com>
Tue, 10 Mar 2009 02:00:30 +0000 (19:00 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Mar 2009 05:31:29 +0000 (22:31 -0700)
commit7059cd99fc671f9594b61cee7d10d69704f3ebe2
tree1e9126e7c2d11afe582029265475483b44ff5e5c
parent4251ccbd80eff92270503a48d35385516c3d106d
http_init(): Fix config file parsing

We honor the command line options, environment variables, variables in
repository configuration file, variables in user's global configuration
file, variables in the system configuration file, and then finally use
built-in default.  To implement this semantics, the code should:

 - start from built-in default values;

 - call git_config() with the configuration parser callback, which
   implements "later definition overrides earlier ones" logic
   (git_config() reads the system's, user's and then repository's
   configuration file in this order);

 - override the result from the above with environment variables if set;

 - override the result from the above with command line options.

The initialization code http_init() for http transfer got this wrong, and
implemented a "first one wins, ignoring the later ones" in http_options(),
to compensate this mistake, read environment variables before calling
git_config().  This is all wrong.

As a second class citizen, the http codepath hasn't been audited as
closely as other parts of the system, but we should try to bring sanity to
it, before inviting contributors to improve on it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
http.c