best icon indicating copy to clipboard operation
best copied to clipboard

Local best cli runs on master but no other branches for lwc-example

Open manuel-jasso opened this issue 4 years ago • 8 comments

Summary

I first identified this problem in the Locker repo, but I was able to reproduce it in the Best repo itself.

After checking out the Best repo and building, I did cd packages/lwc-example and ran yarn start and the tests ran fine. The current branch was master.

But when I created a branch foo (from master) and switched, running yarn start yields:

Looking for Best configurations...fatal: No remote configured to list refs from.

[WARN] - Unable to get git information

  ERROR     Error: Unable to read git information
    at generateProjectConfigs (/Users/manuel.jasso/dev/github/best/packages/@best/config/build/index.js:16:19)
    at readConfig (/Users/manuel.jasso/dev/github/best/packages/@best/config/build/index.js:76:45)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Simply switching back to master and running yarn start again, the tests run fine.

This seems to be related to #184

Versions

  • node: 12.16.1
  • best: 4.0.0-beta5

manuel-jasso avatar Jun 09 '20 21:06 manuel-jasso

Update: it looks like the name of the local branch doesn't matter, I changed my foo branch to track github/master and then yarn start worked fine! 🤷🏻‍♂️

This is my setup:

manuel.jasso@manueljasso-ltm ~/dev/github/best/packages/lwc-example (foo)
$ git branch -vv
* foo    0c1ef01 [github/master] feat: rewrite of Agents, Hubs, Remotes and Algo (#217)
  master 0c1ef01 [github/master] feat: rewrite of Agents, Hubs, Remotes and Algo (#217)

So best cli fails unless the current branch is tracking master on the remote.

manuel-jasso avatar Jun 09 '20 21:06 manuel-jasso

I can't seem to reproduce this, when I try to run the lwc-example benchmarks it works fine.

I tried both in master and in a brand new branch that i just created, both worked fine.

Could there be something weird in your git config or setup? It seems that Best cannot read your git configurations properly.

jasonsilberman avatar Jun 09 '20 23:06 jasonsilberman

I tried a fresh checkout of best repo and the condition is that the current branch has to be tracking something that is not [origin/master], this is my fresh setup (do this while on master):

git branch --track bad
git branch good
git branch -vv
  bad    0c1ef01 [master] feat: rewrite of Agents, Hubs, Remotes and Algo (#217)
* good   0c1ef01 feat: rewrite of Agents, Hubs, Remotes and Algo (#217)
  master 0c1ef01 [origin/master] feat: rewrite of Agents, Hubs, Remotes and Algo (#217)

best runs fine on branch good (which tracks nothing) and branch master (which tracks [origin/master]) but fails on branch bad (which tracks [master])

manuel-jasso avatar Jun 09 '20 23:06 manuel-jasso

But given the conditions, this is a low priority issue because there is a workaround.

manuel-jasso avatar Jun 10 '20 00:06 manuel-jasso

Are you saying that the issue only happens when you have multiple local branches pointing to the same remote master?

jasonsilberman avatar Jun 23 '20 21:06 jasonsilberman

Mh, no, even one branch causes the error, I just pulled new master from best and these are the simplest repro steps I was able to come up with:

Do this while on master (after a fresh build):

git branch --track bad
git checkout bad
cd packages/lwc-example/
yarn start

This yields

Looking for Best configurations...[WARN] - Unable to get git information

  ERROR     Error: Unable to read git information
    at generateProjectConfigs (/Users/manuel.jasso/dev/github/best/packages/@best/config/build/index.js:17:19)
    at readConfig (/Users/manuel.jasso/dev/github/best/packages/@best/config/build/index.js:77:45)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

manuel-jasso avatar Jun 24 '20 20:06 manuel-jasso

I was able to reproduce as well. I think I am understanding this better now.

So this is happening when you create a local branch that tracks another local branch.

I am un-aware if this is very common behavior or not, as I have never needed to do this. I will see what I can do to figure out a fix though.

jasonsilberman avatar Jun 24 '20 23:06 jasonsilberman

Thanks, I know tracking a local branch makes no sense, this was just my simplest repro steps, I saw this error without tracking a local branch but I don't remember what I did, my hope is that the scenario will help you identify a problem which is not specific or related to tracking local branches. And like I said before, there is a workaround so this is not a high priority.

manuel-jasso avatar Jun 25 '20 00:06 manuel-jasso