Commit graph

37 commits

Author SHA1 Message Date
Junio C Hamano 152a9c17a8 Merge branch 'fc/trivial'
A random collection of style fixes and minor doc updates.

* fc/trivial:
  setup: trivial style fixes
  run-command: trivial style fixes
  diff: trivial style fix
  revision: trivial style fixes
  pretty: trivial style fix
  describe: trivial style fixes
  transport-helper: trivial style fix
  sha1-name: trivial style cleanup
  branch: trivial style fix
  revision: add missing include
  doc/pull: clarify the illustrations
  t: replace pulls with merges
  merge: simplify ff-only option
2013-11-06 14:34:43 -08:00
Felipe Contreras 501a75a7b3 t: replace pulls with merges
This is what the code intended.

No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-31 11:12:26 -07:00
Jeff King 94221d2203 t: use perl instead of "$PERL_PATH" where applicable
As of the last commit, we can use "perl" instead of
"$PERL_PATH" when running tests, as the former is now a
function which uses the latter. As the shorter "perl" is
easier on the eyes, let's switch to using it everywhere.

This is not quite a mechanical s/$PERL_PATH/perl/
replacement, though. There are some places where we invoke
perl from a script we generate on the fly, and those scripts
do not have access to our internal shell functions. The
result can be double-checked by running:

  ln -s /bin/false bin-wrappers/perl
  make test

which continues to pass even after this patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-29 12:45:15 -07:00
Jiang Xin 9a0013819e Fix tests under GETTEXT_POISON on parseopt
Use the i18n-specific test functions in test scripts for parseopt tests.
This issue was was introduced in v1.7.10.1-488-g54e6d:

    54e6d i18n: parseopt: lookup help and argument translations when showing usage

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-27 09:26:30 -07:00
Junio C Hamano 7096b6486e tests: enclose $PERL_PATH in double quotes
Otherwise it will be split at a space after "Program" when it is set
to "\\Program Files\perl" or something silly like that.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-24 21:56:13 -07:00
Vincent van Ravesteijn a3428205e6 t: Replace 'perl' by $PERL_PATH
GIT-BUILD-OPTIONS defines PERL_PATH to be used in the test suite. Only a
few tests already actually use this variable when perl is needed. The
other test just call 'perl' and it might happen that the wrong perl
interpreter is used.

This becomes problematic on Windows, when the perl interpreter that is
compiled and installed on the Windows system is used, because this perl
interpreter might introduce some unexpected LF->CRLF conversions.

This patch makes sure that $PERL_PATH is used everywhere in the test suite
and that the correct perl interpreter is used.

Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-12 09:30:41 -07:00
Junio C Hamano 8aed4a5e38 Merge branch 'jn/merge-renormalize'
* jn/merge-renormalize:
  merge-recursive --renormalize
  rerere: never renormalize
  rerere: migrate to parse-options API
  t4200 (rerere): modernize style
  ll-merge: let caller decide whether to renormalize
  ll-merge: make flag easier to populate
  Documentation/technical: document ll_merge
  merge-trees: let caller decide whether to renormalize
  merge-trees: push choice to renormalize away from low level
  t6038 (merge.renormalize): check that it can be turned off
  t6038 (merge.renormalize): try checkout -m and cherry-pick
  t6038 (merge.renormalize): style nitpicks
  Don't expand CRLFs when normalizing text during merge
  Try normalizing files to avoid delete/modify conflicts when merging
  Avoid conflicts when merging branches with mixed normalization

Conflicts:
	builtin/rerere.c
	t/t4200-rerere.sh
2010-09-03 09:43:41 -07:00
Jonathan Nieder 672d1b789b rerere: migrate to parse-options API
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-06 09:20:02 -07:00
Jonathan Nieder f7314882c2 t4200 (rerere): modernize style
Guard all test code with test_expect_success to make the
script easier to follow.  While at it, pick some other nits:

 - use test_tick (more than we have to, to be realistic);

 - 'single quotes' and \escaped HERE documents where possible
   simplify review for escaping problems;

 - omit whitespace after >redirection operators for
   consistency with other tests;

 - use "update-index --refresh" instead of testing that
   "ls-files -u" output is empty, since the former produces
   nicer output on failure;

 - compare to expected nonempty "ls-files -u" output instead
   of counting lines when it is expected to be nonempty.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-06 09:20:02 -07:00
SZEDER Gábor 7d7ff15b39 rerere: fix overeager gc
'rerere gc' prunes resolutions of conflicted merges that occurred long
time ago, and when doing so it takes the creation time of the
conflicted automerge results into account.  This can cause the loss of
frequently used conflict resolutions (e.g. long-living topic branches
are merged into a regularly rebuilt integration branch (think of git's
pu)) when they become old enough to exceed 'rerere gc's threshold.

