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

Re: [PATCH] git-stash: use git rev-parse -q

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Dec 7, 2008, 23:17 UTC
Message-ID
<20081207231723.GA5068@atjola.homenet>
In-Reply-To
<1228179369-3766-1-git-send-email-vmiklos@frugalware.org>
On 2008.12.02 01:56:09 +0100, Miklos Vajna wrote:
Show 9 quoted lines
> Don't redirect stderr to /dev/null, use -q to suppress the output on
> stderr.
> 
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
>  
>  	# clear_stash if we just dropped the last stash entry
> -	git rev-parse --verify "$ref_stash@{0}" > /dev/null 2>&1 || clear_stash
> +	git rev-parse -q --verify "$ref_stash@{0}" > /dev/null || clear_stash

This one causes an error message to pop up when the last stash entry is dropped:

doener@atjola:git (master) $ echo 123 >> Makefile

doener@atjola:git (master) $ git stash Saved working directory and index state "WIP on master: 2dd6202... Update draft release notes to 1.6.1" HEAD is now at 2dd6202 Update draft release notes to 1.6.1 (To restore them type "git stash apply")

doener@atjola:git (master) $ git stash drop Dropped refs/stash@{0} (e692e43ce03fe0b5f0eb94123123ea61a0f2097a) fatal: Log .git/logs/refs/stash is empty.

git version 1.6.1.rc1.56.g2dd62

After "git stash drop" finished the rev-parse won't complain anymore, even if you recreate an empty .git/logs/refs/stash file, because .git/refs/stash is also gone, and then it doesn't seem to care anymore.

But having a valid ref and an empty log makes it unhappy:

doener@atjola:git (master) $ git rev-parse HEAD > .git/refs/stash doener@atjola:git (master) $ : > .git/logs/refs/stash doener@atjola:git (master) $ git rev-parse -q --verify 'refs/stash@{1}' fatal: Log .git/logs/refs/stash is empty.

Björn
Previous: Miklos VajnaNext: Junio C Hamano
Message 2 of 4 in “git-stash: use git rev-parse -q”
  1. git-stash: use git rev-parse -qMiklos Vajna, Dec 2, 2008
  2. Björn SteinbrinkDec 7, 2008
  3. Junio C HamanoDec 8, 2008
  4. Miklos VajnaDec 8, 2008

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.