git/list[1] front-page[2] threads[3] people[4] search[5] about
 

with git-next, git pull --rebase can print out "fatal: No such ref: ''" for branches without an upstream

From
SASiddharth Agarwal <sid0@fb.com>
Date
Jan 17, 2014, 01:08 UTC
Message-ID
<52D8827E.3060007@fb.com>

With git-next, where git pull --rebase can print out "fatal: No such ref: ''" if git pull --rebase is run on branches without an upstream.

With git at b139ac2589b15d55cd9fa5c6957da44b150d0737, the following commands demonstrate the problem:

git init repo1 cd repo1 touch a; git add a; git commit -m "a" cd .. git clone repo1 repo2 cd repo2 git config remote.origin.fetch refs/heads/master:refs/remotes/origin/master git checkout -b test git pull --rebase

This results in the following output:

fatal: No such ref: '' Current branch test is up to date.

So the pull --rebase looks like it works, but it prints out a spurious fatal error.

I've managed to bisect this down to https://github.com/gitster/git/commit/48059e405028ebf8a09c5a9aede89dfb460cce98. Looks like get_remote_merge_branch is called without arguments, and it returns an empty string. This string is passed as-is to git merge-base, which causes the error.

Next: Jeff King
Message 1 of 9 in “with git-next, git pull --rebase can print out "fatal: No such ref: ''" for branches without an upstream”
  1. Siddharth AgarwalJan 17, 2014
  2. Jeff KingJan 17, 2014
  3. Siddharth AgarwalJan 17, 2014
  4. John KeepingJan 17, 2014
  5. Siddharth AgarwalJan 17, 2014
  6. Junio C HamanoJan 17, 2014
  7. John KeepingJan 17, 2014
  8. pull: suppress error when no remoteref is foundJohn Keeping, Jan 17, 2014
  9. Junio C HamanoJan 17, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.