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

Local packages named by *.git extension are handled as remote sources instead local ones. #3670

Closed
ChristophAtAdlos opened this issue Jun 19, 2017 · 4 comments · Fixed by #5026

Comments

@ChristophAtAdlos
Copy link

Do you want to request a feature or report a bug?
This is a bug report.

What is the current behavior?
In package.json:
"myBackendModule": "file:../myBackendModule.git"

C:\Git\myFrontendModule.git>yarn
yarn install v0.24.5
[1/4] Resolving packages...
error Command failed.
Exit code: 128
Command: git
Arguments: clone file:../myBackendModule.git C:\Users\christoph\AppData\Local\Yarn\cache\v1\.tmp\534d3fc1a8a74d07d486ff305cbd21f0
Directory: C:\Git\myFrontendModule.git
Output:
Cloning into 'C:\Users\christoph\AppData\Local\Yarn\cache\v1\.tmp\534d3fc1a8a74d07d486ff305cbd21f0'...
ssh: Could not resolve hostname file: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Renaming the folder to myBackendModule.got, it works. But on next checkout, it fails again, because the repos are named *.git.
If the current behavior is a bug, please provide the steps to reproduce.
Link a local package which name has git as extension.
In our enterprise, the git extension is default to show that the package comes from our git repository.

What is the expected behavior?
If the path is declared by "file" or if it's a relative path without server name, dont use the remote method but the local file access.

Please mention your node.js, yarn and operating system version.

node --version
v4.6.1
npm upgrade --global yarn
yarn --version
yarn v0.24.5

@titarta
Copy link

titarta commented Nov 10, 2017

I'm going to try to work on this issue on the next week.

@rafaeldamasceno
Copy link
Contributor

Hey, I'm also one other person that's helping with the bug. The problem seems to be with /util/git.js. However, I can't reproduce the bug in the state that the reported sent it. Now, it seems that it tries to run ls-remote first. We've since tried to fix it, but it seems we're not getting consistent results.

See here: https://github.com/rafaeldamasceno/yarn/commit/d17a77b1d8bce6e209a309ea176e6a1a9e853b70

It seems that with these changes, we now can successfully clone the repository, but there were some instances where we had some errors and we aren't quite sure how to fix them. Also, it seems that after yarn caches the repository, it doesn't quite verify if it has been updated. Maybe this is intended behaviour and it only checks for versions bumps?

We'd like some input before we submit a pull request.

rally25rs added a commit to rally25rs/yarn that referenced this issue Dec 10, 2017
Allow "git_file:" dependency protocol to use a local un-pushed git repo as a dependency. Fix bug
where local directories named "*.git" were treated as git dependencies

fixes yarnpkg#3670 yarnpkg#5017
@tiagoboldt
Copy link

Isn't this issue closed by the above PR?

@rafaeldamasceno
Copy link
Contributor

@tiagoboldt the above PR is for my own fork's branch. #5026 is still pending review for merging into master.

arcanis pushed a commit that referenced this issue Mar 1, 2018
* First step in fixing local repositories ended with .git

* Corrected comment and removed unnecessary hostname.

* Readd hostname.

* Add unit test for local .git repositories.

* Use FILE_PROTOCOL const.

* feat(resolution): When using a local git repo, use `git show-ref` instead of `ls-remote`

When using a local git repo, use `git show-ref` instead of `ls-remote` so that un-pushed refs can be
found.

fixes #5017

* Restore full path for local repositories.

* Update test to match logic.

* feat(resolution): Allow "git+file:" dependency url protocol.

Allow "git_file:" dependency protocol to use a local un-pushed git repo as a dependency. Fix bug
where local directories named "*.git" were treated as git dependencies

fixes #3670 #5017

* fix a failing test

* fix(test): Remove invalid test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants