1
0
mirror of https://github.com/git/git.git synced 2024-10-20 02:58:26 +02:00
Commit Graph

4876 Commits

Author SHA1 Message Date
Alex Riesen
90cff968b3 HOME must be set before calling git-init when creating test repositories
Otherwise the created test repositories will be affected by users ~/.gitconfig.
For example, setting core.logAllrefupdates in users config will make all
calls to "git config --unset core.logAllrefupdates" fail which will break
the first test which uses the statement and expects it to succeed.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-29 01:13:36 -07:00
Junio C Hamano
106040fe8e Merge branch 'so/submodule-no-update-first-time' into maint
* so/submodule-no-update-first-time:
  t7406: "git submodule update {--merge|--rebase]" with new submodules
  submodule: no [--merge|--rebase] when newly cloned
2011-03-20 22:11:02 -07:00
Junio C Hamano
eec8a512bc Merge branch 'mo/perl-bidi-pipe-envfix' into maint
* mo/perl-bidi-pipe-envfix:
  perl: command_bidi_pipe() method should set-up git environmens
2011-03-20 22:10:31 -07:00
Junio C Hamano
a8e04ddf6e Merge branch 'ae/better-template-failure-report' into maint
* ae/better-template-failure-report:
  Improve error messages when temporary file creation fails
2011-03-20 22:09:39 -07:00
Ben Walton
c3786c8472 Work around broken ln on solaris as used in t8006
The test setup in t8006-blame-textconv.sh uses "ln -sf" to
overwrite an existing symlink.  Unfortunately, both /usr/bin/ln
and /usr/xpg4/bin/ln on solaris 9 don't properly handle -f and -s
used at the same time.  This caused the test setup and subsequent
checks to fail.

Instead, remove the symlink and then create a new one in the
setup code.

The upstream Solaris bug (fixed in 10, but not 9) is documented
here:

  http://bugs.opensolaris.org/view_bug.do?bug_id=4372462

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-20 21:58:09 -07:00
Carlos Martín Nieto
9aec68d3ea t/README: Add a note about running commands under valgrind
The test suite runs valgrind with certain options activated. Add a
note saying how to run commands under the same conditions as the test
suite does.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-20 21:19:38 -07:00
Junio C Hamano
afb497d472 Merge branch 'jn/maint-commit-missing-template' into maint
* jn/maint-commit-missing-template:
  commit: error out for missing commit message template
2011-03-16 16:47:26 -07:00
Junio C Hamano
43c1b6efb8 Merge branch 'lt/rename-no-extra-copy-detection' into maint
* lt/rename-no-extra-copy-detection:
  diffcore-rename: improve estimate_similarity() heuristics
  diffcore-rename: properly honor the difference between -M and -C
  for_each_hash: allow passing a 'void *data' pointer to callback
2011-03-16 16:47:26 -07:00
Junio C Hamano
4e530c5049 Merge branch 'jk/diffstat-binary' into maint
* jk/diffstat-binary:
  diff: don't retrieve binary blobs for diffstat
  diff: handle diffstat of rewritten binary files
2011-03-16 16:47:26 -07:00
Junio C Hamano
c9b7cc0473 Merge branch 'jn/test-terminal-punt-on-osx-breakage' into maint
* jn/test-terminal-punt-on-osx-breakage:
  tests: skip terminal output tests on OS X
2011-03-16 16:47:26 -07:00
Junio C Hamano
8209b7fb9b Merge branch 'jk/fail-null-clone' into maint
* jk/fail-null-clone:
  clone: die when trying to clone missing local path
2011-03-16 16:47:26 -07:00
Junio C Hamano
7633a5ab9a Merge branch 'mg/placeholders-are-lowercase' into maint
* mg/placeholders-are-lowercase:
  Make <identifier> lowercase in Documentation
  Make <identifier> lowercase as per CodingGuidelines
  Make <identifier> lowercase as per CodingGuidelines
  Make <identifier> lowercase as per CodingGuidelines
  CodingGuidelines: downcase placeholders in usage messages
2011-03-16 16:47:25 -07:00
Junio C Hamano
bd2700dbdf Merge branch 'mg/patch-id' into maint
* mg/patch-id:
  git-patch-id: do not trip over "no newline" markers
  git-patch-id: test for "no newline" markers
2011-03-16 16:47:25 -07:00
Junio C Hamano
5b8aac32fb Merge branch 'js/maint-merge-use-prepare-commit-msg-hook' into maint
* js/maint-merge-use-prepare-commit-msg-hook:
  merge: honor prepare-commit-msg hook
2011-03-16 16:47:25 -07:00
Carlos Martín Nieto
b406a2d3e3 valgrind: ignore SSE-based strlen invalid reads
Some versions of strlen use SSE to speed up the calculation and load 4
bytes at a time, even if it means reading past the end of the
allocated memory. This read is safe and when the strlen function is
inlined, it is not replaced by valgrind, which reports a
false-possitive.

Tell valgrind to ignore this particular error, as the read is, in
fact, safe. Current upstream-released version 3.6.1 is affected. Some
distributions have this fixed in their latest versions.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 13:19:56 -07:00
Mathias Lafeldt
681186ae3a Fix typo in t/README
Signed-off-by: Mathias Lafeldt <misfire@debugon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-09 12:53:13 -08:00
Jonathan Nieder
2140b14064 commit: error out for missing commit message template
When "git commit" was rewritten in C (v1.5.4-rc0~78^2~30,
2007-11-08), a subtle bug in --template was introduced.  If the
file named by a --template parameter is missing, previously git
would error out with a message:

	Commit template file does not exist.

but in the C version the --template parameter gets ignored and
the default template is used.

t7500 has two tests for this case which would have caught it, except
that with the default $EDITOR, the commit message template is left
unmodified, causing 'git commit' to error out and the test to
succeed.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-25 12:13:55 -08:00
Jeff King
ded0abc73c diff: handle diffstat of rewritten binary files
The logic in builtin_diffstat assumes that a
complete_rewrite pair should have its lines counted. This is
nonsensical for binary files and leads to confusing things
like:

  $ git diff --stat --summary HEAD^ HEAD
   foo.rand |  Bin 4096 -> 4096 bytes
   1 files changed, 0 insertions(+), 0 deletions(-)

  $ git diff --stat --summary -B HEAD^ HEAD
   foo.rand |   34 +++++++++++++++-------------------
   1 files changed, 15 insertions(+), 19 deletions(-)
   rewrite foo.rand (100%)

So let's reorder the function to handle binary files first
(which from diffstat's perspective look like complete
rewrites anyway), then rewrites, then actual diffstats.

There are two bonus prizes to this reorder:

  1. It gets rid of a now-superfluous goto.

  2. The binary case is at the top, which means we can
     further optimize it in the next patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-22 10:57:58 -08:00
Ævar Arnfjörð Bjarmason
d5a719e4af t/t7500-commit.sh: use test_cmp instead of test
Change commit_msg_is() in t/t7500-commit.sh to use test_cmp instead of
the shell's test function. Now if a test fails we'll get test_cmp
output showing us what failed.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21 10:55:53 -08:00
Ævar Arnfjörð Bjarmason
49151d8b2c t/gitweb-lib.sh: Ensure that errors are shown for --debug --immediate
Because '--immediate' stops test suite after first error, therefore in
this mode

  test_debug 'cat gitweb.log'

was never ran, thus in effect negating effect of '--debug' option.
This made finidng the cause of errors in gitweb test sute difficult.

Modify the gitweb_run test subroutine to run test_debug itself in the
case of errors (and also remove "test_debug 'cat gitweb.log'" from
gitweb tests).

This makes it possible to run *gitweb tests* with --immediate ---debug
combination of options; also it makes gitweb tests to not output
spurious debug data that is not considered error.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21 10:38:40 -08:00
Linus Torvalds
0940e5f211 diffcore-rename: properly honor the difference between -M and -C
We would allow rename detection to do copy detection even when asked
purely for renames.  That confuses users, but more importantly it can
terminally confuse the recursive merge rename logic.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-18 22:26:28 -08:00
Jeff King
a902618792 clone: die when trying to clone missing local path
Since 86ac751 (Allow cloning an empty repository,
2009-01-23), doing:

  git clone does-not-exist

has created does-not-exist as an empty repository. This was
an unintentional side effect of 86ac751. Even weirder,
doing:

  git clone does-not-exist new-dir

_does_ fail, making this "feature" (if you want to consider
it such) broken. Let's detect this situation and explicitly
die. It's almost certainly not what the user intended.

This patch also adds two tests. One for the missing path
case, and one to confirm that a similar case, cloning a
non-repository directory, fails.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-18 07:05:54 -08:00
Jonathan Nieder
339e5638b0 tests: skip terminal output tests on OS X
On Mac OS X 10.5.0, test_terminal gets stuck reading from the pty
master every once in a while.  To reproduce the problem:

 perl -MIO::Pty -MFile::Copy -e '
	for (my $i = 0;; $i++) {
		my $master = new IO::Pty;
		my $slave = $master->slave;
		if (fork == 0) {
			close $master or die "close: $!";
			open STDOUT, ">&", $slave or die "dup2: $!";
			close $slave or die "close: $!";
			exec("echo", "hi", $i) or die "exec: $!";
		}
		close $slave or die "close: $!";
		copy($master, \*STDOUT) or die "copy: $!";
		close $master or die "close: $!";
		wait;
	}
 '

It blocks after 7000 iterations or so in sysread().  The relevant
sysread() call is the second call by the parent, which presumably
executes before the child dies but after the parent has read all
output from there.

Since this is an intermitent problem, the quick check of terminal
support in lib-terminal doesn't catch it.  Skip these tests on the Mac
for now.

Noticed-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-17 15:50:37 -08:00
Spencer E. Olson
b200021e15 t7406: "git submodule update {--merge|--rebase]" with new submodules
Add two test cases in t7406 to ensure that the --merge/--rebase options
are ignored for "git submodule update" with new modules.  These test that
a simple checkout is performed instead.

Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-17 12:25:17 -08:00
Michael J Gruber
2485eab55c git-patch-id: do not trip over "no newline" markers
Currently, patch-id trips over our very own diff extension for marking
the absence of newline at EOF.

