bwroga
bwroga

Reputation: 5459

Local dependency with git commit

In my stack.yaml file, I want to add a dependency to a package located on my computer.

I can do it like this:

- location : ../Bwroga
  extra-dep: true

Is it possible to also specify a commit? I know I can do this if the package is hosted on github or bitbucket, but I want to keep the dependency on my computer.

I tried:

- location :
    git: ../Bwroga
    commit: 039bd43313803a88c990af3ddcd6d75419ab44a1
  extra-dep: true

- location :
    git: ../Bwroga/bwroga.git
    commit: 039bd43313803a88c990af3ddcd6d75419ab44a1
  extra-dep: true

but got errors stating that the repository does not exist.

I also tried:

- location: ../Bwroga
  commit: 039bd43313803a88c990af3ddcd6d75419ab44a1
  extra-dep: true

It compiled, but said that the commit field was unrecognized.

Upvotes: 3

Views: 302

Answers (1)

Michael Snoyman
Michael Snoyman

Reputation: 31335

Side note: it would be a good idea to include the error messages you receive in the future.

I just checked this myself, and I can see why it doesn't work. When cloning the target repo, Stack will change into a new temporary directory first. Then, the relative path in the stack.yaml file is no longer valid. If you want, you can work around this using an absolute path in the stack.yaml file.

In theory we could add support to Stack to detect that a relative path to a repo has been given and convert it into an absolute path. But I think the use case would need to be worked out more fully to justify such a change. I believe most commonly the approach you're describing is handled via Git submodules.

Upvotes: 1

Related Questions