RE: one bug on git

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi
   Thanks for your support
 
    But your idea was still not working as my wanted , please check the result below

[pelou@hzling29 try_des]$ git log -1 --raw --no-walk=unsorted 57cf56b8c1af9115a7f8e1c1c8f07e4d657e8b15^ 57cf56b8c1af9115a7f8e1c1c8f07e4d657e8b15
commit 9d00cc608993840e24f65c7b79ae10f85c2d72ff
Author: pelou <pengfei.lou@xxxxxxxxxxxxxxx>
Date:   Tue Dec 3 17:00:47 2019 +0800

    2

:100644 100644 d474e1b... 9a7456b... M  lpf
[pelou@hzling29 try_des]$ git log --raw --no-walk=unsorted 57cf56b8c1af9115a7f8e1c1c8f07e4d657e8b15^ 57cf56b8c1af9115a7f8e1c1c8f07e4d657e8b15
commit 9d00cc608993840e24f65c7b79ae10f85c2d72ff
Author: pelou <pengfei.lou@xxxxxxxxxxxxxxx>
Date:   Tue Dec 3 17:00:47 2019 +0800

    2

:100644 100644 d474e1b... 9a7456b... M  lpf

commit 57cf56b8c1af9115a7f8e1c1c8f07e4d657e8b15
Author: pelou <pengfei.lou@xxxxxxxxxxxxxxx>
Date:   Tue Dec 3 17:00:47 2019 +0800

    3

So you mean it is not one bug /issue, and  adding delay was mandatory for this case? Actually , I found it was still be failure if the delay was set 0.5 seconds. 

tks
Br, Hercules

-----Original Message-----
From: Bryan Turner <bturner@xxxxxxxxxxxxx> 
Sent: 2019年12月3日 16:56
To: Lou, Pengfei (NSB - CN/Hangzhou) <pengfei.lou@xxxxxxxxxxxxxxx>
Cc: git@xxxxxxxxxxxxxxx
Subject: Re: one bug on git

On Tue, Dec 3, 2019 at 12:29 AM Lou, Pengfei (NSB - CN/Hangzhou) <pengfei.lou@xxxxxxxxxxxxxxx> wrote:
>
> Hello community
>      One problem I found recently within my working, please check my detail below.
>
>      I tried to run my script (check the attached file 'problem.sh') 
> to build one git repository , it can be successful, but the command 
> "git log -raw -1 ${revision}^ ${revision}" on that repo would generate 
> some  unexpected result,  please check the result below
>
> [pelou@hzling29 try_des]$ git --version git version 2.6.2
>
> [pelou@hzling29 try_des]$ git log --raw -1 
> 164304f48726d31336e2e130a90e42b7f1c480f8
> commit 164304f48726d31336e2e130a90e42b7f1c480f8
> Author: pelou <mailto:pengfei.lou@xxxxxxxxxxxxxxx>
> Date:   Tue Dec 3 14:54:33 2019 +0800
>
>     3
>
> :100644 100644 9a7456b... 8148ef7... M  lpf
> [pelou@hzling29 try_des]$ git log --raw -1 
> 164304f48726d31336e2e130a90e42b7f1c480f8^ 
> 164304f48726d31336e2e130a90e42b7f1c480f8
> commit dd1a95338ffd471e5b270a487b585bbfcf9926a5
> Author: pelou <mailto:pengfei.lou@xxxxxxxxxxxxxxx>
> Date:   Tue Dec 3 14:54:33 2019 +0800
>
>     2
>
> :100644 100644 d474e1b... 9a7456b... M  lpf
>
>      Next step I changed my script(check the attached file good.sh) 
> and only add some delays after "git push", everything is normal, check 
> it below
> [pelou@hzling29 try_des]$ git log --raw -1 
> 2027dc54da1896cf1dfa301c3444b1690d6cb1d8
> commit 2027dc54da1896cf1dfa301c3444b1690d6cb1d8
> Author: pelou <mailto:pengfei.lou@xxxxxxxxxxxxxxx>
> Date:   Tue Dec 3 15:00:45 2019 +0800
>
>     3
>
> :100644 100644 9a7456b... 8148ef7... M  lpf
> [pelou@hzling29 try_des]$ git log --raw -1 
> 2027dc54da1896cf1dfa301c3444b1690d6cb1d8^ 
> 2027dc54da1896cf1dfa301c3444b1690d6cb1d8
> commit 2027dc54da1896cf1dfa301c3444b1690d6cb1d8
> Author: pelou <mailto:pengfei.lou@xxxxxxxxxxxxxxx>
> Date:   Tue Dec 3 15:00:45 2019 +0800
>
>     3
>
> :100644 100644 9a7456b... 8148ef7... M  lpf
>
> So please help me fix it. Please let me know if I was wrong or miss 
> some thing

By default, git log sorts commits by their timestamps and outputs them in reverse chronological order (as stated in the git log documentation[1]), not the order you requested the commits in. Without the delays, the commits can happen so fast you end up with identical timestamps on each commit. I'm not sure git log has a tie-breaker in such a case (it may just end up being input order).

If you want the commits to be output in the order you ask for them in, you might try something like "git log --raw --no-walk=unsorted sha^ sha". This will output exactly the commits you ask for (so "sha"'s first parent and "sha") in the same order you requested them in.

Hope this helps,
Bryan Turner

[1] https://git-scm.com/docs/git-log#_commit_ordering

>
> Br, Hercules




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux