summaryrefslogtreecommitdiff
path: root/t
AgeCommit message (Collapse)AuthorFilesLines
2010-11-09t4124 (apply --whitespace): use test_might_failLibravatar Jonathan Nieder1-3/+2
Use test_might_fail instead of ignoring the exit status from git config --unset, and let the exit status propagate past rm -f (which does not fail on ENOENT). Otherwise bugs that lead git config to crash would not be detected when this test runs. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09t3404: do not use 'describe' to implement test_cmp_revLibravatar Junio C Hamano1-2/+2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09t3404 (rebase -i): introduce helper to check position of HEADLibravatar Jonathan Nieder1-15/+9
The same code to check the position of HEAD is used by several tests in this script. Factor it out as a function and simplify it. Noticed using an &&-chaining tester, because the current code does not propagate the precise exit status from errors. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09t3404 (rebase -i): move comment to descriptionLibravatar Jonathan Nieder1-18/+17
Add a comment describing the setup in t3404 to its --help output. This should make it easier to decide where to put new functions without disrupting the flow of the file or obstructing the description of the test setup. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09t3404 (rebase -i): unroll test_commit loopsLibravatar Jonathan Nieder1-12/+11
Allow test_commit failures in loop iterations before the last one to cause the test assertion to fail. More importantly, avoiding these loops makes the test a little simpler to read and decreases the vertical screen footprint of the setup test assertion by one line. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09t3301 (notes): use test_expect_code for clarityLibravatar Jonathan Nieder1-1/+1
Use the test_expect_code helper instead of open-coding it. The main behavior change is to print the command and actual exit status when the test fails. More importantly, this would make it easier to add commands before "git notes show" as part of the same test assertion if needed. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09t1400 (update-ref): use test_must_failLibravatar Jonathan Nieder1-3/+2
As t/README explains: When a gitcommand dies due to a segfault, test_must_fail diagnoses it as an error; "! git <command>" treats it as just another expected failure, which would let such a bug go unnoticed. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09t1502 (rev-parse --parseopt): test exit code from "-h"Libravatar Jonathan Nieder1-1/+1
rev-parse --parseopt exits with code 129 (usage error) when asked to dump usage with -h on behalf of another command. Scripts can take advantage of this to avoid trying to parse usage information as though it were the regular output from some git command. Noticed with an &&-chaining tester. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09t6022 (renaming merge): chain test commands with &&Libravatar Jonathan Nieder1-190/+92
Using 'return' in an attempt to end a test assertion can have unpredictable results (probably escaping from test_run_ and breaking its bookkeeping). Redo the control flow using helpers like test_expect_code and git diff --exit-code, so each test assertion can follow the usual form command that should succeed && command that should succeed && command that should succeed && ... Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09test-lib: introduce test_line_count to measure filesLibravatar Jonathan Nieder2-0/+26
Some tests check their output with code like the following: test "$(git ls-files -u B | wc -l)" -eq 3 || { echo "BAD: should have left stages for B" return 1 } The verbose failure condition is used because test, unlike diff, does not print any useful information about the nature of the failure when it fails. Introduce a test_line_count function to help. If used like git ls-files -u B >output && test_line_count -eq 3 output it will produce output like test_line_count: line count for output !-eq 3 100644 b023018cabc396e7692c70bbf5784a93d3f738ab 2 hi.c 100644 45b983be36b73c0788dc9cbcb76cbb80fc7bb057 3 hi.c on failure. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09tests: add missing &&, batch 2Libravatar Jonathan Nieder13-48/+48
Same rules as before: this patch only adds " &&" to the end of some lines in the test suite. Intended to be applied on top of or squashed with the last batch if they look okay. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09tests: add missing &&Libravatar Jonathan Nieder84-166/+166
Breaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain. Commands intended to fail should be marked with !, test_must_fail, or test_might_fail. The examples in this patch do not require that. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06Introduce sane_unset and use it to ensure proper && chainingLibravatar Elijah Newren5-29/+37
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06t7800 (difftool): add missing &&Libravatar Elijah Newren1-6/+6
Also remove a call to 'git config --unset difftool.prompt', since that is already unset by restore_test_defaults. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06t7601 (merge-pull-config): add missing &&Libravatar Elijah Newren1-6/+6
Also prefix several relevant git merge commands with 'test_must_fail' to keep the tests passing. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06t7001 (mv): add missing &&Libravatar Elijah Newren1-1/+1
Also, prefix an expected-to-fail git mv command with 'test_must_fail'. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06t6016 (rev-list-graph-simplify-history): add missing &&Libravatar Elijah Newren1-19/+10
Also move repeated tag and branch deletions into a separate setup test, to avoid failures from tags and branches having already been deleted. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06t5602 (clone-remote-exec): add missing &&Libravatar Elijah Newren1-7/+15
Also add a couple test_must_fail invocations where needed, and avoid one-shot environment variable export and function calls. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06t4026 (color): remove unneeded and unchained commandLibravatar Elijah Newren1-1/+0
Ever since 8b12413 (color: allow multiple attributes 2010-02-27), diff.color.new has been unused in t4026, so also remove the final unsetting of that value to make the third to last test pass with appropriate '&&' chaining. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Acked-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06t4019 (diff-wserror): add lots of missing &&Libravatar Elijah Newren1-26/+27
Also add test_might_fail in front of the git_config --unset commands that may be trying to unset a value that never got set (due to a previous failing test) or that were already unset. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06t4202 (log): Replace '<git-command> || :' with test_might_failLibravatar Elijah Newren1-1/+1
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06t4002 (diff-basic): use test_might_fail for commands that might failLibravatar Elijah Newren1-6/+6
Also replace '|| return 1' by '&&' to allow chain of operations to be checked for proper return status, and modify the update-index command as suggested by Jonathan Nieder to not exit early but try to make sure files that match the work tree are marked as matching. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06t100[12] (read-tree-m-2way, read_tree_m_u_2way): add missing &&Libravatar Elijah Newren2-14/+14
Also, replace "|| return 1" with "&&" in order to keep commands chained. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06t4017 (diff-retval): replace manual exit code check with test_expect_codeLibravatar Elijah Newren1-49/+20
This commit takes advantage of Ævar Arnfjörð Bjarmason's recent change to test_expect_code (test-lib: make test_expect_code a test command) to simplify several testcases. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06test-lib: make test_expect_code a test commandLibravatar Ævar Arnfjörð Bjarmason5-38/+82
Change test_expect_code to be a normal test command instead of a top-level command. As a top-level command it would fail in cases like: test_expect_code 1 'phoney' ' foo && bar && (exit 1) ' Here the test might incorrectly succeed if "foo" or "bar" happened to fail with exit status 1. Instead we now do: test_expect_success 'phoney' ' foo && bar && test_expect_code 1 "(exit 1)" ' Which will only succeed if "foo" and "bar" return status 0, and "(exit 1)" returns status 1. Note that test_expect_code has been made slightly noisier, as it reports the exit code it receives even upon success. Some test code in t0000-basic.sh relied on the old semantics of test_expect_code to test the test_when_finished command. I've converted that code to use an external test similar to the TODO test I added in v1.7.3-rc0~2^2~3. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-05Merge early part of git-svn into maintLibravatar Junio C Hamano1-0/+50
* commit 'git-svn/master~1': git-svn: fix processing of decorated commit hashes git-svn: check_cherry_pick should exclude commits already in our history Documentation/git-svn: discourage "noMetadata"
2010-10-03t3020 (ls-files-error-unmatch): remove stray '1' from end of fileLibravatar Elijah Newren1-1/+0
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-30t0004 (unwritable files): simplify error handlingLibravatar Jonathan Nieder1-38/+14
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>
2010-09-29stash: fix git stash branch regression when branch creation failsLibravatar Jon Seymour1-1/+1
"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>
2010-09-29stash drops the stash even if creating the branch fails because it already ↵Libravatar Tomas Carnecky1-0/+11
exists 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>
2010-09-27t6050 (replace): fix bogus "fetch branch with replacement" testLibravatar Christian Couder1-3/+10
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>
2010-09-27prefer test -h over test -L in shell scriptsLibravatar Jeff King2-4/+4
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>
2010-09-27t1503: Fix arithmetic expansion syntax error when using dashLibravatar Ramsay Jones1-2/+2
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>
2010-09-26git-stash: fix flag parsingLibravatar Brian Gernhardt1-4/+4
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>
2010-09-26t/t3903-stash: improve testing of git-stash showLibravatar Brandon Casey1-4/+58
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>
2010-09-24git-svn: check_cherry_pick should exclude commits already in our historyLibravatar Steven Walter1-0/+50
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>
2010-09-17t/t7300: workaround ancient touch by rearranging argumentsLibravatar Brandon Casey1-1/+1
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>
2010-09-16Merge branch 'bg/fix-t7003'Libravatar Junio C Hamano1-38/+41
* bg/fix-t7003: t7003: Use test_commit instead of custom function
2010-09-15Merge branch 'dr/maint-ls-tree-prefix-recursion-fix'Libravatar Junio C Hamano1-0/+9
* dr/maint-ls-tree-prefix-recursion-fix: ls-tree $di $dir: do not mistakenly recurse into directories
2010-09-15Merge branch 'jl/fix-test'Libravatar Junio C Hamano35-491/+604
* 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
2010-09-15Merge branch 'ch/filter-branch-deprecate-remap-to-ancestor'Libravatar Junio C Hamano1-0/+18
* ch/filter-branch-deprecate-remap-to-ancestor: filter-branch: retire --remap-to-ancestor
2010-09-15Merge branch 'ch/maint-cannot-create-bundle-error'Libravatar Junio C Hamano1-0/+7
* ch/maint-cannot-create-bundle-error: bundle: detect if bundle file cannot be created
2010-09-15Merge branch 'ks/recursive-rename-add-identical'Libravatar Junio C Hamano1-0/+35
* ks/recursive-rename-add-identical: RE: [PATCH] Avoid rename/add conflict when contents are identical
2010-09-13t7003: Use test_commit instead of custom functionLibravatar Brian Gernhardt1-38/+41
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>
2010-09-12Merge branch 'maint'Libravatar Junio C Hamano1-62/+64
* maint: t3101: modernise style compat/nedmalloc: don't force NDEBUG on the rest of git Conflicts: Makefile
2010-09-12ls-tree $di $dir: do not mistakenly recurse into directoriesLibravatar Junio C Hamano1-0/+9
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>
2010-09-12t3101: modernise styleLibravatar Junio C Hamano1-62/+64
Also add a few " &&" cascade that were missing. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-10t/t4018: avoid two unnecessary sub-shell invocationsLibravatar Brandon Casey1-4/+4
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09t/t4018: test whether the word_regex patterns compileLibravatar Brandon Casey1-0/+5
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>
2010-09-09t/t5510-fetch.sh: improve testing with explicit URL and merge specLibravatar Brandon Casey1-2/+28
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>