int git_config(config_fn_t fn)
{
- return git_config_from_file(fn, git_path("config"));
+ int ret = 0;
+ const char *home = getenv("HOME");
+
+ if (home) {
+ ret = git_config_from_file(fn, mkpath("%s/.gitconfig", home));
+ /* ignore if global config does not exist */
+ if (ret < 0)
+ ret = 0;
+ }
+
+ ret += git_config_from_file(fn, git_path("config"));
+ return ret;
}
/*
* contents of .git/config will be written into it.
*/
fd = open(lock_file, O_WRONLY | O_CREAT | O_EXCL, 0666);
- if (fd < 0) {
+ if (fd < 0 || adjust_shared_perm(lock_file)) {
fprintf(stderr, "could not lock config file\n");
free(store.key);
ret = -1;