git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH] Use SUDO_UID to guess committer identity
Date: Sat, 7 Jun 2008 20:23:43 -0400	[thread overview]
Message-ID: <20080608002343.GG12896@spearce.org> (raw)
In-Reply-To: <7v63slnegm.fsf@gitster.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> 
> > When invoking Git commands though sudo against a bare repository
> > with reflogs enabled we should attempt to record the actual user's
> > information in the reflog, not the identity of the user sudo entered.
> >
> > For example when executing:
> >
> > 	sudo -u gitadm git --git-dir=/srv/git.git branch -f pu master
> >
> > We want record information about the caller of sudo, not gitadm.
> 
> If you are using something esoteric like pseudo, isn't it too much to ask
> to also use existing GIT_COMMITTER_NAME, or are there reasons why it is
> not sufficient?

The issue is when users run commands though sudo, but forget to set a
value for GIT_COMMITTER_NAME/EMAIL, or to configure ~/.gitconfig in
their personal account.  Now git has to guess the values for these
based on the gecos of getuid(), and getuid() is returning the uid
of the service account sudo entered (gitadm), not the real user's
account.  So the reflogs show generic "GIT Admin" and not who it was.

Eh, I'm myself not entirely happy with the patch.  It honors the
real user's $HOME/.gitconfig user.name/email settings and not the
SUDO_UID data.  I'd almost prefer favoring SUDO_UID over whatever
we inherit in from the enviroment or from $HOME/.gitconfig when it
comes to committer identity.

-- 
Shawn.

  reply	other threads:[~2008-06-08  0:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-07  7:11 [RFC PATCH] Use SUDO_UID to guess committer identity Shawn O. Pearce
2008-06-07 21:05 ` Junio C Hamano
2008-06-08  0:23   ` Shawn O. Pearce [this message]
2008-06-08  0:57     ` Junio C Hamano

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=20080608002343.GG12896@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).