Fix it. (Ignore it, it's whitespace.)

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-17 11:56:50 -08:00
Michael J Gruber
f2b5e7af10 git-patch-id: test for "no newline" markers
Currently, patch-id trips over our very own output that marks the absence
of newline at EOF.

Expose this in a test.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-17 11:54:57 -08:00
Junio C Hamano
da656f17d3 Merge branch 'maint-1.7.2' into maint-1.7.3
* maint-1.7.2:
  fast-import: introduce "feature notes" command
  fast-import: clarify documentation of "feature" command
2011-02-16 14:32:59 -08:00
Junio C Hamano
6a7f71d376 Merge branch 'maint-1.7.1' into maint-1.7.2
* maint-1.7.1:
  fast-import: introduce "feature notes" command
  fast-import: clarify documentation of "feature" command
2011-02-16 14:32:54 -08:00
Junio C Hamano
206af7c96b Merge branch 'maint-1.7.0' into maint-1.7.1
* maint-1.7.0:
  fast-import: introduce "feature notes" command
  fast-import: clarify documentation of "feature" command
2011-02-16 14:32:47 -08:00
Jay Soffian
65969d43d1 merge: honor prepare-commit-msg hook
When a merge is stopped due to conflicts or --no-commit, the
subsequent commit calls the prepare-commit-msg hook. However,
it is not called after a clean merge. Fix this inconsistency
by invoking the hook after clean merges as well.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15 13:35:35 -08:00
Michael J Gruber
41dbcd4540 Make <identifier> lowercase as per CodingGuidelines
*.c part for matches with '<[A-Z]+>' (and affected test).

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15 11:53:11 -08:00
Masatake Osanai
48d9e6ae4b perl: command_bidi_pipe() method should set-up git environmens
When command_input_pipe and command_output_pipe are used as a
method of a Git::repository instance, they eventually call into
_cmd_exec method that sets up the execution environment such as
GIT_DIR, GIT_WORK_TREE environment variables and the current
working directory in the child process that interacts with the
repository.

command_bidi_pipe however didn't expect to be called as such, and
lacked all these set-up.  Because of this, a program that did this
did not work as expected:

    my $repo = Git->repository(Directory => '/some/where/else');
    my ($pid, $in, $out, $ctx) =
    $repo->command_bidi_pipe(qw(hash-object -w --stdin-paths));

This patch refactors the _cmd_exec into _setup_git_cmd_env that
sets up the execution environment, and makes _cmd_exec and
command_bidi_pipe to use it.

Note that unlike _cmd_exec that execv's a git command as an
external process, command_bidi_pipe is called from the main line
of control, and the execution environment needs to be restored
after open2() does its magic.

Signed-off-by: Masatake Osanai <unpush@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-14 15:28:13 -08:00
Junio C Hamano
a8e4a5943a Merge branch 'maint-1.7.0' into maint
* maint-1.7.0:
  fast-import: introduce "feature notes" command
  fast-import: clarify documentation of "feature" command

Conflicts:
	Documentation/git-fast-import.txt
2011-02-09 16:40:12 -08:00
Jonathan Nieder
547e8b9205 fast-import: introduce "feature notes" command
Here is a 'feature' command for streams to use to require support for
the notemodify (N) command.

When the 'feature' facility was introduced (v1.7.0-rc0~95^2~4,
2009-12-04), the notes import feature was old news (v1.6.6-rc0~21^2~8,
2009-10-09) and it was not obvious it deserved to be a named feature.
But now that is clear, since all major non-git fast-import backends
lack support for it.

Details: on git version with this patch applied, any "feature notes"
command in the features/options section at the beginning of a stream
will be treated as a no-op.  On fast-import implementations without
the feature (and older git versions), the command instead errors out
with a message like

	This version of fast-import does not support feature notes.

So by declaring use of notes at the beginning of a stream, frontends
can avoid wasting time and other resources when the backend does not
support notes.  (This would be especially important for backends that
do not support rewinding history after a botched import.)

Improved-by: Thomas Rast <trast@student.ethz.ch>
Improved-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-09 16:06:51 -08:00
Nguyễn Thái Ngọc Duy
a2b7a3b3a9 diff: support --cached on unborn branches
"git diff --cached" (without revision) used to mean "git diff --cached
HEAD" (i.e. the user was too lazy to type HEAD). This "correctly"
failed when there was no commit yet. But was that correctness useful?

This patch changes the definition of what particular command means.
It is a request to show what _would_ be committed without further "git
add". The internal implementation is the same "git diff --cached HEAD"
when HEAD exists, but when there is no commit yet, it compares the index
with an empty tree object to achieve the desired result.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-07 15:04:30 -08:00
Pat Thoyts
c91897b3b0 t7407: fix line endings for mingw build
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-07 14:27:46 -08:00
Johannes Sixt
97a853d34b t4120-apply-popt: help systems with core.filemode=false
A test case verifies that filemode-only patches work as expected. Help
systems where "test -x" does not work by applying the test patch also to
the index, where the effects can be verified even on such systems.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-07 14:27:25 -08:00
Pat Thoyts
899663f8e4 t3509: use unconstrained initial test to setup repository.
The first test did not run on msysGit due to the SYMLINKS constraint and
so subsequent tests failed because the test repository was not initialized.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-07 14:27:10 -08:00
Junio C Hamano
597a630542 Merge branch 'jl/fetch-submodule-recursive' into maint
* jl/fetch-submodule-recursive:
  t5526: Fix wrong argument order in "git config"
2011-01-31 10:05:57 -08:00
Jens Lehmann
a2a564686f t5526: Fix wrong argument order in "git config"
This fixes a typo where the "git config" arguments "-f" and "--unset" were
swapped leading to the creation of a "--unset" file.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-31 09:59:04 -08:00
Junio C Hamano
99e63ef24e Merge branch 'maint'
* maint:
  rebase -i: clarify in-editor documentation of "exec"
  tests: sanitize more git environment variables
  fast-import: treat filemodify with empty tree as delete
  rebase: give a better error message for bogus branch
  rebase: use explicit "--" with checkout

Conflicts:
	t/t9300-fast-import.sh
2011-01-27 10:27:49 -08:00
Jeff King
a1231de002 tests: sanitize more git environment variables
These variables should generally not be set in one's
environment, but they do get set by rebase, which means
doing an interactive rebase like:

  pick abcd1234 foo
  exec make test

will cause false negatives in the test suite.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-27 10:24:05 -08:00
Junio C Hamano
5ce3258122 Merge branch 'jn/fast-import-empty-tree-removal' into maint
* jn/fast-import-empty-tree-removal:
  fast-import: treat filemodify with empty tree as delete
2011-01-27 10:23:53 -08:00
Jonathan Nieder
8fe533f686 fast-import: treat filemodify with empty tree as delete
Normal git processes do not allow one to build a tree with an empty
subtree entry without trying hard at it.  This is in keeping with the
general UI philosophy: git tracks content, not empty directories.

v1.7.3-rc0~75^2 (2010-06-30) changed that by making it easy to include
an empty subtree in fast-import's active commit:

	M 040000 4b825dc642cb6eb9a060e54bf8d69288fbee4904 subdir

One can trigger this by reading an empty tree (for example, the tree
corresponding to an empty root commit) and trying to move it to a
subtree.  It is better and more closely analogous to 'git read-tree
--prefix' to treat such commands as requests to remove the subtree.

Noticed-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-27 10:22:37 -08:00
Junio C Hamano
0efbb7d9f4 Merge branch 'jn/setup-fixes'
* jn/setup-fixes:
  t1510: fix typo in the comment of a test
  Documentation updates for 'GIT_WORK_TREE without GIT_DIR' historical usecase
  Subject: setup: officially support --work-tree without --git-dir
  tests: compress the setup tests
  tests: cosmetic improvements to the repo-setup test
  t/README: hint about using $(pwd) rather than $PWD in tests
  Fix expected values of setup tests on Windows
2011-01-24 10:53:09 -08:00
Jonathan Nieder
6abbee8c60 t1510: fix typo in the comment of a test
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-24 10:14:57 -08:00
Jonathan Nieder
4868b2ea17 Subject: setup: officially support --work-tree without --git-dir
The original intention of --work-tree was to allow people to work in a
subdirectory of their working tree that does not have an embedded .git
directory.  Because their working tree, which their $cwd was in, did not
have an embedded .git, they needed to use $GIT_DIR to specify where it is,
and because this meant there was no way to discover where the root level
of the working tree was, so we needed to add $GIT_WORK_TREE to tell git
where it was.

However, this facility has long been (mis)used by people's scripts to
start git from a working tree _with_ an embedded .git directory, let git
find .git directory, and then pretend as if an unrelated directory were
the associated working tree of the .git directory found by the discovery
process.  It happens to work in simple cases, and is not worth causing
"regression" to these scripts.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-21 14:31:24 -08:00
Jonathan Nieder
786dabecd4 tests: compress the setup tests
New test helpers:

 - setup_repo, to initialize a repository or gitfile pointing to a
   repository, with core.bare and core.worktree set as specified;

 - try_case, to run setup from a given directory and validate the
   result, with GIT_DIR and GIT_WORK_TREE set as specified;

 - try_repo, to initialize a repository and call "try_case" from the
   toplevel and a subdirectory;

 - run_wt_tests, to run a battery of tests that check for sane
   behavior when GIT_WORK_TREE is set to various positions relative to
   the .git dir and cwd.

Use these helpers to make the test shorter, less repetitive, and (one
hopes) easier to understand and modify.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-19 10:27:16 -08:00
Jonathan Nieder
91c031df67 tests: cosmetic improvements to the repo-setup test
Give an overview in "sh t1510-repo-setup.sh --help" output.
Waste some vertical and horizontal space for clearer code.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-19 10:27:16 -08:00
Junio C Hamano
8a59702ad8 Merge branch 'tr/submodule-relative-scp-url' into maint
* tr/submodule-relative-scp-url:
  submodule: fix relative url parsing for scp-style origin
2011-01-19 08:26:41 -08:00