The current script used by annotate-tests.sh (used by t8001 and t8002) fails
to emit a warning if any of the expected authors never show up in the output
or if authors that show up in the output were never specified as expected.
Update the script to fail in both of these scenarios.
Helped-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Instead of
... normal test script ...
status=$?
... cleanup ...
(exit $status)
set up cleanup commands with test_when_finished. This makes the
test script a little shorter, and more importantly, it ensures errors
during cleanup are reported.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
"git stash branch <branch> <stash>" started discarding the stash
when the branch creation fails. It should have kept the stash
intact when aborting.
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This bug was disovered by someone on IRC when he tried to
$ git stash branch <branch> <stash>
while <branch> already existed. In that case the stash is dropped even
though it isn't applied on any branch, so the stash is effectively lost.
Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The test was missing some "&&" at the end of some lines and it
was wrong because, as the replacement refs were not fetched,
the commits from the parallel branch should not show up. This
was found by Elijah Newren.
This is fixed by checking that after the branch from HASH6 is
fetched, the commits from the parallel branch don't show up,
and then by fetching the replacement refs and checking that
they do show up afterwards.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Even though "-L" is POSIX, the former is more portable, and
we tend to prefer it already.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
On systems which have dash as /bin/sh, such as Ubuntu, the final
test (master@{n} for various n) fails with a syntax error while
processing an arithmetic expansion. The syntax error is caused by
using a bare name ('N') as a variable reference in the expression.
In order to avoid the syntax error, we spell the variable reference
as '$N' rather than simply 'N'.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Currently git-stash uses `git rev-parse --no-revs -- "$@"` to set its
FLAGS variable. This is the same as `FLAGS="-- $@"`. It should use
`git rev-parse --no-revs --flags "$@"`, but that eats any "-q" or
"--quiet" argument. So move the check for quiet before rev-parse.
Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Recently, the 'stash show' functionality was broken for the case when a
stash-like argument was supplied. Since, commit 9bf09e, 'stash show' when
supplied a stash-like argument prints nothing and still exists with a zero
status. Unfortunately, the flaw slipped through the test suite cracks
since the output of 'stash show' was not verified to be correct.
Improve and expand on the existing tests so that this flaws is detected.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The merge-base between @$parents and $merge_tip may have been reached
through a merge commit. This means that some commits that are ancestors
of @$parents will not be ancestors of $merge_base. The mergeinfo
property will not list commits that are ancestors of @$parents, so we
need to explicitly exclude them.
[ew: squashed and cleaned up test case from Steven]
Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
The ancient touch on Solaris 7 thinks that a decimal number supplied as
the first argument specifies a date_time to give to the files specified by
the remaining arguments. In this case, it fails to parse '1' as a proper
date_time and exits with a failure status. Workaround this flaw by
rearranging the arguments supplied to touch so that a non-digit appears
first and touch will not be confused.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* jl/fix-test:
t1020: Get rid of 'cd "$HERE"' at the start of each test
t2016 (checkout -p): add missing &&
t1302 (core.repositoryversion): style tweaks
t2105 (gitfile): add missing &&
t1450 (fsck): remove dangling objects
tests: subshell indentation stylefix
Several tests: cd inside subshell instead of around
t7003-filter-branch.sh had a make_commit() function that was identical
to test_commit() in test-lib.sh except that it used tr to create a
lowercase file name from the uppercase branch name instead of
appending ".t".
Not only is this unneeded code duplication, it also was something
simply waiting to fail on case-insensitive file systems. So replace
all uses of make_commit with test_commit.
While we're editing the setup, chain it together with && so that
failures early in the sequence don't get lost and add a commit graph.
Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When applying two pathspecs, one of which is named as a prefix to the
other, we mistakenly recursed into the shorter one.
Noticed and fixed by David Reis.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previously (e3bf5e43), a test was added to test whether the builtin
xfuncname regular expressions could be compiled without error by regcomp.
Let's do the same for the word_regex patterns. This should help catch any
cross-platform incompatibilities that exist between the pattern creator's
system and the various platforms that the test suite is commonly run on.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commit 6106ce46 introduced a test to demonstrate fetch's failure to
retrieve any objects or update FETCH_HEAD when it was supplied a repository
URL and the current branch had a configured merge spec. This commit
expands the original test based on comments from Junio Hamano. In addition
to actually verifying that the fetch updates FETCH_HEAD correctly, and does
not update the current branch, two more tests are added to ensure that the
merge configuration is ignored even when the supplied URL matches the URL
of the remote configured for the branch.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
On IRIX 6.5, the printf utility in /usr/bin does not appear to handle the
\ddd notation according to POSIX. This printf appears to halt processing
of the string argument and ignore any additional characters in the string.
Work around this flaw by replacing the \000's with 'Q' and using the
q_to_nul helper function provided by test-lib.sh
This problem with printf is not apparent when using the Bash shell since
Bash implements a POSIX compatible printf function internally.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
To achieve that, all cd commands which weren't inside a subshell had to
be put into a new one.
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Although the set_state command is not likely to fail, it is best to
stay in the habit of checking for failures.
Cc: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This test is from 2007, which is late enough for the style to be
recognizably modern but still a while ago. Freshen it up to
follow new best practices:
- guard setup commands with test_expect_setup, so errors at
that stage can be caught;
- use <<\EOF in preference to <<EOF, to save reviewers the
trouble of looking for variable interpolations;
- use test_cmp instead of test "$foo" = "$bar", for better
output with -v on failure;
- indent commands in subshells and let them span multiple lines;
- combine the two "gitdir required mode" tests that do not make
as much sense alone.
Cc: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Make sure early failures are not masked by later successes.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The fsck test is generally careful to remove the corrupt objects
it inserts, but dangling objects are left behind due to some typos
and omissions. It is better to clean up more completely, to
simplify the addition of later tests. So:
- guard setup and cleanup with test_expect_success to catch
typos and errors;
- check both stdout and stderr when checking for empty fsck
output;
- use test_cmp empty file in place of test $(wc -l <file) = 0,
for better debugging output when running tests with -v;
- add a remove_object () helper and use it to replace broken
object removal code that forgot about the fanout in
.git/objects;
- disable gc.auto, to avoid tripping up object removal if the
number of objects ever reaches that threshold.
- use test_when_finished to ensure cleanup tasks are run and
succeed when tests fail;
- add a new final test that no breakage or dangling objects
was left behind.
While at it, add a brief description to test_description of the
history that is expected to persist between tests.
Part of a campaign to clean up subshell usage in tests.
Cc: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Format the subshells introduced by the previous patch (Several tests:
cd inside subshell instead of around, 2010-09-06) like so:
(
cd subdir &&
...
) &&
This is generally easier to read and has the nice side-effect that
this patch will show what commands are used in the subshell, making
it easier to check for lost environment variables and similar
behavior changes.
Cc: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* jk/test-must-fail-missing:
tests: make test_might_fail fail on missing commands
tests: make test_might_fail more verbose
tests: make test_must_fail fail on missing commands
tests: make test_must_fail more verbose
* bc/maint-fetch-url-only:
builtin/fetch.c: ignore merge config when not fetching from branch's remote
t/t5510: demonstrate failure to fetch when current branch has merge ref
Fixed all places where it was a straightforward change from cd'ing into a
directory and back via "cd .." to a cd inside a subshell.
Found these places with "git grep -w "cd \.\.".
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fixed all places where it was a straightforward change from cd'ing into a
directory and back via "cd .." to a cd inside a subshell.
Found these places with "git grep -w "cd \.\.".
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* jl/submodule-ignore-diff:
checkout: Use submodule.*.ignore settings from .git/config and .gitmodules
checkout: Add test for diff.ignoreSubmodules
checkout: respect diff.ignoreSubmodules setting
Conflicts:
builtin/checkout.c
* ab/test-2: (51 commits)
tests: factor HOME=$(pwd) in test-lib.sh
test-lib: use subshell instead of cd $new && .. && cd $old
tests: simplify "missing PREREQ" message
t/t0000-basic.sh: Run the passing TODO test inside its own test-lib
test-lib: Allow overriding of TEST_DIRECTORY
test-lib: Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY"/../
test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../
test: Introduce $GIT_BUILD_DIR
cvs tests: do not touch test CVS repositories shipped with source
t/t9602-cvsimport-branches-tags.sh: Add a PERL prerequisite
t/t9601-cvsimport-vendor-branch.sh: Add a PERL prerequisite
t/t7105-reset-patch.sh: Add a PERL prerequisite
t/t9001-send-email.sh: convert setup code to tests
t/t9001-send-email.sh: change from skip_all=* to prereq skip
t/t9001-send-email.sh: Remove needless PROG=* assignment
t/t9600-cvsimport.sh: change from skip_all=* to prereq skip
lib-patch-mode tests: change from skip_all=* to prereq skip
t/t3701-add-interactive.sh: change from skip_all=* to prereq skip
tests: Move FILEMODE prerequisite to lib-prereq-FILEMODE.sh
t/Makefile: Create test-results dir for smoke target
...
Conflicts:
t/t6035-merge-dir-to-symlink.sh
* js/maint-reflog-beyond-horizon:
t1503: fix broken test_must_fail calls
rev-parse: tests git rev-parse --verify master@{n}, for various n
sha1_name.c: use warning in preference to fprintf(stderr
rev-parse: exit with non-zero status if ref@{n} is not valid.