To prevent the loss of valuable merge resolutions 'rerere' will (1)
update the timestamp of the recorded conflict resolution (i.e.
'postimage') each time when encountering and resolving the same merge
conflict, and (2) take this timestamp, i.e. the time of the last usage
into account when gc'ing.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-14 09:26:57 -07:00
Brian Gernhardt 4a45f7dd49 Use test_expect_success for test setups
Several tests did not use test_expect_success for their setup
commands.  Putting these start commands into the testing framework
means both that errors during setup will be caught quickly and that
non-error text will be suppressed without -v.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20 09:15:17 -07:00
Junio C Hamano cb6020bb01 Teach --[no-]rerere-autoupdate option to merge, revert and friends
Introduce a command line option to override rerere.autoupdate configuration
variable to make it more useful.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-04 00:20:48 -08:00
Brandon Casey 5e16488edc t4200: convert sed expression which operates on non-text file to perl
POSIX only requires sed to work on text files and MERGE_RR is not a text
file.  Some versions of sed complain that this file is not newline
terminated, and exit non-zero.  Use perl instead which does not have a
problem with it.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 16:43:29 -07:00
Brandon Casey 9eda0e980a t4200: remove two unnecessary lines
These two lines appear to be unnecessary.  They set variables which are not
used afterwards.  The primary motivation to remove them is that the sed
invocation exits non-zero for seds which require newline termination of
input files.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 16:43:28 -07:00
Junio C Hamano 588c038ac6 Merge branch 'sb/dashless'
* sb/dashless:
  Make usage strings dash-less
  t/: Use "test_must_fail git" instead of "! git"
  t/test-lib.sh: exit with small negagive int is ok with test_must_fail

Conflicts:
	builtin-blame.c
	builtin-mailinfo.c
	builtin-mailsplit.c
	builtin-shortlog.c
	git-am.sh
	t/t4150-am.sh
	t/t4200-rerere.sh
2008-07-16 17:22:50 -07:00
Stephan Beyer d492b31caf t/: Use "test_must_fail git" instead of "! git"
This patch changes every occurrence of "! git" -- with the meaning
that a git call has to gracefully fail -- into "test_must_fail git".

This is useful to

 - make sure the test does not fail because of a signal,
   e.g. SIGSEGV, and

 - advertise the use of "test_must_fail" for new tests.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13 13:21:26 -07:00
Johannes Schindelin 0af0ac7ebb Move MERGE_RR from .git/rr-cache/ into .git/
If you want to reuse the rerere cache in another repository, and set
a symbolic link to it, you do not want to have the two repositories
interfer with each other by accessing the _same_ MERGE_RR.

For example, if you use contrib/git-new-workdir to set up a second
working directory, and you have a conflict in one working directory,
but commit in the other working directory first, the wrong "resolution"
will be recorded.

The easy solution is to move MERGE_RR out of the rr-cache/ directory,
which also corresponds with the notion that rr-cache/ contains cached
resolutions, not some intermediate temporary states.

Noticed by Kalle Olavi Niemitalo.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13 01:03:10 -07:00
Olivier Marin 99d698f1e7 builtin-rerere: more carefully find conflict markers
When a conflicting file contains a line that begin with "=======", rerere
failed to parse conflict markers. This result to a wrong preimage file and
an unexpected error for the user.  The boundary between ours and theirs
not just begin with 7 equals, but is followed by either a SP or a LF.

This patch enforces parsing rules so that markers match in the right order,
and when ambiguous, the command does not autoresolve the conflicted file.

Especially because we are introducing rerere.autoupdate configuration
(which is off by default for safety) that automatically stages the
resolution made by rerere, it is necessary to make sure that we do not
autoresolve when there is any ambiguity.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-10 00:17:46 -07:00
Junio C Hamano 121c813f8d rerere.autoupdate
When this configuration is set, paths that are autoresolved by git-rerere
are updated in the index as well.
2008-06-22 02:06:58 -07:00
Junio C Hamano 7f8365f894 t4200: fix rerere test
The test used "diff-files -q" which is not about reporting if there is
a difference at all.  Instead, make sure that the path remains as
conflicting in the index after rerere autoresolves it, as we will be
adding rerere.autoupdate configuration with the next patch.
2008-06-22 02:03:26 -07:00
Junio C Hamano 3af828634f tests: do not use implicit "git diff --no-index"
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>
2008-05-24 00:01:56 -07:00
Jeff King e85fe4d85b more tr portability test script fixes
Dealing with NULs is not always safe with tr. On Solaris,
incoming NULs are silently deleted by both the System V and
UCB versions of tr. When converting to NULs, the System V
version works fine, but the UCB version silently ignores the
request to convert the character.

