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

Keep SHA length when upgrading? #113

Closed
dharrigan opened this issue Sep 18, 2021 · 5 comments
Closed

Keep SHA length when upgrading? #113

dharrigan opened this issue Sep 18, 2021 · 5 comments

Comments

@dharrigan
Copy link
Sponsor Contributor

Hi,

Just tried out 1.0.2, to fix the bug with upgrading a dependency when there is a git/sha defined. I've noticed that if antq does the upgrade (--upgrade --force), then the sha that I put in (to get things started), :git/sha "fb11811" is replaced with the full sha of the upgrade :git/sha "19c1d310235712240177a09475d5b71420aa7ddb".

I believe, antq should just honour what is considered to be sufficent for a short sha, i.e., 7 characters?

https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#Short-SHA-1

i.e., if one types in agit log --abbrev-commit, the sha output is 7 characters long. In the Clojure libraries I've worked with, 7 characters seems to be the default for the sha in the deps.edn (i.e., https://github.com/seancorfield/build-clj/blob/main/deps.edn).

Thank you.

-=david=-

@liquidz
Copy link
Owner

liquidz commented Sep 18, 2021

@dharrigan

I believe, antq should just honour what is considered to be sufficent for a short sha, i.e., 7 characters?

Right.

#111 (comment)
Currently I'm working on updating :git/tag now, and I'll support short sha if there is a tag in it. (And it's already working well in my local environment 😊)

So please look forward to the next release, which will also support short sha!

@liquidz
Copy link
Owner

liquidz commented Sep 18, 2021

@dharrigan I've just cut a new release.

Could you try the latest version?

@dharrigan
Copy link
Sponsor Contributor Author

dharrigan commented Sep 19, 2021

Hi!

Thank you very much,it sort of works, but this is what I observe too:

If I have this:

 :aliases {:build {:deps {io.github.seancorfield/build-clj {;:git/tag "v0.2.2"
                                                                                                                              :git/sha "5a12a1a"}}
                   :ns-default scripts.build}

And I do clj -M:antq --force --upgrade

I end up with this:

 :aliases {:build {:deps {io.github.seancorfield/build-clj {;:git/tag "v0.2.2"
                                                                                                                                :git/sha "19c1d310235712240177a09475d5b71420aa7ddb"}}

Which, although correctly getting the latest commit on the repo, is putting in the full sha.

-=david=-

p.s., I'm happy to pull/build from your main to try out things rather than you cutting a new release each time :-) Just ping me here or on slack :-)

@liquidz
Copy link
Owner

liquidz commented Sep 19, 2021

@dharrigan Thanks for your confirmation!

Now I'm using Clojure CLI version 1.10.3.967, and when I use only short sha for some deps, I got the following message.

Library io.github.seancorfield/build-clj has prefix sha, use full sha or add tag

It's a Clojure CLI's specification.

So antq keeps sha length only for deps which has :tag or :git/tag for now.

@dharrigan
Copy link
Sponsor Contributor Author

Hi,

Yes, i see, the wording is a bit confusing

Optional key :git/sha if tag provided, can be prefix sha, otherwise should be full sha (:sha still supported for backwards compatibility)

So, if git/tag is supplied, it's okay to use the shortened sha, otherwise if only the git/sha is provided, use the full sha!

All good :-)

-=david=-

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

2 participants