Skip to contentSkip to conversation

gitk: Author/Committer name with special characters

PATCH Torsten Paul 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi!

I'm tracking a subversion repository which is running on a windows machine with git-svn. The user names look like DOMAIN\username and that's giving a strange display in gitk as the backslash sequence is evaluated.

I'm not sure if I found the correct place to prevent this, so I'd like to ask if the following change would be the correct thing to prepare as patch...

ciao,
Torsten.

gitk-git/gitk +2 -2
index fddcb45..f114fa2 100644
@@ -1510,10 +1510,10 @@ proc parsecommit {id contents listed} {
        set tag [lindex $line 0]
        if {$tag == "author"} {
            set audate [lindex $line end-1]
-           set auname [lrange $line 1 end-2]
+           set auname [join [lrange [split $line] 1 end-2]]
        } elseif {$tag == "committer"} {
            set comdate [lindex $line end-1]
-           set comname [lrange $line 1 end-2]
+           set comname [join [lrange [split $line] 1 end-2]]
        }
     }
     set headline {}
#1 lore raw
Quoted 8 lines · Torsten Paul

I'm tracking a subversion repository which is running on a windows machine with git-svn. The user names look like DOMAIN\username and that's giving a strange display in gitk as the backslash sequence is evaluated.

I'm not sure if I found the correct place to prevent this, so I'd like to ask if the following change would be the correct thing to prepare as patch...

Something like that, I think, but to be sure I'd like to see the actual author and committer lines that are causing the problem. Could you send me the output of "git cat-file commit" on one of the problematic commits?

Thanks,
Paul.

#2 lore raw
Quoted 5 lines · Paul Mackerras

Something like that, I think, but to be sure I'd like to see the actual author and committer lines that are causing the problem. Could you send me the output of "git cat-file commit" on one of the problematic commits?

The header of the commits look like this:

tree 2eaf317290917660c03dc977d5eae180b39420e0
parent e99bf1c38540300c501dbe776de28eed6a2250cd
author DOM\paul <DOM\paul@28e39a90-19ad-e645-8baa-5c9ab2323746> 1216216768 +0000 committer DOM\paul <DOM\paul@28e39a90-19ad-e645-8baa-5c9ab2323746> 1216216768 +0000

With my name it's just not displaying the backslash, but with names starting with a 't' or even better 'n' it get's more interresting as they are shown as tab or newline. And that looks very funny in the commit list view.

ciao,
Torsten.

#3 lore raw
In reply to Paul Mackerras
Quoted 5 lines · Paul Mackerras

Something like that, I think, but to be sure I'd like to see the actual author and committer lines that are causing the problem. Could you send me the output of "git cat-file commit" on one of the problematic commits?

I've created a small script that creates a minimal repo that shows the problem...

ciao,
Torsten.

#!/bin/bash

#
# Script to generate git commit messages that

# contain windows style user names. This kind of
# names are generated when using git-svn with a
# svn-repo that uses NTLM authentification.
#

EXT="@23e39a30-19ad-a625-8bac-5c9ab2323746"

do_commit () {
        F=test.txt
        echo "test$1" > "$F"
        git add "$F"

        M="<$2$EXT>"

        GIT_AUTHOR_NAME="$2" \
        GIT_AUTHOR_EMAIL="$M" \
        GIT_COMMITTER_NAME="$2" \
        GIT_COMMITTER_EMAIL="$M" \
        git commit -m "commit $1"
}

DIR=mktemp -d /tmp/gitk-test.XXXXXXXXXX || exit 1 trap "rm -rf \"$DIR\"" EXIT
cd $DIR || exit 2

git init
do_commit 1 "paul"
do_commit 2 "WIN\paul"
do_commit 3 "WIN\test"
do_commit 4 "WIN\nobody"
do_commit 5 "WIN\paul"
do_commit 6 "paul"
gitk