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
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 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 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.
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.
@telotortium can you show step-by-step instructions what we need to do?
@randomizedthinking My instructions above don't work?
@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.
~/.config/doom/*)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!
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.
Perhaps I am missing something, but why can you not just go into the
websocketrepository and manuallygit checkout main? The whole point ofstraight.elis 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.
Most helpful comment
That's the first thing I tried. But in my case, the repo was already tracking
main. The problem happens after that, when runningdoom upgrade. It complains about an issue withmaster, and won't cooperate. Doing thedoom syncroute works nicely, though.