Skip to content

git clone/checkout fails when using commit sha1 as tag #106

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

Closed
adangel opened this issue Apr 12, 2022 · 3 comments · Fixed by #113
Closed

git clone/checkout fails when using commit sha1 as tag #106

adangel opened this issue Apr 12, 2022 · 3 comments · Fixed by #113
Labels
bug Something isn't working
Milestone

Comments

@adangel
Copy link
Member

adangel commented Apr 12, 2022

Currently we need to fork Schedul-o-matic-9000 and fflib-apex-common in order to create a tag, that we can use in project-list.xml:

  <project>
    <name>Schedul-o-matic-9000</name>
    <type>git</type>
    <connection>https://github.com/pmd/Schedul-o-matic-9000</connection>
    <!-- 
    <connection>https://github.com/SalesforceLabs/Schedul-o-matic-9000</connection>
    Note: using forked repo from pmd, as original repo doesn't have any useful tags/branches
    -->
    <tag>pmd-regression-test</tag>
  </project>

It would be nice to allow to specify directly a sha1 for the commit, e.g.

  <project>
    <name>Schedul-o-matic-9000</name>
    <type>git</type>
    <connection>https://github.com/SalesforceLabs/Schedul-o-matic-9000</connection>
    <tag>6b1229ba43b38931fbbab5924bc9b9611d19a786</tag>
  </project>

Using the tag-tag would avoid to change the schema for this file.

@adangel adangel added the enhancement New feature or request label Apr 12, 2022
@adangel adangel changed the title Allow to specify commits in project-list Allow to specify commit in project-list Apr 12, 2022
@adangel
Copy link
Member Author

adangel commented May 5, 2022

Hm... this does already work. At least in the integration test.

@adangel adangel added the wontfix This will not be worked on label May 5, 2022
adangel added a commit that referenced this issue May 5, 2022
@adangel
Copy link
Member Author

adangel commented May 5, 2022

$ git status
HEAD detached at 6b1229b
nothing to commit, working tree clean

All pmd-regression-tester does, is executing: git checkout 6b1229ba43b38931fbbab5924bc9b9611d19a786 && git reset --hard 6b1229ba43b38931fbbab5924bc9b9611d19a786:

reset_cmd = "git checkout #{tag}; git reset --hard #{tag}"

And that works fine. Git checks out in detached mode.

@adangel
Copy link
Member Author

adangel commented May 12, 2022

Ok, so it works for https://github.com/SalesforceLabs/Schedul-o-matic-9000 because "6b1229ba43b38931fbbab5924bc9b9611d19a786" is the latest commit referenced by HEAD: https://github.com/SalesforceLabs/Schedul-o-matic-9000/commits/master

As soon as a new commit is added, it'll stop working.

For the other repo https://github.com/apex-enterprise-patterns/fflib-apex-common we use the commit "7e0891efb86d23de62811af56d87d0959082a322", which is not the HEAD, and hence it fails:

git clone --no-single-branch --depth 1 https://github.com/apex-enterprise-patterns/fflib-apex-common test-fflib-apex-common
cd test-fflib-apex-common && git checkout 7e0891efb86d23de62811af56d87d0959082a322 && git reset --hard 7e0891efb86d23de62811af56d87d0959082a322 && cd ..
fatal: reference is not a tree: 7e0891efb86d23de62811af56d87d0959082a322

@adangel adangel added bug Something isn't working and removed enhancement New feature or request wontfix This will not be worked on labels May 12, 2022
@adangel adangel changed the title Allow to specify commit in project-list git clone/checkout fails when using commit sha1 as tag May 12, 2022
@adangel adangel added this to the 1.5.1 milestone May 12, 2022
adangel added a commit to oowekyala/pmd-regression-tester that referenced this issue May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant