threads / discuss / 21051

git log --pretty=format:%h prints (unrequired) abbreviated sha

Subject: git log --pretty=format:%h prints (unrequired) abbreviated sha

## tl;dr

19 messages between Sep 25, 2009 and Sep 27, 2009.

replies: 18people: 3as markdown or json

Marco Costalba· Sep 25, 2009, 09:40 UTC · lore
Perhaps is a dumb question, but for me is very new.
I have download and installed msysgit:
git version 1.6.4.msysgit.0
and now
git log --pretty=format:%h

prints a list of abbreviated (7 chars) SHA instead of the full 40 chars as I want.

I didn't change anything in git config and I am not able to restore the original (correct) behaviour.

Could someone please help me on this ?

Thanks Marco

Marco Costalba· Sep 25, 2009, 09:46 UTC · re: Marco Costalba · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

On Fri, Sep 25, 2009 at 10:40, Marco Costalba <mcostalba@gmail.com> wrote:
Show 5 quoted lines
>
> and now
>
> git log --pretty=format:%h
>
Sorry, the correct command is:
git log --pretty=format:%H
but output is still abbreviated.
Johannes Sixt· Sep 25, 2009, 10:33 UTC · re: Marco Costalba · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

Marco Costalba schrieb:
Show 11 quoted lines
> On Fri, Sep 25, 2009 at 10:40, Marco Costalba <mcostalba@gmail.com> wrote:
>> and now
>>
>> git log --pretty=format:%h
>>
> 
> Sorry, the correct command is:
> 
> git log --pretty=format:%H
> 
> but output is still abbreviated.

Doesn't happen here. %h produces abbreviated SHA1s and %H full SHA1s. However, I don't run msysgit, but compile git myself. I run the commands from CMD.

-- Hannes
Marco Costalba· Sep 25, 2009, 10:44 UTC · re: Johannes Sixt · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

On Fri, Sep 25, 2009 at 11:33, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 17 quoted lines
> Marco Costalba schrieb:
>> On Fri, Sep 25, 2009 at 10:40, Marco Costalba <mcostalba@gmail.com> wrote:
>>> and now
>>>
>>> git log --pretty=format:%h
>>>
>>
>> Sorry, the correct command is:
>>
>> git log --pretty=format:%H
>>
>> but output is still abbreviated.
>
> Doesn't happen here. %h produces abbreviated SHA1s and %H full SHA1s.
> However, I don't run msysgit, but compile git myself. I run the commands
> from CMD.
>

What (old) version of msgit do you suggest me to try to verify if it is a new problem ?

BTW gitk does not work correctly. It loads the revisions but doesn't show the diffs.

Marco Costalba· Sep 25, 2009, 11:30 UTC · re: Marco Costalba · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

On Fri, Sep 25, 2009 at 11:44, Marco Costalba <mcostalba@gmail.com> wrote:
Show 25 quoted lines
> On Fri, Sep 25, 2009 at 11:33, Johannes Sixt <j.sixt@viscovery.net> wrote:
>> Marco Costalba schrieb:
>>> On Fri, Sep 25, 2009 at 10:40, Marco Costalba <mcostalba@gmail.com> wrote:
>>>> and now
>>>>
>>>> git log --pretty=format:%h
>>>>
>>>
>>> Sorry, the correct command is:
>>>
>>> git log --pretty=format:%H
>>>
>>> but output is still abbreviated.
>>
>> Doesn't happen here. %h produces abbreviated SHA1s and %H full SHA1s.
>> However, I don't run msysgit, but compile git myself. I run the commands
>> from CMD.
>>
>
> What (old) version of msgit do you suggest me to try to verify if it
> is a new problem ?
>
> BTW gitk does not work correctly. It loads the revisions but doesn't
> show the diffs.
>

Also installing an old version I have the same wrong behaviour and the same version works on another PC and with the same repository I am testing with.

So I am thinking to some setup somewhere that makes git to use abbreviated commits instead of full names. Does exist something like this ?

Thanks
Marco Costalba· Sep 25, 2009, 14:04 UTC · re: Marco Costalba · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

On Fri, Sep 25, 2009 at 12:30, Marco Costalba <mcostalba@gmail.com> wrote:
Show 5 quoted lines
>
> So I am thinking to some setup somewhere that makes git to use
> abbreviated commits instead of full names. Does exist something like
> this ?
>

Here it is very strange. The problem is that git shell is no more case sensitive.

I have tried git commit -F ...
and I got error:unkown switch 'f'

So somehow the problem is that all the commands are lowercased, and this explains why pretty format %H is interpreted as %h so that sha abbreviated form is used.

Now the question is: how to restore normal case sensitive command parsing ?

Thanks Marco

P.S: Please, at least answer this last question ;-)
Johannes Sixt· Sep 25, 2009, 14:12 UTC · re: Marco Costalba · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

Marco Costalba schrieb:
Show 7 quoted lines
> So somehow the problem is that all the commands are lowercased, and
> this explains why pretty format %H is interpreted as %h so that sha
> abbreviated form is used.
> 
> Now the question is: how to restore normal case sensitive command parsing ?
> 
> P.S: Please, at least answer this last question ;-)
I cannot.

