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

Re: Bug: git branch returns EXIT_SUCCESS when no branches found

From
CSChristoffer Stjernlöf <a@xkqr.org>
Date
Apr 24, 2019, 10:47 UTC
Message-ID
<871s1rissy.fsf@xkqr.org>
In-Reply-To
<xmqqmukf1yh9.fsf@gitster-ct.c.googlers.com>
Dear Junio,
Junio C Hamano (gitster@pobox.com) 2019-04-24:
> This invocation is not in line with how "git branch" subcommand is
> designed to work.

This is fair. I completely accept a "you're wielding it wrong" answer! However, your explanation sounds to me like that invocation is exactly in line with how git branch is designed to work! What might I be missing?

Junio C Hamano (gitster@pobox.com) 2019-04-24:
Show 10 quoted lines
> If you want to ask "does the tip of $DEV_BRANCH reach commit
> 'master'?", the right way would probably be to ask
>
> 	if git merge-base --is-ancestor master "$DEV_BRANCH"
> 	then
> 		echo "master is an ancestor of $DEV_BRANCH"
> 	else
> 		echo "master has commits not in $DEV_BRANCH"B
> 		git --no-pager log "master..$DEV_BRANCH" --
> 	fi

This seems like a more convenient command for my current purpose, although it's not a complete replacement for git branch. Thank you!

Sincerely yours, Christoffer

Previous: Christoffer StjernlöfNext: SZEDER Gábor
Message 5 of 6 in “Bug: git branch returns EXIT_SUCCESS when no branches found”
  1. Christoffer StjernlöfApr 24, 2019
  2. Junio C HamanoApr 24, 2019
  3. Junio C HamanoApr 24, 2019
  4. Christoffer StjernlöfApr 24, 2019
  5. Christoffer StjernlöfApr 24, 2019
  6. SZEDER GáborApr 24, 2019

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.