git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Cc: Jeff King <peff@peff.net>,
	git@vger.kernel.org, "Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: git stash: status from current dir not top dir?
Date: Thu, 17 Mar 2011 12:30:48 -0700	[thread overview]
Message-ID: <7vsjul35p3.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4D824F46.70107@gmail.com> (Piotr Krukowiecki's message of "Thu, 17 Mar 2011 19:13:26 +0100")

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.

  reply	other threads:[~2011-03-17 19:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11 20:49 git stash: status from current dir not top dir? Piotr Krukowiecki
2011-03-11 22:32 ` Jeff King
2011-03-12  8:57   ` Piotr Krukowiecki
2011-03-14  7:29     ` Junio C Hamano
2011-03-14 19:45       ` Piotr Krukowiecki
2011-03-17 18:13         ` Piotr Krukowiecki
2011-03-17 19:30           ` Junio C Hamano [this message]
2011-03-19  9:24             ` Piotr Krukowiecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vsjul35p3.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=piotr.krukowiecki@gmail.com \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).