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

Warning: repos that have renamed "master" branch to "main" must be fixed manually on doom update or doom upgrade #3435

Closed
telotortium opened this issue Jun 22, 2020 · 12 comments
Labels
is:upstream Originates from outside the project and cannot be fully addressed here re:packages Pertains to package & dependency management re:straight To do with straight; our package manager stale No response, forgotten, or abandoned wontfix This will not be worked on

Comments

@telotortium
Copy link
Contributor

telotortium commented Jun 22, 2020

doom upgrade (and I presume doom update) aborts if upstream has changed the default branch name (for example, from master to main). Example failure:

$ doom -d upgrade -p
...
> (280/288) Fetching websocket...nil
x There was an unexpected error:
  Type: doom-package-error
  Message:
    Error with packages
  Data:
    "websocket"
    (error "Failed to run \"git\"; see buffer *straight-process*")
  Straight output:
    fatal: couldn't find remote ref refs/heads/master

This is because https://github.com/ahyatt/emacs-websocket has renamed their "master" branch to "main". Git doesn't handle this situation automatically if you've already cloned a local copy. It can be fixed with instructions from the aforementioned article:

$ git checkout master
$ git branch -m master main
$ git fetch
$ git branch --unset-upstream
$ git branch -u origin/main
$ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
@telotortium telotortium added the is:bug Something isn't working as intended label Jun 22, 2020
@hlissner
Copy link
Member

hlissner commented Jun 22, 2020

This should probably be reported upstream to straight. It defaults to cloning master in the absence of an explicit branch. Though, I suspect no good, general solution for this exists.

Neither Doom nor straight is able to guess what a (remote) repo's main branch is, or whether the current branch was necessarily renamed to main or some other arbitrary name.

Perhaps melpa should update it's recipes to include branch names.

@hlissner hlissner added is:upstream Originates from outside the project and cannot be fully addressed here re:packages Pertains to package & dependency management re:straight To do with straight; our package manager wontfix This will not be worked on and removed is:bug Something isn't working as intended labels Jun 22, 2020
@jcf
Copy link
Contributor

jcf commented Jun 22, 2020

@hlissner I've taken the liberty of opening a couple of issues. One over in the emacs-websocket repo where I think it'd be considerate to let people know about the breaking change, and one over in the straight.el repo.

@raxod502
Copy link

A permanent solution to this problem has been discussed already. Some nontrivial work is required, but I do not think the problem is insurmountable in principle.

@randomizedthinking
Copy link
Contributor

@telotortium can you show step-by-step instructions what we need to do?

@telotortium
Copy link
Contributor Author

@randomizedthinking My instructions above don't work?

@randomizedthinking
Copy link
Contributor

randomizedthinking commented Jun 22, 2020

@telotortium To me, websocket is a package in the middle. After running your commands inside .emacs.d/.local/straight/repos/emacs-websocket, I still stuck with doom update: I would like to update the rest of the packages after websocket, but it won't work.

Update: I didn't do anything and doom update now works. Thank all upstream maintainers for making it happen.

@panchoh
Copy link
Contributor

panchoh commented Jun 23, 2020

Workaround (CAVEAT EMPTOR: with full rebuild)

Assumptions:

  • You already have a working set of config files (e.g.: ~/.config/doom/*)

Workaround proper

EMACSDIR="~/.emacs.d" # Ensure this is accurate!
mv -iv "$EMACSDIR" "$EMACSDIR".bck
git clone --depth 1 https://github.com/hlissner/doom-emacs.git "$EMACSDIR"
"$EMACSDIR"/bin/doom sync

doom sync will emit a warning:

    → Building ein → Cloning emacs-websocket...

Warning (straight): Could not check out branch "master" of repository "emacs-websocket"
    → Building ein → Cloning emacs-websocket...done

... but will compile it anyway:

$ ls -l ~/.emacs.d/.local/straight/build/websocket/
total 68
lrwxrwxrwx 1 pancho pancho    72 Jun 23 07:04 websocket.el -> /home/pancho/.emacs.d/.local/straight/repos/emacs-websocket/websocket.el
-rw-r--r-- 1 pancho pancho 62441 Jun 23 07:04 websocket.elc

Hope that it helps!

@raxod502
Copy link

Perhaps I am missing something, but why can you not just go into the websocket repository and manually git checkout main? The whole point of straight.el is that you can always do stuff manually if the package manager is not smart enough.

@panchoh
Copy link
Contributor

panchoh commented Jun 23, 2020

Perhaps I am missing something, but why can you not just go into the websocket repository and manually git checkout main? The whole point of straight.el is that you can always do stuff manually if the package manager is not smart enough.

That's the first thing I tried. But in my case, the repo was already tracking main. The problem happens after that, when running doom upgrade. It complains about an issue with master, and won't cooperate. Doing the doom sync route works nicely, though.

@imsodin
Copy link

imsodin commented Apr 25, 2021

I got these kind of errors also when cleaning out repos to start from scratch due to init.defaultBranch. I fixed that issue upstream: radian-software/straight.el#739
I'd appreciate if the pin could be bumped to that :)

@github-actions
Copy link

This issue has been automatically marked stale because of a lack of recent activity. If this issue is still valid, reply to it or remove the label or it will be closed in 7 days.

@github-actions github-actions bot added the stale No response, forgotten, or abandoned label Aug 24, 2021
@yeldiRium
Copy link

Stalebot strikes once again and closes a relevant and unresolved issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
is:upstream Originates from outside the project and cannot be fully addressed here re:packages Pertains to package & dependency management re:straight To do with straight; our package manager stale No response, forgotten, or abandoned wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

8 participants