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

about rev-parse's quietness

From
stefan.naewe@atlas-elektronik.com <stefan.naewe@atlas-elektronik.com>
Date
Oct 15, 2015, 10:26 UTC
Message-ID
<561F7F5A.4060708@atlas-elektronik.com>
Hello there.

I'm using a bash function that does a combination of 'ls -l', 'git status', and 'git branch' to give me a quick overview of where I stand in the current git repo.

I planned to extend that function to also list the to-be-pushed commits in the current branch, something like

$ git log --oneline --abbrev-commit --decorate @{u}..

But I don't want to run that 'git log...' if there's no upstream configured for HEAD (and I don't want to see any error!)

OK. That's a task for 'git rev-parse' I thought:
$ up=$(git rev-parse --verify --quiet @{u}) &&
  git log --left-right --oneline --abbrev-commit --decorate $up
fatal: no upstream configured for branch 'master'
Wait. What?

I thought rev-parse with '--verify' and '--quiet' is just that - quiet - in case "...the first argument is not a valid object name" ?

Let's see: $ git rev-parse --verify --quiet master@{xyz} || echo No No

$ git rev-parse --verify --quiet master@{u} || echo No fatal: no upstream configured for branch 'master' No

I don't want to see that error (and I know I could just redirect stdout/stderr to /dev/null ...)
So: Are my expectations about 'rev-parse --verify --quiet' wrong or am I doing
something stupid ?
Thanks,
  Stefan
-- 
----------------------------------------------------------------
/dev/random says: Disclaimer: Written by a highly caffeinated mammal.
python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')" 
GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9  9666 829B 49C5 9221 27AF
Next: Junio C Hamano
Message 1 of 2 in “about rev-parse's quietness”
  1. stefan.naewe@atlas-elektronik.comOct 15, 2015
  2. Junio C HamanoOct 15, 2015

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.