All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Jeff King <peff@peff.net>
Cc: Andrew Ardill <andrew.ardill@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Thorsten Glaser <tg@mirbsd.de>,
	"git@vger.kernel.org" <git@vger.kernel.org>,
	Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: Re: git should not use a default user.email config value
Date: Wed, 14 Aug 2013 09:09:05 +0200	[thread overview]
Message-ID: <520B2D11.2080405@alum.mit.edu> (raw)
In-Reply-To: <20130813114635.GA16506@sigill.intra.peff.net>

On 08/13/2013 01:46 PM, Jeff King wrote:
> On Tue, Aug 13, 2013 at 09:05:40PM +1000, Andrew Ardill wrote:
> 
>> I applied this on top of latest next (1da3ebde8999d07), and it worked
>> perfectly for my use case.
>>
>> For what it's worth, it also passed the test suite!
>>
>> Would be great to see this, or something on the same theme, get into
>> master. I'd be happy to review patches/write tests/write documentation
>> if needed.
> 
> Like I said, I do not have a particular use for it, but I don't think it
> would hurt anybody who does not use it. If you want to polish it up into
> a real patch with docs and tests, I don't mind.
> 
> The only downside I can think of is that we might want to use the
> subsection in "include.SUBSECTION.*" for some other limiting conditions
> (e.g., "only include this config when running version >= X.Y", or even
> "include only when environment variable FOO is true").
> 
> I guess we could do something like:
> 
>   [include "repo:...your regex here..."]
>     path = .gitconfig-only-for-some-repos
>   [include "env:USE_MY_MAGIC_CONFIG"]
>     path = .gitconfig-only-when-magic-env-set
> 
> Adding the "repo:" prefix for this repo-dir matching is pretty trivial.
> Adding a similar env-matching is only slightly less trivial; but does
> anybody actually want it?

Gaaak!  Let me again plead for supporting a post-clone hook rather than
inventing some crazy config-file syntax that is becoming ever more
complicated.  A post-clone hook would make all of these things that have
been suggested pretty easy, and would also open lots of other
possibilities, all without further changes in git.core, like (I'm just
brainstorming here):

    #! /bin/sh

    remote="$1"

    ln -s $(HOME)/.githooks/* .git/hooks

    case "$(git --version)" in
    *.1.[78].*)
        git config include.path "$(HOME)/.gitinclude
        ;;
    esac

    echo "(cd $(pwd) && git gc)" >>"$(HOME)/cron.weekly/git-gc"

    case "$remote" in
    *.work.com/*)
        git config user.email me@work.com
        ;;
    *.github.com/*)
        git config user.email me@debian.org
        ;;
    *)
        echo '### Remember to set user.email ###'
        ;;
    esac

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

  parent reply	other threads:[~2013-08-14  7:09 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130809134236.28143.75775.reportbug@tglase.lan.tarent.de>
2013-08-09 19:42 ` git should not use a default user.email config value Jonathan Nieder
2013-08-09 20:00   ` Thorsten Glaser
2013-08-09 20:30     ` Felipe Contreras
2013-08-13  8:29       ` Matthieu Moy
2013-08-09 22:37   ` Jeff King
2013-08-09 23:06     ` Junio C Hamano
2013-08-10  6:17       ` Jeff King
2013-08-10  6:40         ` Jonathan Nieder
2013-08-10  6:52           ` Jeff King
2013-08-10  7:03             ` Jonathan Nieder
2013-08-10  7:14               ` Jeff King
2013-08-09 23:19     ` Jonathan Nieder
2013-08-10  6:47       ` Jeff King
2013-08-10  9:59         ` Michael Haggerty
2013-08-10 10:28           ` Jeff King
2013-08-10 11:42             ` Michael Haggerty
2013-08-10 12:06             ` Thorsten Glaser
2013-08-10 12:34             ` Andreas Schwab
2013-08-12 12:51             ` Greg Troxel
2013-08-10 16:58           ` Junio C Hamano
2013-08-12 11:52             ` Andrew Ardill
2013-08-12 12:39               ` Jeff King
2013-08-12 12:54                 ` Michael Haggerty
2013-08-12 15:49                   ` Jeff King
2013-08-12 13:01                 ` Andrew Ardill
2013-08-12 15:45                   ` Jeff King
2013-08-13 11:05                     ` Andrew Ardill
2013-08-13 11:46                       ` Jeff King
2013-08-13 12:05                         ` Jeff King
2013-08-13 12:52                         ` Andrew Ardill
2013-08-13 15:53                           ` Jeff King
2013-08-13 16:33                         ` Junio C Hamano
2013-08-14  7:28                           ` Matthieu Moy
2013-08-14  7:40                             ` Jeff King
2013-08-14  8:37                               ` Matthieu Moy
2013-08-14 14:00                                 ` Junio C Hamano
2013-08-14 14:07                                   ` Matthieu Moy
2013-08-14 14:08                                   ` conditional config syntax Jeff King
2013-08-14 15:41                                     ` Junio C Hamano
2013-08-14  7:09                         ` Michael Haggerty [this message]
2013-08-14  7:31                           ` git should not use a default user.email config value Jeff King
2013-08-13 16:31                 ` Junio C Hamano
2013-08-13  8:08             ` Matthieu Moy
2013-08-11  0:06           ` Aaron Schrab
2013-08-13  8:24   ` Matthieu Moy
2013-08-13  8:39     ` Thorsten Glaser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=520B2D11.2080405@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=Matthieu.Moy@imag.fr \
    --cc=andrew.ardill@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    --cc=tg@mirbsd.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.