Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong last commit reported with list_command | git rev-list --stdin #293

Closed
talset opened this issue Dec 11, 2019 · 7 comments
Closed

wrong last commit reported with list_command | git rev-list --stdin #293

talset opened this issue Dec 11, 2019 · 7 comments

Comments

@talset
Copy link
Contributor

talset commented Dec 11, 2019

On a customer git it seems they had a weird commit with year 2106 instead of 2016 :

commit d1f0d5f316ffd6a7ba9e03198e4aae55b3d2efb1
Date:   Tue Dec 10 12:34:33 2019 +0100

...

commit 06a8e882889e6e164018271f000330d4c23004bd
Date:   Sun Feb 7 06:29:14 2106 -9039932

commit 86ddfd204e0f7b07492e220c9da1dfd0b422def2
Date:   Wed Jun 1 11:41:20 2016 +0200

Since c7ce409 / #271

06a8e882889e6e164018271f000330d4c23004bd is detected as the latest commit each time.

In this case the cmd is

git rev-list --all --first-parent   | git rev-list --stdin --grep="\[ci\sskip\]" --grep="\[skip\sci\]" --invert-grep --first-parent --no-walk| git rev-list --stdin -1

What is the purpose of this ?
Should it be reverted ? Or changed by list_command+="| git rev-list --stdin --date-order -1" ? Or simply list_command+="| head -n1" ?

talset referenced this issue Dec 11, 2019
@talset
Copy link
Contributor Author

talset commented Dec 12, 2019

What do you think @CliffHoogervorst ?

@talset
Copy link
Contributor Author

talset commented Dec 27, 2019

@CliffHoogervorst did you had time to have a look ?

@RichardBradley
Copy link

I have a similar issue: due to a rebase, I have one commit on my branch with a commit date that is newer than the head of the branch (in my case it's a few minutes newer, not 100 years!).

The Concourse git-resource now picks that commit as the "latest" on the branch, even if I explicitly name the branch on the resource:

  - name: "myapp-src"
    type: git
    icon: github-circle
    source:
      uri: "[email protected]:me/myapp.git"
      private_key: ((github-private-key))
      branch: master

How can I get Concourse git-resource to correctly track a branch, rather than incorrectly sorting commits by commit date?

@talset
Copy link
Contributor Author

talset commented Mar 6, 2020

@CliffHoogervorst could you come back to us ? Maybe @vito have some ideas ?

I could do a PR to change list_command but I would prefer to have @CliffHoogervorst feedback before reverting or changing anything.

The current workaround is to "disable" the "faulty" commit on concourse resource.

@simonjohansson
Copy link
Contributor

We just saw the same behaviour as @RichardBradley described. Rebase involved

* commit order in Concourse
commit2 - Wed Mar 18 09:20:23 2020 +0000
commit4 - Wed Mar 18 09:09:00 2020 +0000
commit3 - Wed Mar 18 08:51:34 2020 +0000
commit1 - Wed Mar 18 08:47:43 2020 +0000

* commit order in git
commit4 - Wed Mar 18 09:09:00 2020 +0000
commit3 - Wed Mar 18 08:51:34 2020 +0000
commit2 - Wed Mar 18 09:20:23 2020 +0000
commit1 - Wed Mar 18 08:47:43 2020 +0000

talset added a commit to talset/git-resource that referenced this issue Mar 24, 2020
Last commit reported could be wrong after a rebase.

Introduced by concourse@c7ce409

Keep only the first line instead of running a second time `git rev-lis`
@talset
Copy link
Contributor Author

talset commented Mar 24, 2020

PR #310 have been created with the head cmd fix.

talset added a commit to talset/git-resource that referenced this issue Mar 25, 2020
Last commit reported could be wrong after a rebase.

Introduced by concourse@c7ce409

Keep only the first line instead of running a second time `git rev-lis`

Signed-off-by: talset <[email protected]>
@talset
Copy link
Contributor Author

talset commented Mar 25, 2020

@RichardBradley @simonjohansson Are you able to reproduce the issue ?
If yes do you have the git command to have this behaviors ?

talset added a commit to talset/git-resource that referenced this issue Apr 3, 2020
Last commit reported could be wrong after a rebase or wrong commiter
date.

Use `--date-order` to show commits in the commit timestamp order.

Signed-off-by: talset <[email protected]>
@vito vito closed this as completed in 6b3c8db Apr 20, 2020
vito added a commit that referenced this issue Apr 20, 2020
Fix #293 wrong last commit reported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants