{"thread":{"id":"4299","subject":"~/.git/config ?","startedAt":"2006-05-26T15:28:37Z","lastAt":"2006-05-29T14:00:36Z","messageCount":19,"participants":["Anand Kumria","Timo Hirvonen","Jakub Narebski","Petr Baudis","Junio C Hamano","Pavel Roskin","Linus Torvalds","Nikolai Weibull","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"20757","messageId":"20060526152837.GQ23852@progsoc.uts.edu.au","threadId":"4299","inReplyTo":null,"subject":"~/.git/config ?","fromName":"Anand Kumria","fromEmail":"wildfire@progsoc.uts.edu.au","sentAt":"2006-05-26T15:28:37Z","receivedAt":"2006-05-26T15:28:37Z","isPatch":false,"sender":{"key":"wildfire@progsoc.uts.edu.au","avatar":null},"body":"Hi,\n\ngit is unable to construct a reasonable default email address in my\ncurrent environment.  So, I use GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL\nto override things.\n\nThis has worked well but, now, I need to vary the email address for some\nrepositories.  Unfortunately the environment variables override\n.git/config.\n\nIt would be good if things were like:\n\t- try to construct one automagically\n\t- use ~/.git/config (if available)\n\t- use .git/config\n\t- use environment variables\n\nThat way I could set my default email address in ~/.git/config and\noverride it as required for those repositories that need it.\n\nThanks,\nAnand\n\n-- \n `When any government, or any church for that matter, undertakes to say to\n  its subjects, \"This you may not read, this you must not see, this you are\n  forbidden to know,\" the end result is tyranny and oppression no matter how\n  holy the motives' -- Robert A Heinlein, \"If this goes on --\"\n"},{"id":"20760","messageId":"20060526193325.d2a530a4.tihirvon@gmail.com","threadId":"4299","inReplyTo":"20060526152837.GQ23852@progsoc.uts.edu.au","subject":"Re: ~/.git/config ?","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2006-05-26T16:33:25Z","receivedAt":"2006-05-26T16:33:25Z","isPatch":false,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"Anand Kumria <wildfire@progsoc.uts.edu.au> wrote:\n\n> Hi,\n> \n> git is unable to construct a reasonable default email address in my\n> current environment.  So, I use GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL\n> to override things.\n> \n> This has worked well but, now, I need to vary the email address for some\n> repositories.  Unfortunately the environment variables override\n> .git/config.\n> \n> It would be good if things were like:\n> \t- try to construct one automagically\n> \t- use ~/.git/config (if available)\n> \t- use .git/config\n> \t- use environment variables\n> \n> That way I could set my default email address in ~/.git/config and\n> override it as required for those repositories that need it.\n\nI backup my $HOME using git, so there's a .git directory in ~.  I don't\nthink a global config file is really needed but it would be nice if\n.git/config would override the environment variables, not the other way\naround.\n\n-- \nhttp://onion.dynserv.net/~timo/\n"},{"id":"20761","messageId":"e57aso$krk$1@sea.gmane.org","threadId":"4299","inReplyTo":"20060526193325.d2a530a4.tihirvon@gmail.com","subject":"Re: ~/.git/config ?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-05-26T16:37:51Z","receivedAt":"2006-05-26T16:37:51Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Timo Hirvonen wrote:\n\n> Anand Kumria <wildfire@progsoc.uts.edu.au> wrote:\n> \n>> Hi,\n>> \n>> git is unable to construct a reasonable default email address in my\n>> current environment.  So, I use GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL\n>> to override things.\n>> \n>> This has worked well but, now, I need to vary the email address for some\n>> repositories.  Unfortunately the environment variables override\n>> .git/config.\n>> \n>> It would be good if things were like:\n>>      - try to construct one automagically\n>>      - use ~/.git/config (if available)\n>>      - use .git/config\n>>      - use environment variables\n>> \n>> That way I could set my default email address in ~/.git/config and\n>> override it as required for those repositories that need it.\n> \n> I backup my $HOME using git, so there's a .git directory in ~.  I don't\n> think a global config file is really needed but it would be nice if\n> .git/config would override the environment variables, not the other way\n> around.\n\nWell, I'm not sure if environmental variables overriding wouldn't make\ninvocations like 'GIT_DIR=something git command' possible.\n\nThere are templates, also for config. Currently git lacks user (not\nrepository) config file, e.g. ~/.gitconfig (common for all repositories).\n\n-- \nJakub Narebski\nWarsaw, Poland\n"},{"id":"20762","messageId":"20060526163829.GB10488@pasky.or.cz","threadId":"4299","inReplyTo":"20060526193325.d2a530a4.tihirvon@gmail.com","subject":"Re: ~/.git/config ?","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-05-26T16:38:29Z","receivedAt":"2006-05-26T16:38:29Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, May 26, 2006 at 06:33:25PM CEST, I got a letter\nwhere Timo Hirvonen <tihirvon@gmail.com> said that...\n> I backup my $HOME using git, so there's a .git directory in ~.\n\nThen it should be called ~/.gitconfig. :-)\n\n> I don't think a global config file is really needed but it would be\n> nice if .git/config would override the environment variables, not the\n> other way around.\n\nThen you have no other way to override .git/config e.g. when committing\npatches submitted by other people.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nA person is just about as big as the things that make them angry.\n"},{"id":"20764","messageId":"20060526200526.d8a2f776.tihirvon@gmail.com","threadId":"4299","inReplyTo":"20060526163829.GB10488@pasky.or.cz","subject":"Re: ~/.git/config ?","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2006-05-26T17:05:26Z","receivedAt":"2006-05-26T17:05:26Z","isPatch":false,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"Petr Baudis <pasky@suse.cz> wrote:\n\n> Dear diary, on Fri, May 26, 2006 at 06:33:25PM CEST, I got a letter\n> where Timo Hirvonen <tihirvon@gmail.com> said that...\n> > I backup my $HOME using git, so there's a .git directory in ~.\n> \n> Then it should be called ~/.gitconfig. :-)\n\nI just wanted to point the fact that ~/.git/ could not be used :)\n\n> > I don't think a global config file is really needed but it would be\n> > nice if .git/config would override the environment variables, not the\n> > other way around.\n> \n> Then you have no other way to override .git/config e.g. when committing\n> patches submitted by other people.\n\ngit commit --author \"name <email>\"\n\n-- \nhttp://onion.dynserv.net/~timo/\n"},{"id":"20765","messageId":"20060526171102.GH11941@pasky.or.cz","threadId":"4299","inReplyTo":"20060526200526.d8a2f776.tihirvon@gmail.com","subject":"Re: ~/.git/config ?","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2006-05-26T17:11:02Z","receivedAt":"2006-05-26T17:11:02Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, May 26, 2006 at 07:05:26PM CEST, I got a letter\nwhere Timo Hirvonen <tihirvon@gmail.com> said that...\n> > > I don't think a global config file is really needed but it would be\n> > > nice if .git/config would override the environment variables, not the\n> > > other way around.\n> > \n> > Then you have no other way to override .git/config e.g. when committing\n> > patches submitted by other people.\n> \n> git commit --author \"name <email>\"\n\nExcept that this just sets the environment variables for you. :-)\n\nNow, you could do some really funny stuff with overriding the\nenvironment variables at git commit's entry point with .git/config\nstuff, then possibly setting them again in case --author was passed, but\nI seriously think such a confusion is not worth it.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nA person is just about as big as the things that make them angry.\n"},{"id":"20767","messageId":"7vversk7o4.fsf@assigned-by-dhcp.cox.net","threadId":"4299","inReplyTo":"20060526152837.GQ23852@progsoc.uts.edu.au","subject":"Re: ~/.git/config ?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-26T17:38:51Z","receivedAt":"2006-05-26T17:38:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Anand Kumria <wildfire@progsoc.uts.edu.au> writes:\n\n> It would be good if things were like:\n> \t- try to construct one automagically\n> \t- use ~/.git/config (if available)\n> \t- use .git/config\n> \t- use environment variables\n>\n> That way I could set my default email address in ~/.git/config and\n> override it as required for those repositories that need it.\n\nIf you mean by the above \"do all of these and take the last\nvalue that was available\", that sounds sane.  Except perhaps I\nwould suggest to use ~/.git-config instead.  Some people seem to\nwant to track their home directory with git, and that way, your\npersonal fallback default file can be version controlled.\n"},{"id":"20773","messageId":"1148697382.5599.1.camel@dv","threadId":"4299","inReplyTo":"20060526163829.GB10488@pasky.or.cz","subject":"Re: ~/.git/config ?","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2006-05-27T02:36:22Z","receivedAt":"2006-05-27T02:36:22Z","isPatch":false,"sender":{"key":"proski@gnu.org","avatar":null},"body":"On Fri, 2006-05-26 at 18:38 +0200, Petr Baudis wrote:\n> Dear diary, on Fri, May 26, 2006 at 06:33:25PM CEST, I got a letter\n> where Timo Hirvonen <tihirvon@gmail.com> said that...\n> > I backup my $HOME using git, so there's a .git directory in ~.\n> \n> Then it should be called ~/.gitconfig. :-)\n\nNo, make it .gitrc for compatibility with .cvsrc, .lynxrc and others.\n\nI know, it's becoming a bikeshed issue :-)\n\n-- \nRegards,\nPavel Roskin\n"},{"id":"20774","messageId":"20060527025750.GM11941@pasky.or.cz","threadId":"4299","inReplyTo":"1148697382.5599.1.camel@dv","subject":"Re: ~/.git/config ?","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2006-05-27T02:57:50Z","receivedAt":"2006-05-27T02:57:50Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sat, May 27, 2006 at 04:36:22AM CEST, I got a letter\nwhere Pavel Roskin <proski@gnu.org> said that...\n> On Fri, 2006-05-26 at 18:38 +0200, Petr Baudis wrote:\n> > Dear diary, on Fri, May 26, 2006 at 06:33:25PM CEST, I got a letter\n> > where Timo Hirvonen <tihirvon@gmail.com> said that...\n> > > I backup my $HOME using git, so there's a .git directory in ~.\n> > \n> > Then it should be called ~/.gitconfig. :-)\n> \n> No, make it .gitrc for compatibility with .cvsrc, .lynxrc and others.\n\n~/.gitrc might get useful for actually doing what ~/.cvsrc or ~/.cgrc\ndoes, that is providing default options for git commands. ~/.gitconfig\nwould just give you per-user defaults for the repository config file.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nA person is just about as big as the things that make them angry.\n"},{"id":"20775","messageId":"Pine.LNX.4.64.0605262007230.5623@g5.osdl.org","threadId":"4299","inReplyTo":"20060527025750.GM11941@pasky.or.cz","subject":"Re: ~/.git/config ?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-05-27T03:20:14Z","receivedAt":"2006-05-27T03:20:14Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sat, 27 May 2006, Petr Baudis wrote:\n> \n> ~/.gitrc might get useful for actually doing what ~/.cvsrc or ~/.cgrc\n> does, that is providing default options for git commands. ~/.gitconfig\n> would just give you per-user defaults for the repository config file.\n\nI don't think the two are necessarily any different.\n\nI do think that\n (a) we might as well use the same syntax. There's no point in having \n     different syntax for the files, even if they end up having slightly \n     different usage.\n (b) a \"user-wide\" config file would tend to have different things in it \n     than a per-repository one, but some of the things it would have in it \n     are the things that we currently put in the per-repository one. \n     Notably exactly the \"user.name\" and \"user.email\" values.\n (c) having a user- (and perhaps a system-) wide config file would make \n     some things that we do not _yet_ support in the .git/config file \n     format more natural, but that doesn't necessarily mean that having \n     them on a per-repo basis would be wrong either.\n\nAs an example of (c), let's say that somebody wants to use the CVS aliases \nwith git. They've used cvs for years, and as a result their brain has \natrophied, and they have a really hard time teaching their fingers to \nwrite \"git commit\" when they want to write \"cvs ci\".\n\nSo they would do \"alias cvs git\" in a desperate attempt to save themselves \nfrom CVS, and then add\n\n\t[alias \"co\"]\n\t\tcmd = commit -a\n\nto their .gitrc file. Now, the only thing we'd need to do is to teach \n\"git.c\" to parse that simple \"alias.$1.command\" variable, and that really \nsounds pretty damn easy, no?\n\nAnd that really does make more sense in a user-wide \".gitrc\" file. But at \nthe same time, there's really no reason to _disallow_ it from the \nrepo-private .git/config file either. For example, you could do\n\n\t[alias \"publish\"]\n\t\tcmd = push public.site.com:/pub/scm/my-public-repo\n\nand that is somethign that actually makes sense as a per-repository \ncommand alias, so that \"git publish\" does the right thing for just _that_ \nrepository.\n\nSo I would argue that yes, \".gitrc\" makes sense, and no, we shouldn't have \na separate \".gitrc\" and \".gitconfig\", because I think what we really would \nwant is a way to do default .git/config entries, and that it is _also_ a \nvery natural way to add some things that we don't do yet.\n\n\t\t\tLinus\n\nPS. I really like my [alias \"cmd\"] idea. _All_ my ideas are great, of \ncourse, but this one seems even better than some others. No?\n"},{"id":"20776","messageId":"Pine.LNX.4.64.0605262033560.5623@g5.osdl.org","threadId":"4299","inReplyTo":"Pine.LNX.4.64.0605262007230.5623@g5.osdl.org","subject":"Re: ~/.git/config ?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-05-27T03:36:08Z","receivedAt":"2006-05-27T03:36:08Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 26 May 2006, Linus Torvalds wrote:\n> \n> So they would do \"alias cvs git\" in a desperate attempt to save themselves \n> from CVS, and then add\n> \n> \t[alias \"co\"]\n> \t\tcmd = commit -a\n\nThat, of course, would be confusing.\n\nIt should be \"ci\" for commit, and \"co\" for \"checkout\".\n\nDuh. Chalk it up to me not having used cvs in the last three or four years \nor so (we used it at transmeta, although I can hope that they've since \nseen the light ;).\n\n\t\t\tLinus\n"},{"id":"20777","messageId":"e58hnm$fss$1@sea.gmane.org","threadId":"4299","inReplyTo":"Pine.LNX.4.64.0605262007230.5623@g5.osdl.org","subject":"Re: ~/.git/config ?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-05-27T03:40:48Z","receivedAt":"2006-05-27T03:40:48Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Linus Torvalds wrote:\n\n> PS. I really like my [alias \"cmd\"] idea. _All_ my ideas are great, of \n> course, but this one seems even better than some others. No?\n\nSo, would we use it also for default options of commands, like\n\n        [alias \"log\"]\n                cmd = log -p -M -C\n\n(we could implement \"git whatchanges\" as an alias, keeping it's man page, or\nsharing it with \"git log\").\n\n-- \nJakub Narebski\nWarsaw, Poland\n"},{"id":"20778","messageId":"7v4pzchych.fsf@assigned-by-dhcp.cox.net","threadId":"4299","inReplyTo":"Pine.LNX.4.64.0605262033560.5623@g5.osdl.org","subject":"Re: ~/.git/config ?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-27T04:43:10Z","receivedAt":"2006-05-27T04:43:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n>> \t[alias \"co\"]\n>> \t\tcmd = commit -a\n>\n> That, of course, would be confusing.\n>\n> It should be \"ci\" for commit, and \"co\" for \"checkout\".\n>\n> Duh. Chalk it up to me not having used cvs in the last three or four years \n> or so (we used it at transmeta, although I can hope that they've since \n> seen the light ;).\n>\n> \t\t\tLinus\n\nYou are lucky ;-).\n\nThe alias would be a nice addition -- I can get rid of the hack\nI have for show-branch.  We would need an argument splitter, but\nthat should be trivial.\n"},{"id":"20780","messageId":"dbfc82860605270150s5c43e32fja2e7ef934bc1ef0@mail.gmail.com","threadId":"4299","inReplyTo":"1148697382.5599.1.camel@dv","subject":"Re: ~/.git/config ?","fromName":"Nikolai Weibull","fromEmail":"now@bitwi.se","sentAt":"2006-05-27T08:50:13Z","receivedAt":"2006-05-27T08:50:13Z","isPatch":false,"sender":{"key":"now@bitwi.se","avatar":"https://gravatar.com/avatar/d9242f067845cf9a72be23e4213c3b6e53492178e5df97372088a441af846133?d=mp&s=160"},"body":"On 5/27/06, Pavel Roskin <proski@gnu.org> wrote:\n> On Fri, 2006-05-26 at 18:38 +0200, Petr Baudis wrote:\n> > Dear diary, on Fri, May 26, 2006 at 06:33:25PM CEST, I got a letter\n> > where Timo Hirvonen <tihirvon@gmail.com> said that...\n> > > I backup my $HOME using git, so there's a .git directory in ~.\n> >\n> > Then it should be called ~/.gitconfig. :-)\n>\n> No, make it .gitrc for compatibility with .cvsrc, .lynxrc and others.\n>\n> I know, it's becoming a bikeshed issue :-)\n\nI want to paint part of it as well!\n\nWouldn't we be futureproofing ourselves by stuffing it in a\nsubdirectory instead?  What if we want to add more files later?\n\nAlso, can we please make sure to make the location of the file (or\ndirectory) configurable through an environment variable, e.g.,\nGIT_CONFIG, GIT_USER_CONFIG, GIT_HOME, or GIT_USER_HOME?\n\nPeace.\n\n  nikolai\n"},{"id":"20781","messageId":"20060527120934.e6306067.tihirvon@gmail.com","threadId":"4299","inReplyTo":"dbfc82860605270150s5c43e32fja2e7ef934bc1ef0@mail.gmail.com","subject":"Re: ~/.git/config ?","fromName":"Timo Hirvonen","fromEmail":"tihirvon@gmail.com","sentAt":"2006-05-27T09:09:34Z","receivedAt":"2006-05-27T09:09:34Z","isPatch":false,"sender":{"key":"tihirvon@gmail.com","avatar":null},"body":"\"Nikolai Weibull\" <now@bitwi.se> wrote:\n\n> On 5/27/06, Pavel Roskin <proski@gnu.org> wrote:\n> > On Fri, 2006-05-26 at 18:38 +0200, Petr Baudis wrote:\n> > >\n> > > Then it should be called ~/.gitconfig. :-)\n> >\n> > No, make it .gitrc for compatibility with .cvsrc, .lynxrc and others.\n> >\n> > I know, it's becoming a bikeshed issue :-)\n> \n> I want to paint part of it as well!\n> \n> Wouldn't we be futureproofing ourselves by stuffing it in a\n> subdirectory instead?  What if we want to add more files later?\n\nMakes sense, we may want to put templates to ~/.gitsomething/templates/.\n\n-- \nhttp://onion.dynserv.net/~timo/\n"},{"id":"20782","messageId":"7vejyfhlxg.fsf@assigned-by-dhcp.cox.net","threadId":"4299","inReplyTo":"Pine.LNX.4.64.0605262007230.5623@g5.osdl.org","subject":"Re: ~/.git/config ?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-27T09:11:23Z","receivedAt":"2006-05-27T09:11:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> On Sat, 27 May 2006, Petr Baudis wrote:\n>> \n>> ~/.gitrc might get useful for actually doing what ~/.cvsrc or ~/.cgrc\n>> does, that is providing default options for git commands. ~/.gitconfig\n>> would just give you per-user defaults for the repository config file.\n>\n> I don't think the two are necessarily any different.\n\nMe neither.  Default options to fall back on if repository\nconfiguration does not specify them and when environments do not\noverride them -- that's exactly \"per-user defaults\", nothing else.\n\nEarlier I suggested ~/.git-config, but anything other than\n~/.git/config is OK.  ~/.gitrc is fine.  And the order suggested\nby Anand sounded fine.\n\n - use environment (if the value is obtained, stop here)\n - use .git/config (if the value is obtained, stop here)\n - use ~/.git-config (if the value is obtained, stop here)\n - do whatever the program does by default.\n\n>  (a) we might as well use the same syntax. There's no point in having \n>      different syntax for the files, even if they end up having slightly \n>      different usage.\n\nAbsolutely.\n\n>  (b) a \"user-wide\" config file would tend to have different things in it \n>      than a per-repository one, but some of the things it would have in it \n>      are the things that we currently put in the per-repository one. \n>      Notably exactly the \"user.name\" and \"user.email\" values.\n\nYes.  Also \"preference\" kind of things as opposed to \"per\nproject policy\" such as apply.whitespace.\n"},{"id":"20848","messageId":"20060528222641.GF10488@pasky.or.cz","threadId":"4299","inReplyTo":"20060526152837.GQ23852@progsoc.uts.edu.au","subject":"[PATCH] Read configuration also from ~/.gitrc","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-05-28T22:26:42Z","receivedAt":"2006-05-28T22:26:42Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"  Hi,\n\nDear diary, on Fri, May 26, 2006 at 05:28:37PM CEST, I got a letter\nwhere Anand Kumria <wildfire@progsoc.uts.edu.au> said that...\n> git is unable to construct a reasonable default email address in my\n> current environment.  So, I use GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL\n> to override things.\n> \n> This has worked well but, now, I need to vary the email address for some\n> repositories.  Unfortunately the environment variables override\n> .git/config.\n> \n> It would be good if things were like:\n> \t- try to construct one automagically\n> \t- use ~/.git/config (if available)\n> \t- use .git/config\n> \t- use environment variables\n> \n> That way I could set my default email address in ~/.git/config and\n> override it as required for those repositories that need it.\n\n  hmm, might it be as simple as this?\n\n---\n\nThis command makes Git read configuration from ~/.gitrc in addition\nto the per-repository .git/config configuration file, and updates\nthe documentation accordingly (and also expands it a little).\n\nIdea by Anand Kumria.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n Documentation/git-commit-tree.txt |    9 +++++----\n Documentation/git-repo-config.txt |    6 +++---\n Documentation/git-var.txt         |    5 +++--\n Documentation/git.txt             |   15 +++++++++++----\n config.c                          |    6 +++++-\n 5 files changed, 27 insertions(+), 14 deletions(-)\n\ndiff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt\nindex 41d1a1c..1b0d102 100644\n--- a/Documentation/git-commit-tree.txt\n+++ b/Documentation/git-commit-tree.txt\n@@ -49,8 +49,9 @@ A commit encapsulates:\n - committer name and email and the commit time.\n \n If not provided, \"git-commit-tree\" uses your name, hostname and domain to\n-provide author and committer info. This can be overridden by\n-either `.git/config` file, or using the following environment variables.\n+provide author and committer info. This can be overridden by either the\n+`~/.gitrc` file, the `.git/config` file, or using the following\n+environment variables.\n \n \tGIT_AUTHOR_NAME\n \tGIT_AUTHOR_EMAIL\n@@ -60,8 +61,8 @@ either `.git/config` file, or using the \n \n (nb \"<\", \">\" and \"\\n\"s are stripped)\n \n-In `.git/config` file, the following items are used for GIT_AUTHOR_NAME and\n-GIT_AUTHOR_EMAIL:\n+In the configuration file, the following items are used for GIT_AUTHOR_NAME\n+and GIT_AUTHOR_EMAIL:\n \n \t[user]\n \t\tname = \"Your Name\"\ndiff --git a/Documentation/git-repo-config.txt b/Documentation/git-repo-config.txt\nindex 660c18f..bb7f81f 100644\n--- a/Documentation/git-repo-config.txt\n+++ b/Documentation/git-repo-config.txt\n@@ -3,7 +3,7 @@ git-repo-config(1)\n \n NAME\n ----\n-git-repo-config - Get and set options in .git/config\n+git-repo-config - Get and set git runtime configuration options\n \n \n SYNOPSIS\n@@ -37,7 +37,7 @@ no checks or transformations are perform\n \n This command will fail if:\n \n-. The .git/config file is invalid,\n+. The configuration file is invalid,\n . Can not write to .git/config,\n . no section was provided,\n . the section or key is invalid,\n@@ -70,7 +70,7 @@ OPTIONS\n \tRemove all matching lines from .git/config.\n \n -l, --list::\n-\tList all variables set in .git/config.\n+\tList all variables set in ~/.gitrc or .git/config.\n \n \n EXAMPLE\ndiff --git a/Documentation/git-var.txt b/Documentation/git-var.txt\nindex a5b1a0d..4679aef 100644\n--- a/Documentation/git-var.txt\n+++ b/Documentation/git-var.txt\n@@ -18,8 +18,9 @@ OPTIONS\n -------\n -l::\n \tCause the logical variables to be listed. In addition, all the\n-\tvariables of the git configuration file .git/config are listed\n-\tas well. (However, the configuration variables listing functionality\n+\tvariables of the git configuration files `~/.gitrc` and `.git/config`\n+\tare listed as well.\n+\t(However, the configuration variables listing functionality\n \tis deprecated in favor of `git-repo-config -l`.)\n \n EXAMPLE\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex e474bdf..f4e5df5 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -116,7 +116,7 @@ gitlink:git-read-tree[1]::\n \tReads tree information into the index.\n \n gitlink:git-repo-config[1]::\n-\tGet and set options in .git/config.\n+\tGet and set git runtime configuration options.\n \n gitlink:git-unpack-objects[1]::\n \tUnpacks objects out of a packed archive.\n@@ -473,8 +473,7 @@ gitlink:gitk[1]::\n Configuration Mechanism\n -----------------------\n \n-Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file\n-is used to hold per-repository configuration options.  It is a\n+You can adjust the Git behaviour by a configuration file.  It is a\n simple text file modelled after `.ini` format familiar to some\n people.  Here is an example:\n \n@@ -496,7 +495,15 @@ #\n ------------\n \n Various commands read from the configuration file and adjust\n-their operation accordingly.\n+their operation accordingly. See gitlink:git-repo-config[1]\n+for details and list of options.\n+\n+Git first reads the per-user global configuration from `~/.gitrc`\n+and then per-repository configuration from the `.git/config` file.\n+Either of these files may be missing; the per-repository configuration\n+wins in case of a conflict. Some behaviour can be also tweaked using\n+environment variables; in general, they take precedence over configuration\n+options.\n \n \n Identifier Terminology\ndiff --git a/config.c b/config.c\nindex 0248c6d..8a98865 100644\n--- a/config.c\n+++ b/config.c\n@@ -312,7 +312,11 @@ int git_config_from_file(config_fn_t fn,\n \n int git_config(config_fn_t fn)\n {\n-\treturn git_config_from_file(fn, git_path(\"config\"));\n+\tint ret = 0;\n+\tif (getenv(\"HOME\"))\n+\t\tret += git_config_from_file(fn, mkpath(\"%s/.gitrc\", getenv(\"HOME\")));\n+\tret += git_config_from_file(fn, git_path(\"config\"));\n+\treturn ret;\n }\n \n /*\n\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nA person is just about as big as the things that make them angry.\n"},{"id":"20872","messageId":"Pine.LNX.4.63.0605290913330.8863@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4299","inReplyTo":"20060528222641.GF10488@pasky.or.cz","subject":"Re: [PATCH] Read configuration also from ~/.gitrc","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-05-29T07:20:07Z","receivedAt":"2006-05-29T07:20:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 29 May 2006, Petr Baudis wrote:\n\n> diff --git a/config.c b/config.c\n> index 0248c6d..8a98865 100644\n> --- a/config.c\n> +++ b/config.c\n> @@ -312,7 +312,11 @@ int git_config_from_file(config_fn_t fn,\n>  \n>  int git_config(config_fn_t fn)\n>  {\n> -\treturn git_config_from_file(fn, git_path(\"config\"));\n> +\tint ret = 0;\n> +\tif (getenv(\"HOME\"))\n> +\t\tret += git_config_from_file(fn, mkpath(\"%s/.gitrc\", getenv(\"HOME\")));\n> +\tret += git_config_from_file(fn, git_path(\"config\"));\n> +\treturn ret;\n>  }\n>  \n>  /*\n\n\nBut would this not break for the normal case? If you override one key in \nthe repository's config, with this patch, repo-config will barf. The \nnormal case is that you do not expect multiple values for the same key. \nYour patch reads both ~/.gitrc and $GIT_DIR/config, and if a key has a \nvalue in both (even if they are identical), repo-config will error out.\n\nFurther, storing a key will no longer work. This is an obscure side \neffect of this patch not caring about storing anything in ~/.gitrc: If you \nfind the key section (or the key) in ~/.gitrc, the offset will be stored, \n_and used on $GIT_DIR/config_!\n\nI agree it is nice to have a global git configuration, but I have it: I \nuse templates.\n\nCiao,\nDscho\n"},{"id":"20890","messageId":"e5euq2$10t$1@sea.gmane.org","threadId":"4299","inReplyTo":"Pine.LNX.4.63.0605290913330.8863@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Read configuration also from ~/.gitrc","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-05-29T14:00:36Z","receivedAt":"2006-05-29T14:00:36Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Johannes Schindelin wrote:\n\n> But would this not break for the normal case? If you override one key in \n> the repository's config, with this patch, repo-config will barf. The \n> normal case is that you do not expect multiple values for the same key. \n> Your patch reads both ~/.gitrc and $GIT_DIR/config, and if a key has a \n> value in both (even if they are identical), repo-config will error out.\n\nSo the patch was to simplistic. Values from user's configuration file\n~/.gitrc should be marked, to be overridden by $GIT_DIR/config per\nrepository configuration file.\n \n> Further, storing a key will no longer work. This is an obscure side \n> effect of this patch not caring about storing anything in ~/.gitrc: If you \n> find the key section (or the key) in ~/.gitrc, the offset will be stored, \n> _and used on $GIT_DIR/config_!\n\nI think that storing a key should (unless new option --user-config or\n--global is used) should store it in $GIT_DIR/config file; of course index\nhas to be found there, and if not found it key should be created. Per\nconfiguration file offsets?\n\n> I agree it is nice to have a global git configuration, but I have it: I \n> use templates.\n\nThere are system-wide templates. git-init-db(1) doesn't show default\ndirectory for _user_ templates...\n\n\nAnd I guess that these are the issues why Junio C Hamano wrote:\n\n> * The 'pu' branch, in addition, has these.\n> \n>  - $HOME/.gitrc (Petr Baudis)\n>       Read configuration also from ~/.gitrc\n> \n>    * I like this but it breaks the tests big time.  Not \"next\"\n>      material yet, unfortunately.\n \n\n-- \nJakub Narebski\nWarsaw, Poland\n"}]}