Please try calling the commands from CMD. To do that in a regular msysgit installation where you did not choose the option to set the PATH, it should be sufficient to point your PATH to <installdir>\git\bin;<installdir>\bin;%PATH% (although I'm not sure about the exact paths - as I said, I don't install msysgit). Does that work?

-- Hannes
Marco Costalba· Sep 25, 2009, 14:18 UTC · re: Johannes Sixt · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

On Fri, Sep 25, 2009 at 15:12, Johannes Sixt <j.sixt@viscovery.net> wrote:
>
> Does that work?
>
No it doesn't.

I had already C:\Program Files\Git\cmd in path, probably added by msysgit installation.

Johannes Sixt· Sep 25, 2009, 15:27 UTC · re: Marco Costalba · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

Marco Costalba schrieb:
Show 8 quoted lines
> On Fri, Sep 25, 2009 at 15:12, Johannes Sixt <j.sixt@viscovery.net> wrote:
>> Does that work?
>>
> 
> No it doesn't.
> 
> I had already C:\Program Files\Git\cmd in path, probably added by
> msysgit installation.

The point of the exercise is to not use the git.cmd wrapper. I.e. point your path not into C:\Program Files\Git\cmd, but into the bin directories so that you run git.exe, not git.cmd.

-- Hannes
Marco Costalba· Sep 25, 2009, 18:25 UTC · re: Johannes Sixt · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

On Fri, Sep 25, 2009 at 16:27, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 14 quoted lines
> Marco Costalba schrieb:
>> On Fri, Sep 25, 2009 at 15:12, Johannes Sixt <j.sixt@viscovery.net> wrote:
>>> Does that work?
>>>
>>
>> No it doesn't.
>>
>> I had already C:\Program Files\Git\cmd in path, probably added by
>> msysgit installation.
>
> The point of the exercise is to not use the git.cmd wrapper. I.e. point
> your path not into C:\Program Files\Git\cmd, but into the bin directories
> so that you run git.exe, not git.cmd.
>
Now path is C:\Program Files\Git\bin

I have even deleted the contents of cmd directory to be sure they were not called.

But unfortunatly the problem persists.
alexandrul· Sep 25, 2009, 18:40 UTC · re: Marco Costalba · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

Show 6 quoted lines
> Now path is C:\Program Files\Git\bin
> 
> I have even deleted the contents of cmd directory to be sure they were
> not called.
> 
> But unfortunatly the problem persists.

Could you copy the git installation folder to another PC and see if the problem is still present? Or archive it and upload it on some file sharing service?

Have a nice day,
   A.
Marco Costalba· Sep 25, 2009, 18:44 UTC · re: alexandrul · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

On Fri, Sep 25, 2009 at 19:40, alexandrul <alexandrul.ct@gmail.com> wrote:
Show 11 quoted lines
>> Now path is C:\Program Files\Git\bin
>>
>> I have even deleted the contents of cmd directory to be sure they were
>> not called.
>>
>> But unfortunatly the problem persists.
>
> Could you copy the git installation folder to another PC and see if the
> problem is still present? Or archive it and upload it on some file sharing
> service?
>

This is a good idea, thanks. I will copy the git folder to a working PC and we will see....

Marco Costalba· Sep 25, 2009, 19:08 UTC · re: Marco Costalba · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

>
> This is a good idea, thanks. I will copy the git folder to a working
> PC and we will see....
>
I have copied the whole Git folder to another PC with windows xp.

I have moved the Git directory and all its subfolders under program files instead of the old that I have renamed.

And everything worked as expected ! no problem and from git bash I verified that the new copied version was running.

I really don't know what to think....
alexandrul· Sep 25, 2009, 19:18 UTC · re: Marco Costalba · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

Marco Costalba wrote:
Show 14 quoted lines
>> This is a good idea, thanks. I will copy the git folder to a working
>> PC and we will see....
>>
> 
> I have copied the whole Git folder to another PC with windows xp.
> 
> I have moved the Git directory and all its subfolders under program
> files instead of the old that I have renamed.
> 
> And everything worked as expected ! no problem and from git bash I
> verified that the new copied version was running.
> 
> I really don't know what to think....
> 

then check your PATH and the configuration files from your HOME folder (as recommended earlier).

Have a nice day,
   A.
Marco Costalba· Sep 25, 2009, 20:04 UTC · re: alexandrul · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

On Fri, Sep 25, 2009 at 20:18, alexandrul <alexandrul.ct@gmail.com> wrote:
>
> then check your PATH and the configuration files from your HOME folder (as
> recommended earlier).
>
I have uninstalled git, verified git folder was removed.

I have removed git/cmd from the PATH in Windows and I have removed the following files from users/marco

.bash_history .gitconfig .gitk

I have reinstalled all and it still does not work. There are other files in HOME that I need to remove ?

alexandrul· Sep 25, 2009, 14:41 UTC · re: Marco Costalba · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