This patch changes all instances of tr using NULs to use
"perl -pe 'y///'" instead.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-13 00:57:52 -07:00
H.Merijn Brand 3175b0cfc1 the use of 'tr' in the test suite isn't really portable
Some versions of 'tr' only accept octal codes if entered with three digits,
and therefor misinterpret the '\0' in the test suite.

Some versions of 'tr' reject the (needless) use of character classes.

Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-17 20:49:18 -08:00
Johannes Schindelin 52aaf649cb rerere: record resolution even if file is not in merge base
Two-file merges were rare enough that they were dropped outside of the
radar.  This fix is a trivial change to builtin-rerere.c::find_conflict().
It is still sane to insist that we do not do rerere for symlinks, and
require to have stages #2 and #3, but we can drop the requirement to have
stage #1. rerere does not use information from there anyway.

This fix is from Junio, together with two tests to verify that it works
as expected.

Acked-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-09 23:39:59 -07:00
Johannes Schindelin b4372ef136 Enable "git rerere" by the config variable rerere.enabled
Earlier, "git rerere" was enabled by creating the directory
.git/rr-cache.  That is definitely not in line with most other
features, which are enabled by a config variable.

So, check the config variable "rerere.enabled". If it is set
to "false" explicitely, do not activate rerere, even if
.git/rr-cache exists. This should help when you want to disable
rerere temporarily.

If "rerere.enabled" is not set at all, fall back to detection
of the directory .git/rr-cache.

[jc: with minimum tweaks]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-06 22:39:15 -07:00
Junio C Hamano 5be60078c9 Rewrite "git-frotz" to "git frotz"
This uses the remove-dashes target to replace "git-frotz" to "git frotz".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-02 22:52:14 -07:00
Junio C Hamano a6080a0a44 War on whitespace
This uses "git-apply --whitespace=strip" to fix whitespace errors that have
crept in to our source files over time.  There are a few files that need
to have trailing whitespaces (most notably, test vectors).  The results
still passes the test, and build result in Documentation/ area is unchanged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-07 00:04:01 -07:00
Bryan Larsen c256acb8fb posix compatibility for t4200
Fix t4200 so that it also works on OS X by not relying on gnu
extensions to sed.

Signed-off-by: Bryan Larsen <bryan@larsen.st>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-03 22:58:01 -07:00
Junio C Hamano 2b93edbf32 rerere: make sorting really stable.
The earlier code does not swap hunks when the beginning of the
first side is identical to the whole of the second side.  In
such a case, the first one should sort later.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-04 14:12:03 -07:00
Brian Gernhardt 364b852352 Fix t4200-rerere for white-space from "wc -l"
On OS X, wc outputs 6 spaces before the number of lines, so the test
expecting the string "10" failed.  Do not quote $cmd to strip away
the problematic whitespace as other tests do.

Also fix the grammar of the test name while making changes to it.
There's only one preimage, so it's "has", not "have".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-04 13:11:33 -07:00
Junio C Hamano 045f5759c9 Merge 1.5.0.7 in
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-03 21:52:14 -07:00
Junio C Hamano eb3359663d rerere should not repeat the earlier hunks in later ones
When a file has more then one conflicting hunks, it repeated the
contents of previous hunks in output for later ones.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-03 19:01:36 -07:00
Johannes Schindelin 5bd74506cd Get rid of the dependency to GNU diff in the tests
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)
2007-03-04 00:24:15 -08:00
Eric Wong 56cf9806a9 Update tests to use test-chmtime
test-lib:
  Make sure test-chmtime has been built before starting.

t4200-rerere:
  Removed non-portable date dependency and avoid touch
  Avoid "test -a" which isn't portable, either

lib-git-svn:
  Use test-chmtime instead of Perl one-liner to poke

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 11:09:56 -08:00
Junio C Hamano fa1b4d2ace t4200: skip gc-rerere test on systems with non GNU date.
Quite nonstandard "date -d @11111111 +%s" does not even fail on
OpenBSD but gives the current date in "seconds since epoch"
format, which is useless for the purpose of this test.  We want
to make sure that this returns exactly the same input before
proceeding.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-07 10:43:56 -08:00
Simon 'corecode' Schubert 4700951298 Use standard -t option for touch.
Non-GNU touch do not have the -d option to take free form
date strings.  The POSIX -t option should be more widespread.
For this to work, date needs to output YYYYMMDDHHMM.SS date strings.

Signed-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-18 14:17:54 -08:00
Johannes Schindelin ad8e72cba8 Add a test for git-rerere
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-21 23:10:14 -08:00