git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug: pull --rebase with é in name

From
Jeff King <peff@peff.net>
Date
Mar 5, 2012, 13:50 UTC
Message-ID
<20120305135010.GA17189@sigill.intra.peff.net>
In-Reply-To
<87r4x7jhd9.fsf@thomas.inf.ethz.ch>
On Mon, Mar 05, 2012 at 02:40:34PM +0100, Thomas Rast wrote:
Show 17 quoted lines
> > 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.
Previous: Thomas RastNext: Junio C Hamano
Message 12 of 17 in “Bug: pull --rebase with é in name”
  1. René HaberMar 5, 2012
  2. Jeff KingMar 5, 2012
  3. Thomas RastMar 5, 2012
  4. René HaberMar 5, 2012
  5. Jeff KingMar 5, 2012
  6. Jakub NarebskiMar 5, 2012
  7. René HaberMar 5, 2012
  8. Thomas RastMar 5, 2012
  9. René HaberMar 5, 2012
  10. Jeff KingMar 5, 2012
  11. Thomas RastMar 5, 2012
  12. Jeff KingMar 5, 2012
  13. Junio C HamanoMar 5, 2012
  14. Jeff KingMar 6, 2012
  15. Thomas RastMar 6, 2012
  16. Jeff KingMar 6, 2012
  17. Junio C HamanoMar 6, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.