Adjust shell scripts to use $(cmd) instead of `cmd`.
* ep/shell-command-substitution: (41 commits)
t5000-tar-tree.sh: use the $( ... ) construct for command substitution
t4204-patch-id.sh: use the $( ... ) construct for command substitution
t4119-apply-config.sh: use the $( ... ) construct for command substitution
t4116-apply-reverse.sh: use the $( ... ) construct for command substitution
t4057-diff-combined-paths.sh: use the $( ... ) construct for command substitution
t4038-diff-combined.sh: use the $( ... ) construct for command substitution
t4036-format-patch-signer-mime.sh: use the $( ... ) construct for command substitution
t4014-format-patch.sh: use the $( ... ) construct for command substitution
t4013-diff-various.sh: use the $( ... ) construct for command substitution
t4012-diff-binary.sh: use the $( ... ) construct for command substitution
t4010-diff-pathspec.sh: use the $( ... ) construct for command substitution
t4006-diff-mode.sh: use the $( ... ) construct for command substitution
t3910-mac-os-precompose.sh: use the $( ... ) construct for command substitution
t3905-stash-include-untracked.sh: use the $( ... ) construct for command substitution
t1050-large.sh: use the $( ... ) construct for command substitution
t1020-subdirectory.sh: use the $( ... ) construct for command substitution
t1004-read-tree-m-u-wf.sh: use the $( ... ) construct for command substitution
t1003-read-tree-prefix.sh: use the $( ... ) construct for command substitution
t1002-read-tree-m-u-2way.sh: use the $( ... ) construct for command substitution
t1001-read-tree-m-2way.sh: use the $( ... ) construct for command substitution
...
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 <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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/lib-read-tree.sh 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 <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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>
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>
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 <jaredhance@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* 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
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 <gitster@pobox.com>
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 <gitster@pobox.com>
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 <gitster@pobox.com>
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 <gitster@pobox.com>
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 <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from commit c699a40d68215c7e44a5b26117a35c8a56fbd387)
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 <junkio@cox.net>
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 <junkio@cox.net>
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 <junkio@cox.net>
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 <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
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 <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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 <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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 <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>