Page MenuHomePhabricator

fatal: couldn't find remote ref on git-review -d
Closed, InvalidPublic

Description

On running git-review -d 803371 (for change 803371) on a cloned copy of mediawiki/extensions/CheckUser, I get the following error

The following command failed with exit code 128
    "git fetch ssh://samtar@gerrit.wikimedia.org:29418/mediawiki/extensions/CheckUser refs/changes/71/803371/4"
-----------------------
fatal: couldn't find remote ref refs/changes/71/803371/4

The remotes are correct

git remote -v
origin  ssh://samtar@gerrit.wikimedia.org:29418/mediawiki/extensions/CheckUser (fetch)
origin  ssh://samtar@gerrit.wikimedia.org:29418/mediawiki/extensions/CheckUser (push)

and doing a git pull etc works as expected.. to clarify, this was also not working prior to the change being merged.

Versions etc.

  • git version 2.35.0.windows.1
  • OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

Event Timeline

803371 is a mediawiki/core change but you said you ran git-review -d 803371 in a clone of the mediawiki/extensions/CheckUser repo. That would explain such an error. Mismatched repos.

I guess you mixed up the patch number, 803371 is a core patch.

I've made this mistake myself and been confused by it many times.

hashar subscribed.

We had T38170: T38170: git-review: unclear/useless error message when using "git review -d 1234" in wrong repository.

I once wrote a patch https://review.opendev.org/#/c/222166/ to git-review in order to make it a bit more helpful when using the wrong change. The patch was straightforward but running the testsuite and having it passes was an entirely different story. It is probably quite easy to rebase it.