Show 10 quoted lines
>> What (old) version of msgit do you suggest me to try to verify if it
>> is a new problem ?
>>
>> BTW gitk does not work correctly. It loads the revisions but doesn't
>> show the diffs.
>>
> 
> Also installing an old version I have the same wrong behaviour and the
> same version works on another PC and with the same repository I am
> testing with.

If nothing else works, you could try to uninstall your current version of git, clean up any traces left, and reinstall.

http://code.google.com/p/msysgit/issues/detail?id=336
Have a nice day,
   A.
Marco Costalba· Sep 25, 2009, 15:13 UTC · re: alexandrul · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

On Fri, Sep 25, 2009 at 15:41, alexandrul <alexandrul.ct@gmail.com> wrote:
Show 9 quoted lines
>
> If nothing else works, you could try to uninstall your current version of
> git, clean up any traces left, and reinstall.
>
> http://code.google.com/p/msysgit/issues/detail?id=336
>
> Have a nice day,
>  A.
>
Thanks, I have tried but with no success.
Another info is that it seems git related, from msysgit bash shell:

$ ls -a . .. .git

$ ls -A .git

$ git --version git version 1.6.4.msysgit.0

$ git --VERSION git version 1.6.4.msysgit.0

So only the git command seems to treat command line arguments in a case-insensitive way, while other commands do not.

Marco Costalba· Sep 26, 2009, 21:55 UTC · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

Hi Alexandrul,
Now it works !!!! :-)  :-)

It was a virus ! I have run Malwarebytes Anti-malware 1.41 and it found some virus (I send you the logs in attachment), after removing them the problem disappeared.

I have Kaspersky as antivirus, but, although a very good antivirus it failed to identify them.

I didn't know this Malwarebytes, but it seems very powerful.
Thanks anyhow for your exceptional help, I have really appreciated that !!!!

Thanks again Marco

Malwarebytes' Anti-Malware 1.41 Database version: 2863 Windows 6.0.6002 Service Pack 2

26/09/2009 22.26.18 mbam-log-2009-09-26 (22-26-18).txt

Scan type: Full Scan (C:\|D:\|) Objects scanned: 341703 Time elapsed: 1 hour(s), 26 minute(s), 14 second(s)

Memory Processes Infected: 0 Memory Modules Infected: 0 Registry Keys Infected: 3 Registry Values Infected: 1 Registry Data Items Infected: 0 Folders Infected: 2 Files Infected: 6

Memory Processes Infected: (No malicious items detected)

Memory Modules Infected: (No malicious items detected)

Registry Keys Infected: HKEY_CLASSES_ROOT\CLSID\{ba603215-23f2-42ad-f4e4-00aac39caa53} (Trojan.Ertfor) -> Quarantined and deleted successfully. HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Ext\Stats\{ba603215-23f2-42ad-f4e4-00aac39caa53} (Trojan.Ertfor) -> Quarantined and deleted successfully. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{ba603215-23f2-42ad-f4e4-00aac39caa53} (Trojan.Ertfor) -> Quarantined and deleted successfully.

Registry Values Infected: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SharedTaskScheduler\{ba603215-23f2-42ad-f4e4-00aac39caa53} (Trojan.Ertfor) -> Quarantined and deleted successfully.

Registry Data Items Infected: (No malicious items detected)

Folders Infected: C:\RECYCLER\S-1-5-21-0243936033-3052116371-381863308-1811 (Trojan.Agent) -> Quarantined and deleted successfully. C:\RECYCLER\s-1-5-21-0243936033-3052116371-381863308-1858 (Worm.Autorun) -> Quarantined and deleted successfully.

Files Infected: C:\bqegh.exe (Trojan.Dropper) -> Quarantined and deleted successfully. C:\Windows\System32\beep.sys (Rootkit.Agent) -> Quarantined and deleted successfully. C:\Windows\System32\serfing.dll (Rootkit.Agent) -> Delete on reboot. C:\Windows\System32\drivers\serfing.sys (Rootkit.Agent) -> Quarantined and deleted successfully. C:\RECYCLER\S-1-5-21-0243936033-3052116371-381863308-1811\Desktop.ini (Trojan.Agent) -> Quarantined and deleted successfully. C:\RECYCLER\s-1-5-21-0243936033-3052116371-381863308-1858\Desktop.ini (Worm.Autorun) -> Quarantined and deleted successfully.

alexandrul· Sep 27, 2009, 10:40 UTC · re: Marco Costalba · lore

Re: git log --pretty=format:%h prints (unrequired) abbreviated sha

Marco Costalba wrote:
Show 19 quoted lines
> Hi Alexandrul,
> 
> Now it works !!!! :-)  :-)
> 
> It was a virus !  I have run Malwarebytes Anti-malware 1.41 and it
> found some virus (I send you the logs in attachment), after removing
> them the problem disappeared.
> 
> I have Kaspersky as antivirus, but, although a very good antivirus it
> failed to identify them.
> 
> I didn't know this Malwarebytes, but it seems very powerful.
> 
> Thanks anyhow for your exceptional help, I have really appreciated that !!!!
> 
> 
> Thanks again
> Marco
> 
You are welcome.

Unfortunately, Kaspersky and Malwarebytes target different threats, but both of them are very good at what they do.

Have a nice day,
   A.

← back to recent threads