Commit Graph

3612 Commits

Author SHA1 Message Date
Christian Couder
b5c1a28b4c cherry-pick: add tests for new --ff option
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-06 23:58:47 -08:00
Michael J Gruber
3acae29e81 t9119-git-svn-info.sh: test with svn 1.6.* as well
All tests in t9119 were disabled for subversion versions other than
1.[45].*. Make the test script run with subversion 1.[456].*.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-03-04 01:45:15 -08:00
Junio C Hamano
a75bab51ae Merge branch 'maint'
* maint:
  gitweb: Fix project-specific feature override behavior
  gitweb multiple project roots documentation
2010-03-02 12:44:16 -08:00
Junio C Hamano
52ebb06f14 Merge branch 'jn/maint-fix-pager'
* jn/maint-fix-pager:
  tests: Fix race condition in t7006-pager
  t7006-pager: if stdout is not a terminal, make a new one
  tests: Add tests for automatic use of pager
  am: Fix launching of pager
  git svn: Fix launching of pager
  git.1: Clarify the behavior of the --paginate option
  Make 'git var GIT_PAGER' always print the configured pager
  Fix 'git var' usage synopsis
2010-03-02 12:44:11 -08:00
Junio C Hamano
36420805a7 Merge branch 'ld/maint-diff-quiet-w'
* ld/maint-diff-quiet-w:
  git-diff: add a test for git diff --quiet -w
  git diff --quiet -w: check and report the status
2010-03-02 12:44:10 -08:00
Junio C Hamano
490b8ad76f Merge branch 'jh/maint-submodule-status-in-void'
* jh/maint-submodule-status-in-void:
  submodule summary: Don't barf when invoked in an empty repo
2010-03-02 12:44:07 -08:00
Junio C Hamano
6954ef2063 Merge branch 'ac/cvsimport-revision-mapping'
* ac/cvsimport-revision-mapping:
  cvsimport: new -R option: generate .git/cvs-revisions mapping
2010-03-02 12:44:06 -08:00
Junio C Hamano
6b45b8c088 Merge branch 'jc/grep-author-all-match-implicit'
* jc/grep-author-all-match-implicit:
  "log --author=me --grep=it" should find intersection, not union
2010-03-02 12:44:06 -08:00
Jakub Narebski
9be3614eff gitweb: Fix project-specific feature override behavior
This commit fixes a bug in processing project-specific override in
a situation when there is no project, e.g. for the projects list page.

When 'snapshot' feature had project specific config override enabled
by putting
  $feature{'snapshot'}{'override'} = 1;

(or equivalent) in $GITWEB_CONFIG, and when viewing toplevel gitweb
page, which means the projects list page (to be more exact this
happens for any project-less action), gitweb would put the following
Perl warnings in error log:

  gitweb.cgi: Use of uninitialized value $git_dir in concatenation (.) or string at gitweb.cgi line 2065.
  fatal: error processing config file(s)
  gitweb.cgi: Use of uninitialized value $git_dir in concatenation (.) or string at gitweb.cgi line 2221.
  gitweb.cgi: Use of uninitialized value $git_dir in concatenation (.) or string at gitweb.cgi line 2218.

The problem is in the following fragment of code:

  # path to the current git repository
  our $git_dir;
  $git_dir = "$projectroot/$project" if $project;

  # list of supported snapshot formats
  our @snapshot_fmts = gitweb_get_feature('snapshot');
  @snapshot_fmts = filter_snapshot_fmts(@snapshot_fmts);

For the toplevel gitweb page, which is the list of projects, $project is not
defined, therefore neither is $git_dir.  gitweb_get_feature() subroutine
calls git_get_project_config() if project specific override is turned
on... but we don't have project here.

Those errors mentioned above occur in the following fragment of code in
git_get_project_config():

  	# get config
  	if (!defined $config_file ||
  	    $config_file ne "$git_dir/config") {
  		%config = git_parse_project_config('gitweb');
  		$config_file = "$git_dir/config";
  	}

git_parse_project_config() calls git_cmd() which has '--git-dir='.$git_dir

There are (at least) three possible solutions:
1. Harden gitweb_get_feature() so that it doesn't call
   git_get_project_config() if $project (and therefore $git_dir) is not
   defined; there is no project for project specific config.
2. Harden git_get_project_config() like you did in your fix, returning early
   if $git_dir is not defined.
3. Harden git_cmd() so that it doesn't add "--git-dir=$git_dir" if $git_dir
   is not defined, and change git_get_project_config() so that it doesn't
   even try to access $git_dir if it is not defined.

This commit implements both 1.) and 2.), i.e. gitweb_get_feature() doesn't
call project-specific override if $git_dir is not defined (if there is no
project), and git_get_project_config() returns early if $git_dir is not
defined.

Add a test for this bug to t/t9500-gitweb-standalone-no-errors.sh test.

Reported-by: Eli Barzilay <eli@barzilay.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-02 12:14:44 -08:00
Junio C Hamano
9e2b885741 Merge branch 'cc/maint-bisect-paths'
* cc/maint-bisect-paths:
  bisect: error out when passing bad path parameters
2010-03-01 01:09:21 -08:00
Christian Couder
8f69f72fca bisect: error out when passing bad path parameters
As reported by Mark Lodato, "git bisect", when it was started with
path parameters that match no commit was kind of working without
taking account of path parameters and was reporting something like:

Bisecting: -1 revisions left to test after this (roughly 0 steps)

It is more correct and safer to just error out in this case, before
displaying the revisions left, so this patch does just that.

Note that this bug is very old, it exists at least since v1.5.5.
And it is possible to detect that case earlier in the bisect
algorithm, but it is not clear that it would be an improvement to
error out earlier, on the contrary it may change the behavior of
"git rev-list --bisect-all" for example, which is currently correct.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-01 01:04:35 -08:00
Tuomas Suutari
6a2009e7f3 git-svn: Fix discarding of extra parents from svn:mergeinfo
If parent J is an ancestor of parent I, then parent J should be
discarded, not I.

Note that J is an ancestor of I if and only if rev-list I..J is emtpy,
which is what we are testing here.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-02-26 01:30:23 -08:00
Tuomas Suutari
9560808f2e t9151: Add two new svn:mergeinfo test cases
When svn:mergeinfo contains two new parents in a specific order and
one is ancestor of the other, it is possible that git-svn discards the
wrong one. The first test case ("commit made to merged branch is
reachable from the merge") proves this.

The second test case ("merging two branches in one commit is detected
correctly") is just for completeness, since there was no test for
merging two (feature) branches to trunk in one commit.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-02-26 01:30:23 -08:00
Tuomas Suutari
ae5b370c9b t9151: Fix a few commits in the SVN dump
A few "svn cp" commands and commit commands were executed in incorrect
order. Therefore some of the desired commits were missing and some
were committed with wrong revision number in the commit message. This
made it hard to compare the produced git repository with the SVN
repository.

The dump file is updated too, but only the relevant parts and with
hand-edited timestamps to make history linear.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-02-26 01:30:23 -08:00
Junio C Hamano
f7311dc229 Merge branch 'maint'
* maint:
  t3301-notes: insert a shbang line in ./fake_editor.sh
2010-02-25 23:21:50 -08:00
Junio C Hamano
64da6e20de Merge branch 'maint-1.6.6' into maint
* maint-1.6.6:
  t3301-notes: insert a shbang line in ./fake_editor.sh
2010-02-25 23:21:42 -08:00
Johannes Sixt
3fdcdbdf30 Windows: redirect f[re]open("/dev/null") to f[re]open("nul")
On Windows, the equivalent of "/dev/null" is "nul". This implements
compatibility wrappers around fopen() and freopen() that check for this
particular file name.

The new tests exercise code paths where this is relevant.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-25 12:27:38 -08:00
Johannes Sixt
97a449ee30 t3301-notes: insert a shbang line in ./fake_editor.sh
This is required on Windows because git-notes is now a built-in
rather than a shell script.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-25 12:20:16 -08:00
Jonathan Nieder
8c33b4cf67 tests: Fix race condition in t7006-pager
Pagers that do not consume their input are dangerous: for example,

 $ GIT_PAGER=: git log
 $ echo $?
 141
 $

The only reason these tests were able to work before was that
'git log' would write to the pipe (and not fill it) before the
pager had time to terminate and close the pipe.

Fix it by using a program that consumes its input, namely wc (as
suggested by Johannes).

Reported-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-22 14:19:28 -08:00
Larry D'Anna
1caaf225f8 git-diff: add a test for git diff --quiet -w
This patch adds two test cases for:

6977c25 git diff --quiet -w: check and report the status

Signed-off-by: Larry D'Anna <larry@elder-gods.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-21 21:57:19 -08:00
Junio C Hamano
5f8a0de98b Merge branch 'sp/push-sideband'
* sp/push-sideband:
  receive-pack: Send internal errors over side-band #2
  t5401: Use a bare repository for the remote peer
  receive-pack: Send hook output over side band #2
  receive-pack: Wrap status reports inside side-band-64k
  receive-pack: Refactor how capabilities are shown to the client
  send-pack: demultiplex a sideband stream with status data
  run-command: support custom fd-set in async
  run-command: Allow stderr to be a caller supplied pipe
2010-02-21 12:00:07 -08:00
Junio C Hamano
25666af37b Merge branch 'jc/checkout-detached'
* jc/checkout-detached:
  Reword "detached HEAD" notification
2010-02-21 11:59:42 -08:00
Junio C Hamano
92de348948 Merge branch 'jc/maint-fix-test-perm'
* jc/maint-fix-test-perm:
  lib-patch-mode.sh: Fix permission
  t6000lib: Fix permission
2010-02-21 11:59:35 -08:00
Jonathan Nieder
2d3ca21677 t7006-pager: if stdout is not a terminal, make a new one
Testing pagination requires (fake or real) access to a terminal so we
can see whether the pagination automatically kicks in, which makes it
hard to get good coverage when running tests without --verbose.  There
are a number of ways to work around that:

 - Replace all isatty calls with calls to a custom xisatty wrapper
   that usually checks for a terminal but can be overridden for tests.
   This would be workable, but it would require implementing xisatty
   separately in three languages (C, shell, and perl) and making sure
   that any code that is to be tested always uses the wrapper.

 - Redirect stdout to /dev/tty.  This would be problematic because
   there might be no terminal available, and even if a terminal is
   available, it might not be appropriate to spew output to it.

 - Create a new pseudo-terminal on the fly and capture its output.

This patch implements the third approach.

The new test-terminal.perl helper uses IO::Pty from Expect.pm to create
a terminal and executes the program specified by its arguments with
that terminal as stdout.  If the IO::Pty module is missing or not
working on a system, the test script will maintain its old behavior
(skipping most of its tests unless GIT_TEST_OPTS includes --verbose).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-21 11:08:17 -08:00
Junio C Hamano
1958e5be90 Merge branch 'maint'
* maint:
  git-p4: fix bug in symlink handling
  t1450: fix testcases that were wrongly expecting failure
  Documentation: Fix indentation problem in git-commit(1)
2010-02-20 10:38:42 -08:00
Jonathan Nieder
60b6e2200d tests: Add tests for automatic use of pager
Git’s automatic pagination support has some subtleties.  Add some
tests to make sure we don’t break:

 - when git will use a pager by default;
 - the effect of the --paginate and --no-pager options;
 - the effect of pagination on use of color;
 - how the choice of pager is configured.

This does not yet test:

 - use of pager by scripted commands (git svn and git am);
 - effect of the pager.* configuration variables;
 - setting of the LESS variable.

Some features involve checking whether stdout is a terminal, so many
of these tests are skipped unless output is passed through to the
terminal (i.e., unless $GIT_TEST_OPTS includes --verbose).

The immediate purpose for these tests was to avoid making things worse
after the breakage from my jn/editor-pager series (see commit 376f39,
2009-11-20).  Thanks to Sebastian Celis <sebastian@sebastiancelis.com>
for the report.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-20 09:34:28 -08:00
Thomas Rast
4551d03541 t1450: fix testcases that were wrongly expecting failure
Almost exactly a year ago in 02a6552 (Test fsck a bit harder), I
introduced two testcases that were expecting failure.

However, the only bug was that the testcases wrote *blobs* because I
forgot to pass -t tag to hash-object.  Fix this, and then adjust the
rest of the test to properly check the result.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-19 21:56:19 -08:00
Junio C Hamano
50c19c777d Merge branch 'maint'
* maint:
  rm: fix bug in recursive subdirectory removal
  Documentation: describe --thin more accurately
2010-02-19 01:31:42 -08:00
Junio C Hamano
7c0be4da5c Merge branch 'jk/maint-rmdir-fix' into maint
* jk/maint-rmdir-fix:
  rm: fix bug in recursive subdirectory removal
2010-02-19 01:31:37 -08:00
Jeff King
3fc0d131c5 rm: fix bug in recursive subdirectory removal
If we remove a path in a/deep/subdirectory, we should try to
remove as many trailing components as possible (i.e.,
subdirectory, then deep, then a). However, the test for the
return value of rmdir was reversed, so we only ever deleted
at most one level.

The fix is in remove_path, so "apply" and "merge-recursive"
also are fixed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-18 22:22:22 -08:00
Junio C Hamano
031f82f751 Merge branch 'jk/grep-double-dash' into maint
* jk/grep-double-dash:
  accept "git grep -- pattern"
2010-02-17 14:55:15 -08:00
Johan Herland
3deea89c5f submodule summary: Don't barf when invoked in an empty repo
When invoking "git submodule summary" in an empty repo (which can be
indirectly done by setting status.submodulesummary = true), it currently
emits an error message (via "git diff-index") since HEAD points to an
unborn branch.

This patch adds handling of the HEAD-points-to-unborn-branch special case,
so that "git submodule summary" no longer emits this error message.

The patch also adds a test case that verifies the fix.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-17 11:14:04 -08:00
Junio C Hamano
72cd63c008 Merge branch 'maint'
* maint:
  Prepare 1.7.0.1 release notes
  Fix use of mutex in threaded grep
  dwim_ref: fix dangling symref warning
  stash pop: remove 'apply' options during 'drop' invocation
  diff: make sure --output=/bad/path is caught
  Remove hyphen from "git-command" in two error messages
2010-02-16 22:40:45 -08:00
Junio C Hamano
e7b3cea0f7 Merge branch 'maint-1.6.6' into maint
* maint-1.6.6:
  dwim_ref: fix dangling symref warning
  stash pop: remove 'apply' options during 'drop' invocation
  diff: make sure --output=/bad/path is caught
  Remove hyphen from "git-command" in two error messages
2010-02-16 15:05:02 -08:00
Junio C Hamano
eb0bcd0fbe Merge branch 'maint-1.6.5' into maint-1.6.6
* maint-1.6.5:
  dwim_ref: fix dangling symref warning
  stash pop: remove 'apply' options during 'drop' invocation
  diff: make sure --output=/bad/path is caught
2010-02-16 15:04:55 -08:00
Thomas Rast
460ccd0e19 stash pop: remove 'apply' options during 'drop' invocation
The 'git stash pop' option parsing used to remove the first argument
in --index mode.  At the time this was implemented, this first
argument was always --index.  However, since the invention of the -q
option in fcdd0e9 (stash: teach quiet option, 2009-06-17) you can
cause an internal invocation of

  git stash drop --index

by running

  git stash pop -q --index

which then of course fails because drop doesn't know --index.

To handle this, instead let 'git stash apply' decide what the future
argument to 'drop' should be.

Warning: this means that 'git stash apply' must parse all options that
'drop' can take, and deal with them in the same way.  This is
currently true for its only option -q.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-15 21:46:27 -08:00
Junio C Hamano
263830c47b Merge branch 'rs/git-dir-cleanup'
* rs/git-dir-cleanup:
  Resurrect "git grep --no-index"
  setenv(GIT_DIR) clean-up

Conflicts:
	builtin-grep.c
	t/t7002-grep.sh
2010-02-13 15:09:33 -08:00
Junio C Hamano
e7c2466593 Merge branch 'jk/grep-double-dash'
* jk/grep-double-dash:
  accept "git grep -- pattern"
2010-02-13 15:09:33 -08:00
Junio C Hamano
59332d13b2 Resurrect "git grep --no-index"
This reverts commit 3c8f6c8 (Revert 30816237 and 7e62265, 2010-02-05) as
the issue has been sorted out.
2010-02-13 15:07:14 -08:00
Junio C Hamano
d1672d90ba Sync with 1.6.6.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-10 13:46:15 -08:00
Junio C Hamano
216d2e0f3f Merge branch 'maint-1.6.5' into maint
* maint-1.6.5:
  t8003: check exit code of command and error message separately
2010-02-10 13:42:48 -08:00
Junio C Hamano
33f0ea42e1 t8003: check exit code of command and error message separately
Shell reports exit status only from the most downstream command
in a pipeline.  In these tests, we want to make sure that the
command fails in a controlled way, and produces a correct error
message.

This issue was known by Jay who submitted the patch, and also was
pointed out by Hannes during the review process, but I forgot to
fix it up before applying.  Sorry about that.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-10 13:42:29 -08:00
Junio C Hamano
57ffc0e775 Merge branch 'sp/maint-fast-import-large-blob' into maint
* sp/maint-fast-import-large-blob:
  fast-import: Stream very large blobs directly to pack
2010-02-10 13:32:20 -08:00
Junio C Hamano
410e99fadf Merge branch 'jc/maint-reflog-bad-timestamp' into maint
* jc/maint-reflog-bad-timestamp:
  t0101: use a fixed timestamp when searching in the reflog
  Update @{bogus.timestamp} fix not to die()
  approxidate_careful() reports errorneous date string
2010-02-10 13:02:43 -08:00
Junio C Hamano
b0e67fffb4 Merge branch 'jh/maint-config-file-prefix' into maint
* jh/maint-config-file-prefix:
  builtin-config: Fix crash when using "-f <relative path>" from non-root dir
2010-02-10 13:02:05 -08:00
Junio C Hamano
a42332c217 Merge branch 'jc/maint-1.6.1-checkout-m-custom-merge' into maint
* jc/maint-1.6.1-checkout-m-custom-merge:
  checkout -m path: fix recreating conflicts

Conflicts:
	t/t7201-co.sh
2010-02-10 12:54:15 -08:00
Junio C Hamano
cc8eb6407e Merge branch 'sp/maint-push-sideband' into sp/push-sideband
* sp/maint-push-sideband:
  receive-pack: Send internal errors over side-band #2
  t5401: Use a bare repository for the remote peer

Conflicts:
	builtin-receive-pack.c
	t/t5401-update-hooks.sh
2010-02-10 10:00:49 -08:00
Shawn O. Pearce
466dbc42f5 receive-pack: Send internal errors over side-band #2
If the client has requested side-band-64k capability, send any
of the internal error or warning messages in the muxed side-band
stream using the same band as our hook output, band #2.  By putting
everything in one stream we ensure all messages are processed by
the side-band demuxer, avoiding interleaving between our own stderr
and the side-band demuxer's stderr buffers.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-10 09:51:07 -08:00
Shawn O. Pearce
6b3fa7e7d1 t5401: Use a bare repository for the remote peer
We want to avoid the warnings (or later, test failures) about
updating the current branch.  It was never my intention to have
this test deal with a repository with a working directory, and it
is a very old bug that the test even used a non-bare repository
for the remote side of the push operations.

This fixes the interleaved output error we were seeing as a test
failure by avoiding the giant warning message we were getting back
about updating the current branch being risky.

Its not a real fix, but is something we should do no matter what,
because the behavior will change in the future to reject, and the
test would break at that time.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-09 19:25:36 -08:00
Brian Gernhardt
8b2337a589 t3902: Protect against OS X normalization
8424981: "Fix invalid read in quote_c_style_counted" introduced a test
that used "caractère spécial" as a directory name.

Git creates it as "caract\303\250re sp\303\251cial"
OS X stores it as "caracte\314\200re spe\314\201cial"

To work around this problem, use the already introduced $FN as the
directory name.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-08 23:06:08 -08:00