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

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

From
Thomas Rast <trast@inf.ethz.ch>
Date
Mar 5, 2012, 13:40 UTC
Message-ID
<87r4x7jhd9.fsf@thomas.inf.ethz.ch>
In-Reply-To
<20120305132913.GA15004@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 20 quoted lines
> On Mon, Mar 05, 2012 at 02:04:37PM +0100, Thomas Rast wrote:
>
>> René Haber <rene@habr.de> writes:
>> 
>> > sh -c '                                   
>> >    . /sw/lib/git-core/git-sh-setup
>> >     get_author_ident_from_commit 16b94413cbce12531e8f946286851598449d3913
>> >  '
>> > GIT_AUTHOR_NAME='Ren'é Haber
>> > GIT_AUTHOR_EMAIL='rene@habr.de'
>> > GIT_AUTHOR_DATE='@1329212923 +0100'
>> [...]
>> That is, the garbage (if you try to read it as UTF-8) in the printf
>> string was matched and replaced byte-by-byte with 'x'.  However,
>> Will was getting the unreplaced results
>> 
>>   0000000: f89d 849e 0a                             .....
>> 
>> I'm not sure he has followed up on that problem; the only hope may be to
>> get a better 'sed'.
[...]
Show 8 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'

This is for a commit where I deliberately mangled my author line to make an interesting example, as in

  $ git cat-file commit HEAD | grep ^author
  author Thom'as Ràst <trast@inf.ethz.ch> 1330935546 +0100

I tried doing the quoting inside sed instead of the while...rev-parse --sq-quote, but it made my head hurt.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Jeff KingNext: Jeff King
Message 11 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.