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

git error when running yarnhook #39

Open
the21st opened this issue May 21, 2020 · 1 comment
Open

git error when running yarnhook #39

the21st opened this issue May 21, 2020 · 1 comment

Comments

@the21st
Copy link

the21st commented May 21, 2020

I cloned a project that uses yarnhook, changed a file, and then ran git checkout on that file. yarnhook got triggered, but it failed with this output:

<path_to_project>/node_modules/.bin/yarnhook
<path_to_project>/node_modules/yarnhook/node_modules/execa/index.js:303

                throw (result.error || new Error(result.stderr === '' ? result.stdout : result.stderr));
                ^
Error: fatal: Log for 'HEAD' only has 1 entries.
    at Function.module.exports.sync (<path_to_project>/node_modules/yarnhook/node_modules/execa/index.js:303:26)
    at Object.<anonymous> (<path_to_project>/node_modules/yarnhook/index.js:58:38)
    at Module._compile (internal/modules/cjs/loader.js:1147:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
    at Module.load (internal/modules/cjs/loader.js:996:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
error Command failed with exit code 1.

Tried googling but found nothing. Any advice?

@frontsideair
Copy link
Owner

Hi, thanks for reporting this issue. I'm working again on this project and would like to solve your problem.

The problem seems to be that your use of checkout is not a branch-changing one but yarnhook gets triggered anyway. Since theres's no git hook solely for pulls and branch changes we try to react to this with 3 different git hooks. I'll work a bit more on detecting branch changes and nothing else.

This probably wouldn't be an issue if you changed a branch at least once, in which case reflog for HEAD would have at least two entries. Thanks for catching an edge case.

I'll either rename this issue or close this one to create a blanket issue for the general problem.

@frontsideair frontsideair mentioned this issue Oct 16, 2020
16 tasks
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