8

I have a group of repos and I have a .mailmap file to combine user names.

My .mailmap file works for all the repos, when it is in the root of each.

I tried to put the file in my ~/.gitconfig file and it doesn't work. Im using Git for Windows and in my global .gitconfig file I added this:

>> git config --global mailmap.file "~/.mailmap"

Thats the command I used. Also tried the log shown below.

[log]
    mailmap = ~/.mailmap
[mailmap]
    file = C:/Documents and Settings/<username>/.mailmap

Both lead to the same file location, but it doesn't seem to honor this file when using git-shortlog

Any suggestions? Thanks.

EDIT Never did git this to work on windows. My hack-fix was to keep the mailmap file in the database, and to write it to each repository with a script.

cwhelms
  • 1,731
  • 3
  • 12
  • 14
  • Do you have set the HOME environment variable? It isn't defined by default on Windows. – VonC Jun 29 '11 at 18:26
  • I've tried both ~/ and the actual path, same result. Msysgit adds that I believe tho. – cwhelms Jun 29 '11 at 21:06
  • @cwhelms: no, msysgit don't add `HOME` automatically, it relies on Windows environment variable `HOME` for a lots of its operations. I don't know if it has any bearing on mailmap, but it doesn't hurt to make sure first that `HOME` is correctly set before making any msysgit operation. – VonC Jun 29 '11 at 21:25
  • It throws no errors when I run git-short using both C:/... or ~/. I tried with just C:/ on everything, still nothing – cwhelms Jun 30 '11 at 12:30
  • @cwhelms: "`git-short`"? I don't know that command (`shortlog` maybe?). What version of Git are you using by the way? Anyway, a properly set `HOME` environment variable is a pre-condition to be sure some of the git commands will run smoothly. – VonC Jun 30 '11 at 14:14
  • git log --pretty=format:%H#%aN#%ad --date=short This all works on unix, just not windows btw. My home directory is set correctly, tested inside of Git Bash running echo $HOME. I am using the windows cmd though to run these commands, how can I check that? – cwhelms Jun 30 '11 at 19:51
  • In the Windows shell, you can type `echo %HOME%`: it must `C:\a\path` on Windows, and the same value would be displayed in a msysgit bash as `/c/a/path`. (that would be different in a cygwin session). See http://serverfault.com/questions/284683/gitosis-installation-of-public-key-not-working/285375#285375 as an example of `HOME` being set once and displayed differently in a DOS session and in a bash session. – VonC Jun 30 '11 at 20:48
  • Considering http://stackoverflow.com/questions/1634161/how-do-i-use-notepad-or-other-with-msysgit/2486342#2486342, you night need single quotes around your `mailmap.file` config value. – VonC Jul 01 '11 at 10:42

1 Answers1

3

Looking into my .gitconfig, I see that all the windows paths are written with two backslashes like

[difftool "kdiff3"]
  path = C:\\Program Files\\KDiff3\\kdiff3.exe

This works for me.

Maybe you should write

[mailmap]
  file = C:\\Documents and Settings\\<username>\\.mailmap

to get things working. As an alternative, you could try the git-style path declaration like

[mailmap]
  file = /c/Documents\ and\ Settings/<username>/.mailmap
eckes
  • 64,417
  • 29
  • 168
  • 201
  • Good point, but `'C:/Program Files/KDiff3/kdiff3.exe'` (note the single quotes) should work too, as illustrated in http://stackoverflow.com/questions/1634161/how-do-i-use-notepad-or-other-with-msysgit/2486342#2486342 . Still +1 ;) – VonC Jul 01 '11 at 10:40
  • Still not working. I tried all 3 of the suggestions. The git-style path doesn't work at all, saying bad config file. I'll keep trying different things. This works on linux though! ugh windows... – cwhelms Jul 05 '11 at 19:46
  • On Windows... mailmap does not work with single quotes. No quotes works and double quotes works. Also single forward slash works or double backslash. Same behaviour in all these versions: git version 1.9.4.msysgit.0, git version 2.1.4, git version 2.6.1.windows.1 – RobG Feb 11 '16 at 04:23