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

[PATCH] pull: suppress error when no remoteref is found

From
John Keeping <john@keeping.me.uk>
Date
Jan 17, 2014, 20:00 UTC
Message-ID
<509ac5f3245546def79575174c52de2d0416fe24.1389988820.git.john@keeping.me.uk>
In-Reply-To
<20140117192619.GP7608@serenity.lan>

Commit 48059e4 (pull: use merge-base --fork-point when appropriate, 2013-12-08) incorrectly assumes that get_remote_merge_branch will either yield a non-empty string or return an error, but there are circumstances where it will yield an empty string.

The previous code then invoked git-rev-list with no arguments, which results in an error suppressed by redirecting stderr to /dev/null. Now we invoke git-merge-base with an empty branch name, which also results in an error. Suppress this in the same way.

Signed-off-by: John Keeping <john@keeping.me.uk>
---
 git-pull.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-pull.sh b/git-pull.sh
index f210d0a..0a5aa2c 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -229,7 +229,7 @@ test true = "$rebase" && {
 	test -n "$curr_branch" &&
 	. git-parse-remote &&
 	remoteref="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
-	oldremoteref=$(git merge-base --fork-point "$remoteref" $curr_branch)
+	oldremoteref=$(git merge-base --fork-point "$remoteref" $curr_branch 2>/dev/null)
 }
 orig_head=$(git rev-parse -q --verify HEAD)
 git fetch $verbosity $progress $dry_run $recurse_submodules --update-head-ok "$@" || exit 1
-- 
1.8.5.226.g0d60d77
Previous: John KeepingNext: Junio C Hamano
Message 8 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.