Skip to content

Failed doom upgrade - fatal: the requested upstream branch 'origin/melpa' does not exist #8003

@wchmb

Description

@wchmb

I confirm that...

  • I have searched the issue tracker, documentation, FAQ, Discourse, and Google, in case this issue has already been reported/resolved.
  • I have read "How to Debug Issues", and will use it to provide as much information about this issue as possible.
  • The issue can be reproduced on the latest available commit of Doom.
  • The issue can be reproduced on a stable release of Emacs, such as 27, 28, or 29. (Unstable versions end in .50, .60, or .9x)

Expected behavior

To upgrade my Doom as usual

Current behavior

When I upgrade Doom I see this error message:

fatal: the requested upstream branch 'origin/melpa' does not exist

$ doom upgrade
> Preparing to upgrade Doom Emacs and its packages...
✓ Doom is already up-to-date!
Doom is up-to-date!
- Using Emacs 29.4 @ /usr/bin/emacs
> Synchronizing "default" profile...
  > Ensuring packages are installed and built...
    - No packages need attention
  > Updating all packages (this may take a while)...
    x The package manager threw an error
    x Last 16 lines of straight's error log:
      $ git rev-parse --verify melpa
      fatal: Needed a single revision
      [Return code: 128]
      $ cd /home/abm/.config/emacs/.local/straight/repos/with-editor/
      $ git branch --track -- melpa origin/melpa
      fatal: the requested upstream branch 'origin/melpa' does not exist
      hint:
      hint: If you are planning on basing your work on an upstream
      hint: branch that already exists at the remote, you may need to
      hint: run "git fetch" to retrieve it.
      hint:
      hint: If you are planning to push out a new local branch that
      hint: will track its remote counterpart, you may want to use
      hint: "git push -u" to set the upstream config as you push.
      hint: Disable this message with "git config advice.setUpstreamFailure false"
      [Return code: 128]
    ! Wrote extended straight log to ~/.config/emacs/.local/state/logs/cli.doom.240819190308.934120.error
    ! Script was abruptly aborted, leaving Doom in an incomplete state!
    - Run 'doom sync' to repair it.

At the end of the error log (~/.config/emacs/.local/state/logs/cli.doom.240819190308.934120.error) I discovered the cause of the problem:
command git rev-parse --verify melpa throws an weird error. But not so weird as we'll see later

$ git rev-parse --verify melpa

fatal: Needed a single revision

[Return code: 128]

$ cd /home/abm/.config/emacs/.local/straight/repos/with-editor/
$ git branch --track -- melpa origin/melpa

fatal: the requested upstream branch 'origin/melpa' does not exist
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
hint: Disable this message with "git config advice.setUpstreamFailure false"

The thing is that listing remotes for the package is getting this

$ git fetch origin
$ git branch -r
  origin/HEAD -> origin/main
  origin/main

and the reason I cannot pull the melpa branch is this:

$ git config --get remote.origin.fetch
+refs/heads/main:refs/remotes/origin/main

Yayy, remote was set to fetch the main branch and only
I'd never be able to pull it with this configuration.

Solution was to simply set to fech ANY under origin

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"

I've identified this happens when checking out melpa branches for 2 packages:
https://github.com/magit/with-editor
https://github.com/magit/transient

I've also checked that melpa branch was created very recently for both packages

Steps to reproduce

  1. doom upgrade

System Information

https://gist.github.com/wchmb/a6029b4b676fe0eeb8e177f4f453f981

Metadata

Metadata

Assignees

No one assigned

    Labels

    faqComes up frequently, and is likely answered in the FAQ (or should be)is:upstreamOriginates from outside the project and cannot be fully addressed heremodule:core:cliPertains to the `$ doom` scriptmodule:tools/magitPertains to Doom's :tools magit modulere:straightTo do with straight; our package manager

    Type

    No type

    Projects

    Status

    In progress

    Status

    Resolved

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions