{"thread":{"id":"3233","subject":"[PATCH] config: Rummage through ~/.gitrc as well as the repository's config.","startedAt":"2006-02-03T20:33:32Z","lastAt":"2006-02-04T12:17:48Z","messageCount":4,"participants":["Mark Wooding","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"15532","messageId":"20060203203332.2718.13451.stgit@metalzone.distorted.org.uk","threadId":"3233","inReplyTo":null,"subject":"[PATCH] config: Rummage through ~/.gitrc as well as the repository's config.","fromName":"Mark Wooding","fromEmail":"mdw@distorted.org.uk","sentAt":"2006-02-03T20:33:32Z","receivedAt":"2006-02-03T20:33:32Z","isPatch":true,"sender":{"key":"mdw@distorted.org.uk","avatar":null},"body":"From: Mark Wooding <mdw@distorted.org.uk>\n\nI'm fed up of setting user.email in every repository I own.  I want to\nput this somewhere central, and I shouldn't have to log in again to make\nit take effect.\n\nSigned-off-by: Mark Wooding <mdw@distorted.org.uk>\n---\n\n Documentation/git.txt |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex e8ef3ef..eab3d46 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -468,6 +468,10 @@ people.  Here is an example:\n Various commands read from the configuration file and adjust\n their operation accordingly.\n \n+You can also have a global configuration file, in exactly the same\n+format, in the file `.gitrc` in your home directory.  This is a handy\n+place to put your name and email address.\n+\n \n Identifier Terminology\n ----------------------\n"},{"id":"15544","messageId":"7vacd7c4bm.fsf@assigned-by-dhcp.cox.net","threadId":"3233","inReplyTo":"20060203203332.2718.13451.stgit@metalzone.distorted.org.uk","subject":"Re: [PATCH] config: Rummage through ~/.gitrc as well as the repository's config.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-04T01:15:09Z","receivedAt":"2006-02-04T01:15:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mark Wooding <mdw@distorted.org.uk> writes:\n\n> I'm fed up of setting user.email in every repository I own.\n\nThat is what --template-dir to init-db is for (it works in an\nalready initialized git repository, but it does not overwrite\nfiles).\n\n> I want to put this somewhere central, and I shouldn't have to\n> log in again to make it take effect.\n\nI do not understand about logging in again.  If you are talking\nabout environment variables, \". ~/.env\" would work nicely.\n"},{"id":"15566","messageId":"slrndu9042.2i8.mdw@metalzone.distorted.org.uk","threadId":"3233","inReplyTo":"7vacd7c4bm.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] config: Rummage through ~/.gitrc as well as the repository's config.","fromName":"Mark Wooding","fromEmail":"mdw@distorted.org.uk","sentAt":"2006-02-04T10:22:58Z","receivedAt":"2006-02-04T10:22:58Z","isPatch":true,"sender":{"key":"mdw@distorted.org.uk","avatar":null},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> Mark Wooding <mdw@distorted.org.uk> writes:\n>\n>> I'm fed up of setting user.email in every repository I own.\n>\n> That is what --template-dir to init-db is for (it works in an\n> already initialized git repository, but it does not overwrite\n> files).\n\nExcept that git-clone has already made a .git/config file, so it won't\nbe overwritten by git-init-db --template-dir.  git-init-db doesn't do\nmerging of config file lines, and rightly so -- it'd just get too\nconfusing.\n\n>> I want to put this somewhere central, and I shouldn't have to\n>> log in again to make it take effect.\n>\n> I do not understand about logging in again.  If you are talking\n> about environment variables, \". ~/.env\" would work nicely.\n\nArgh.  In every terminal and screen window, restart Emacs, ...  Logging\nout looks like the better plan.\n\nWhat's the objection to a ~/.gitrc?  (If it's just new-feature\nresistance, I can live with that; I'm just interested.)\n\n-- [mdw]\n"},{"id":"15572","messageId":"7vhd7f1fo3.fsf@assigned-by-dhcp.cox.net","threadId":"3233","inReplyTo":"slrndu9042.2i8.mdw@metalzone.distorted.org.uk","subject":"Re: [PATCH] config: Rummage through ~/.gitrc as well as the repository's config.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-04T12:17:48Z","receivedAt":"2006-02-04T12:17:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mark Wooding <mdw@distorted.org.uk> writes:\n\n> Argh.  In every terminal and screen window, restart Emacs, ...  Logging\n> out looks like the better plan.\n\nSo you do mean environment variables?  Then what's the aversion\nagainst using GIT_AUTHOR_EMAIL instead of using user.email in\nevery repository?  If you use the same value everywhere, you\ncan do the environment thing _today_ and re-logging in needs to\nbe done only once, so I do not find it such a big deal.  If you\ndo _not_ use the same value everywhere, then user.email per\nrepository is a good thing to have, but ~/.gitrc would not help.\n\nHaving said that, there are good uses for per-user configuration\nthat is used across different repositories.  Especially when we\nstart adding new features, we would not want to invent new\nenvironment variable every time.  Under ~/ would be a logical\nplace to put that information.\n\nIf you want to propose a search order of multiple configuration\nfiles and how they interact with each other (what happens if\n~/.gitrc and $GIT_DIR/config say different things, especially\nfor multi-valued configuration items), go wild.  I think the\nsimplest single-value cases should be resolved by taking what\n$GIT_DIR/config says and if the configuration is not found there\nthen look at ~/.gitrc (IOW, $GIT_DIR/config takes precedence),\nbut I am not sure even if that is true in general.  I suspect\nthat some configuration items are more of personal nature and\nsome configuration items are more of per-project attribute.  For\nexample, merge resolve strategy would be affected more by the\nnature of changes that happen to the project's files than which\nstrategy the user feels easier to work with; $GIT_DIR/config may\nhave core.gitproxy and user.email, maybe by historical reasons,\nwhich you may rather want to override with ~/.gitrc (e.g. git\nproxy may require proxy authentication which would need to be\nsupplied per user).\n\nEspecially problematic would be user.email.  Some people might\nwant to use different identity depending on what project they\nwork on, in which case they would want $GIT_DIR/config to take\nprecedence.  But sometimes you may need to go to your colleagues\nrepository and help him with his work, and when you make a\ncommit there you would want your name, not user.email in\n$GIT_DIR/config that records his identity, to be used for that\ncommit.\n"}]}