git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Thomas Rast <trast@inf.ethz.ch>
Cc: "René Haber" <rene@habr.de>,
	git@vger.kernel.org, "Will Palmer" <wmpalmer@gmail.com>
Subject: Re: Bug: pull --rebase with é in name
Date: Mon, 5 Mar 2012 08:50:10 -0500	[thread overview]
Message-ID: <20120305135010.GA17189@sigill.intra.peff.net> (raw)
In-Reply-To: <87r4x7jhd9.fsf@thomas.inf.ethz.ch>

On Mon, Mar 05, 2012 at 02:40:34PM +0100, Thomas Rast wrote:

> > It would be nice if the --pretty format placeholders had a "shell-quote"
> > modifier, and we could just do:
> >
> >   git show --format='GIT_AUTHOR_NAME=%(an:shell)'
> >
> > or something similar. for-each-ref knows about shell-quoting, but we
> > can't use it here, because we are looking at arbitrary commits, not just
> > ones pointed to by refs.
> 
> Perhaps by using %an etc., line numbers and --sq-quote:
> 
>   $ git rev-list --no-walk --date=raw --format="%an%n%ae%n%ad" --encoding=UTF-8 HEAD |
>     while read -r s; do git rev-parse --sq-quote "$s"; done |
>     sed -n -e '2s/^ /GIT_AUTHOR_NAME=/p' -e '3s/^ /GIT_AUTHOR_EMAIL=/p' -e '4s/^ /GIT_AUTHOR_DATE=/p'
>   GIT_AUTHOR_NAME='Thom'\''as Ràst'
>   GIT_AUTHOR_EMAIL='trast@inf.ethz.ch'
>   GIT_AUTHOR_DATE='1330935546 +0100'

Yeah, that works. It's a little harder to read than would be ideal, but
should produce the right results (I was initially hesitant to use "read"
because I was worried about newlines in the input. But of course, that's
a non-issue since author ident by definition cannot have newlines in
it).

I think this is a good direction regardless of the sed issue. We end up
parsing ident lines like this in a lot of different places, and I would
not be surprised if they do not all behave exactly the same. Eliminating
one such parser in favor of the standard one in pretty.c seems like a
good thing.

-Peff

PS If you are going to turn that into a real patch, note that your date
   field accidentally drops the "@" specifier that unambiguously marks
   the number as an epoch timestamp.

  reply	other threads:[~2012-03-05 13:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05  9:59 Bug: pull --rebase with é in name René Haber
2012-03-05 10:26 ` Jeff King
2012-03-05 10:37   ` Thomas Rast
2012-03-05 11:42     ` René Haber
2012-03-05 11:58       ` Jeff King
2012-03-05 12:36         ` Jakub Narebski
2012-03-05 12:46         ` René Haber
2012-03-05 13:04           ` Thomas Rast
2012-03-05 13:19             ` René Haber
2012-03-05 13:29             ` Jeff King
2012-03-05 13:40               ` Thomas Rast
2012-03-05 13:50                 ` Jeff King [this message]
2012-03-05 17:23               ` Junio C Hamano
2012-03-06  8:23                 ` Jeff King
2012-03-06  8:36                 ` Thomas Rast
2012-03-06  9:02                   ` Jeff King
2012-03-06 18:31                   ` 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=20120305135010.GA17189@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=rene@habr.de \
    --cc=trast@inf.ethz.ch \
    --cc=wmpalmer@gmail.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).