diff options
author | Jeff King <peff@peff.net> | 2011-08-17 22:01:15 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-18 14:08:54 -0700 |
commit | d960c47a881c613a71b1b7c8aab3a06fd91ca70a (patch) | |
tree | 507f3e910c08b707605463fb3fe197c0880eb4ef /builtin/fsck.c | |
parent | t7006: modernize calls to unset (diff) | |
download | tgif-d960c47a881c613a71b1b7c8aab3a06fd91ca70a.tar.xz |
test-lib: add helper functions for config
There are a few common tasks when working with configuration
variables in tests; this patch aims to make them a little
easier to write and less error-prone.
When setting a variable, you should typically make sure to
clean it up after the test is finished, so as not to pollute
other tests. Like:
test_when_finished 'git config --unset foo.bar' &&
git config foo.bar baz
This patch lets you just write:
test_config foo.bar baz
When clearing a variable that does not exist, git-config
will report a specific non-zero error code. Meaning that
tests which call "git config --unset" often either rely on
the prior tests having actually set it, or must use
test_might_fail. With this patch, the previous:
test_might_fail git config --unset foo.bar
becomes:
test_unconfig foo.bar
Not only is this easier to type, but it is more robust; it
will correctly detect errors from git-config besides "key
was not set".
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fsck.c')
0 files changed, 0 insertions, 0 deletions