path: root/t/
AgeCommit message (Collapse)Author
2018-05-14t: switch $_x40 to $OID_REGEXbrian m. carlson
Switch all uses of $_x40 to $OID_REGEX so that they work correctly with larger hashes. This commit was created by using the following sed command to modify all files in the t directory except t/ sed -i 's/\$_x40/$OID_REGEX/g' Signed-off-by: brian m. carlson <> Signed-off-by: Junio C Hamano <>
2017-01-25unpack-trees: support super-prefix optionStefan Beller
In the future we want to support working tree operations within submodules, e.g. "git checkout --recurse-submodules", which will update the submodule to the commit as recorded in its superproject. In the submodule the unpack-tree operation is carried out as usual, but the reporting to the user needs to prefix any path with the superproject. The mechanism for this is the super-prefix. (see 74866d757, git: make super-prefix option) Add support for the super-prefix option for commands that unpack trees by wrapping any path output in unpacking trees in the newly introduced super_prefixed function. This new function prefixes any path with the super-prefix if there is one. Assuming the submodule case doesn't happen in the majority of the cases, we'd want to have a fast behavior for no super prefix, i.e. no reallocation/copying, but just returning path. Another aspect of introducing the `super_prefixed` function is to consider who owns the memory and if this is the right place where the path gets modified. As the super prefix ought to change the output behavior only and not the actual unpack tree part, it is fine to be that late in the line. As we get passed in 'const char *path', we cannot change the path itself, which means in case of a super prefix we have to copy over the path. We need two static buffers in that function as the error messages contain at most two paths. For testing purposes enable it in read-tree, which has no output of paths other than an unpack-trees.c. These are all converted in this patch. Signed-off-by: Stefan Beller <> Signed-off-by: Junio C Hamano <>
2017-01-11t1001: modernize styleStefan Beller
The preferred style in tests is: test_expect_success 'short description then sq to open the body' ' here comes the test && and chains over many lines && with closing sq on its own line ' Signed-off-by: Stefan Beller <> Signed-off-by: Junio C Hamano <>
2014-06-03Merge branch 'ep/shell-command-substitution'Junio C Hamano
Adjust shell scripts to use $(cmd) instead of `cmd`. * ep/shell-command-substitution: (41 commits) use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution use the $( ... ) construct for command substitution ... use the $( ... ) construct for command substitutionElia Pinto
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto <> Reviewed-by: Matthieu Moy <> Signed-off-by: Junio C Hamano <>
2014-03-31code and test: fix misuses of "nor"Justin Lebar
Signed-off-by: Justin Lebar <> Signed-off-by: Junio C Hamano <>
2011-05-25Teach read-tree the -n|--dry-run optionJens Lehmann
The option can be used to check if read-tree with the same set of other options like "-m" and "-u" would succeed without actually changing either the index or the working tree. The relevant tests in the t10?? range were extended to do a read-tree -n before the real read-tree to make sure neither the index nor any local files were changed with -n and the same exit code as without -n is returned. The helper functions added for that purpose reside in the new t/ file. The only exception is #13 in t1004 ("unlinking an un-unlink-able symlink"). As this is an issue of wrong directory permissions it is not detected with -n. Signed-off-by: Jens Lehmann <> Signed-off-by: Junio C Hamano <>
2010-11-09tests: add missing &&Jonathan Nieder
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 <> Signed-off-by: Junio C Hamano <>
2010-10-06t100[12] (read-tree-m-2way, read_tree_m_u_2way): add missing &&Elijah Newren
Also, replace "|| return 1" with "&&" in order to keep commands chained. Acked-by: Ævar Arnfjörð Bjarmason <> Reviewed-by: Jonathan Nieder <> Signed-off-by: Elijah Newren <> Signed-off-by: Junio C Hamano <>
2010-07-20Convert "! git" to "test_must_fail git"Jared Hance
test_must_fail will account for segfaults in git, so it should be used instead of "! git" This patch does not change any of the commands that use pipes. Signed-off-by: Jared Hance <> Signed-off-by: Junio C Hamano <>
2010-07-09Merge remote branch 'ko/master' into jc/read-tree-cache-tree-fixJunio C Hamano
* ko/master: (2325 commits) Git 1.7.2-rc2 backmerge a few more fixes to 1.7.1.X series fix git branch -m in presence of cross devices t/t0006: specify timezone as EST5 not EST to comply with POSIX add missing && to submodule-merge testcase t/README: document more test helpers test-date: fix sscanf type conversion xdiff: optimise for no whitespace difference when ignoring whitespace. gitweb: Move evaluate_gitweb_config out of run_request parse_date: fix signedness in timezone calculation t0006: test timezone parsing rerere.txt: Document forget subcommand t/README: proposed rewording... t/README: Document the do's and don'ts of tests t/README: Add a section about skipping tests t/README: Document test_expect_code t/README: Document test_external* t/README: Document the prereq functions, and 3-arg test_* t/README: Typo: paralell -> parallel t/README: The trash is in 't/trash directory.$name' ... Conflicts: builtin-read-tree.c
2010-07-09Fix "read-tree -m A B" priming the cache-treeJunio C Hamano
In 456156d a shortcut to priming the index tree reference was introduced, but the justification for it was completely bogus. "read-tree -m A B" is to take the index (and the working tree) that is largely based on (but does not have to match exactly) A and update it to B, while carrying the local change that does not overlap the difference between A and B, so there is no reason to expect that the resulting index should match the tree B. Noticed and test provided by Heiko Voigt. Signed-off-by: Junio C Hamano <>
2010-01-04tests: move convenience regexp to match object names to test-lib.shJunio C Hamano
Signed-off-by: Junio C Hamano <>
2009-10-25Use 'fast-forward' all over the placeFelipe Contreras
It's a compound word. Signed-off-by: Felipe Contreras <> Signed-off-by: Junio C Hamano <>
2009-01-05unpack-trees: fix path search bug in verify_absentClemens Buchacher
Commit 0cf73755 (unpack-trees.c: assume submodules are clean during check-out) changed an argument to verify_absent from 'path' to 'ce', which is however shadowed by a local variable of the same name. The bug triggers if verify_absent is used on a tree entry, for which the index contains one or more subsequent directories of the same length. The affected subdirectories are removed from the index. The testcase included in this commit bisects to 55218834 (checkout: do not lose staged removal), which reveals the bug in this case, but is otherwise unrelated. Signed-off-by: Junio C Hamano <>
2009-01-05unpack-trees: handle failure in verify_absentClemens Buchacher
Commit 203a2fe1 (Allow callers of unpack_trees() to handle failure) changed the "die on error" behavior to "return failure code". verify_absent did not handle errors returned by verify_clean_subdirectory, however. Signed-off-by: Junio C Hamano <>
2008-05-24tests: do not use implicit "git diff --no-index"Junio C Hamano
As a general principle, we should not use "git diff" to validate the results of what git command that is being tested has done. We would not know if we are testing the command in question, or locating a bug in the cute hack of "git diff --no-index". Rather use test_cmp for that purpose. Signed-off-by: Junio C Hamano <>
2007-07-03Rewrite "git-frotz" to "git frotz"Junio C Hamano
This uses the remove-dashes target to replace "git-frotz" to "git frotz". Signed-off-by: Junio C Hamano <>
2007-03-04Get rid of the dependency to GNU diff in the testsJohannes Schindelin
Now that "git diff" handles stdin and relative paths outside the working tree correctly, we can convert all instances of "diff -u" to "git diff". This commit is really the result of $ perl -pi.bak -e 's/diff -u/git diff/' $(git grep -l "diff -u" t/) Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <> (cherry picked from commit c699a40d68215c7e44a5b26117a35c8a56fbd387)
2006-04-22Libify diff-files.Junio C Hamano
This is the first installment to libify diff brothers. The updated diff-files uses revision.c::setup_revisions() infrastructure to parse its command line arguments, which means the pathname arguments are checked more strictly than before. The tests are adjusted to separate possibly missing paths from the rest of arguments with double-dashes, to show the kosher way. As Linus pointed out, renaming diff.c to diff-lib.c was simply stupid, so I am renaming it back. The new diff-lib.c is to contain pieces extracted from diff brothers. Signed-off-by: Junio C Hamano <>
2005-09-17Fix typo in test comment.Junio C Hamano
I do not know why it was spelled git-rev-tree when I meant to say git-read-tree, but the typo was left since day one. Signed-off-by: Junio C Hamano <>
2005-09-08Big tool rename.Junio C Hamano
As promised, this is the "big tool rename" patch. The primary differences since 0.99.6 are: (1) git-*-script are no more. The commands installed do not have any such suffix so users do not have to remember if something is implemented as a shell script or not. (2) Many command names with 'cache' in them are renamed with 'index' if that is what they mean. There are backward compatibility symblic links so that you and Porcelains can keep using the old names, but the backward compatibility support is expected to be removed in the near future. Signed-off-by: Junio C Hamano <>
2005-08-12[PATCH] Trapping exit in tests, using return for errorsPavel Roskin
I have noticed that "make test" fails without any explanations when the "merge" utility is missing. I don't think tests should be silent in case of failure. It turned out that the particular test was using "exit" to interrupt the test in case of an error. This caused the whole test script to exit. No further tests would be run even if "--immediate" wasn't specified. No error message was printed. This patch does following: All instances of "exit", "exit 1" and "(exit 1)" in tests have been replaced with "return 1". In fact, "(exit 1)" had no effect. File descriptor 5 is duplicated from file descriptor 1. This is needed to print important error messages from tests. New function test_run_() has been introduced. Any "return" in the test would merely cause that function to return without skipping calls to test_failure_() and test_ok_(). The new function also traps "exit" and treats it like a fatal error (in case somebody reintroduces "exit" in the tests). test_expect_failure() and test_expect_success() check both the result of eval and the return value of test_run_(). If the later is not 0, it's always a failure because it indicates the the test didn't complete. Signed-off-by: Pavel Roskin <> Signed-off-by: Junio C Hamano <>
2005-06-25[PATCH] Add more tests for read-tree --emu23.Junio C Hamano
This adds more tests for --emu23. One is to show how it can carry forward more local changes than the straightforward two-way fast forward, and another is to show the recent overeager optimization of directory/file conflict check broke things, which will be fixed in the next commit. Signed-off-by: Junio C Hamano <> Signed-off-by: Linus Torvalds <>
2005-06-13[PATCH] Clean up read-tree two-way tests.Junio C Hamano
This is in preparation for "2-way fast-forward emulated with 3-way mechanism" series. It does not change what the tests for pure 2-way do. It only changes how it tests things, to make reviewing of differences of the two tests easier in later steps. Signed-off-by: Junio C Hamano <> Signed-off-by: Linus Torvalds <>
2005-06-07[PATCH] read-tree: save more user hassles during fast-forward.Junio C Hamano
This implements the "never lose the current cache information or the work tree state, but favor a successful merge over merge failure" principle in the fast-forward two-tree merge operation. It comes with a set of tests to cover all the cases described in the case matrix found in the new documentation. Signed-off-by: Junio C Hamano <> Signed-off-by: Linus Torvalds <>