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

Can't use SHA as a whippet ref #130

Open
RobjS opened this issue Jul 3, 2019 · 2 comments
Open

Can't use SHA as a whippet ref #130

RobjS opened this issue Jul 3, 2019 · 2 comments

Comments

@RobjS
Copy link
Contributor

RobjS commented Jul 3, 2019

It would be useful if we could use a specific commit SHA to pin a dependency to specific commit in whippet.json, e.g.:

{
  "name": "dxw-digest",
  "ref": "somecommitSHAhere"
}

However, this produces an error when running whippet deps update:

ERROR: git command failed: ref not found

This is because the git module uses git ls-remote:

exec(sprintf('git ls-remote %s %s', escapeshellarg($repo), escapeshellarg($ref)), $output, $return);

This won't produce any output for a SHA reference, so it fails. We should find a way of handling SHA references.

@jcoglan
Copy link

jcoglan commented Jul 3, 2019

The rev-parse command interprets any kind of revision and returns a commit ID, if the object exists, for example:

$ git rev-parse origin/master
9c971bf308735afbf920743c347d99533762018b

$ git rev-parse 9c971bf308735afbf920743c347d99533762018b
9c971bf308735afbf920743c347d99533762018b

This includes the ability to expand abbreviated SHAs, e.g.:

$ git rev-parse 9c971bf3
9c971bf308735afbf920743c347d99533762018b

@RobjS
Copy link
Contributor Author

RobjS commented Jul 11, 2019

Unfortunately rev-parse only works on a repo that has already been cloned locally. I guess we're using ls-remote here because the intention is to check whether the ref exists in the remote repository before it's cloned.

So far, I'm not sure git actually has a way of letting you check for the existence of a commit ID on a remote without first cloning it. So this may not be possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants