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

Re: git stash: status from current dir not top dir?

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 17, 2011, 19:30 UTC
Message-ID
<7vsjul35p3.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4D824F46.70107@gmail.com>
Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:
> Now I don't know how should I handle this:
>
>     1. unset it just before "git stash apply" in my test
>        A safe, local change

This is the preferred method; in addition to "a safe local", more importantly, at that point you are testing what you _want_ to be testing, namely, how the output appears to the _real_ end users who do not use verbose message. So for that purpose, mucking locally with MERGE_VERBOSITY is perfectly acceptable.

You would not just "unset it just before", but "unset around it" in a subshell like this:

	git stash &&
	(
		sane_unset GIT_MERGE_VERBOSITY &&
	        git stash apply
	) >../actual &&
	git status >../expect &&
        test_cmp ../expect ../actual

so that if somebody adds new tests later in the script, they are not affected by this change.

Write your test_cmp always to compare expected with actual, not the other way around, so that the diff output you see when the test is run under -v option shows the changes from what is expected.

Thanks.
Previous: Piotr KrukowieckiNext: Piotr Krukowiecki
Message 7 of 8 in “git stash: status from current dir not top dir?”
  1. Piotr KrukowieckiMar 11, 2011
  2. Jeff KingMar 11, 2011
  3. Piotr KrukowieckiMar 12, 2011
  4. Junio C HamanoMar 14, 2011
  5. Piotr KrukowieckiMar 14, 2011
  6. Piotr KrukowieckiMar 17, 2011
  7. Junio C HamanoMar 17, 2011
  8. Piotr KrukowieckiMar 19, 2011

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.