]> asedeno.scripts.mit.edu Git - git.git/log
git.git
14 years agoMerge branch 'maint'
Junio C Hamano [Fri, 20 Aug 2010 19:55:41 +0000 (12:55 -0700)]
Merge branch 'maint'

* maint:
  xmalloc: include size in the failure message

14 years agoMerge branch 'jc/maint-follow-rename-fix' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:09 +0000 (12:53 -0700)]
Merge branch 'jc/maint-follow-rename-fix' into maint

* jc/maint-follow-rename-fix:
  log: test for regression introduced in v1.7.2-rc0~103^2~2
  diff --follow: do call diffcore_std() as necessary
  diff --follow: do not waste cycles while recursing

14 years agoMerge branch 'jn/maint-plug-leak' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:09 +0000 (12:53 -0700)]
Merge branch 'jn/maint-plug-leak' into maint

* jn/maint-plug-leak:
  write-tree: Avoid leak when index refers to an invalid object
  read-tree: stop leaking tree objects
  core: Stop leaking ondisk_cache_entrys

14 years agoMerge branch 'jn/fix-abbrev' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:09 +0000 (12:53 -0700)]
Merge branch 'jn/fix-abbrev' into maint

* jn/fix-abbrev:
  examples/commit: use --abbrev for commit summary
  checkout, commit: remove confusing assignments to rev.abbrev
  archive: abbreviate substituted commit ids again

14 years agoMerge branch 'vs/doc-spell' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:08 +0000 (12:53 -0700)]
Merge branch 'vs/doc-spell' into maint

* vs/doc-spell:
  Documentation: spelling fixes

14 years agoMerge branch 'jn/rebase-rename-am' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:08 +0000 (12:53 -0700)]
Merge branch 'jn/rebase-rename-am' into maint

* jn/rebase-rename-am:
  rebase: protect against diff.renames configuration
  t3400 (rebase): whitespace cleanup
  Teach "apply --index-info" to handle rename patches
  t4150 (am): futureproof against failing tests
  t4150 (am): style fix

14 years agoMerge branch 'jn/doc-pull' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:08 +0000 (12:53 -0700)]
Merge branch 'jn/doc-pull' into maint

* jn/doc-pull:
  Documentation: flesh out “git pull” description

14 years agoMerge branch 'bc/use-more-hardlinks-in-install' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:07 +0000 (12:53 -0700)]
Merge branch 'bc/use-more-hardlinks-in-install' into maint

* bc/use-more-hardlinks-in-install:
  Makefile: make hard/symbolic links for non-builtins too
  Makefile: link builtins residing in bin directory to main git binary too

14 years agoMerge branch 'tr/rfc-reset-doc' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:07 +0000 (12:53 -0700)]
Merge branch 'tr/rfc-reset-doc' into maint

* tr/rfc-reset-doc:
  Documentation/reset: move "undo permanently" example behind "make topic"
  Documentation/reset: reorder examples to match description
  Documentation/reset: promote 'examples' one section up
  Documentation/reset: separate options by mode
  Documentation/git-reset: reorder modes for soft-mixed-hard progression

14 years agobuiltin/checkout: Fix message when switching to an existing branch
Ramkumar Ramachandra [Fri, 20 Aug 2010 17:41:47 +0000 (23:11 +0530)]
builtin/checkout: Fix message when switching to an existing branch

Fix "Switched to a new branch <name>" to read "Switched to branch
<name>" when <name> corresponds to an existing branch. This bug was
introduced in 02ac983 while introducing the `-B` switch.

Cc: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: set a !DOCTYPE for user manual
Jonathan Nieder [Fri, 20 Aug 2010 05:04:02 +0000 (00:04 -0500)]
Documentation: set a !DOCTYPE for user manual

asciidoc already takes care of including a doctype for most of the
HTML documentation, but the user manual which is processed with
docbook-xsl directly lacks one (at least with Debian docbook-xsl
1.75.2+dfsg-5).  This makes it harder to automatically validate the
HTML.

Reported-by: 積丹尼 <jidanni@jidanni.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoxmalloc: include size in the failure message
Matthieu Moy [Fri, 20 Aug 2010 15:09:51 +0000 (17:09 +0200)]
xmalloc: include size in the failure message

Out-of-memory errors can either be actual lack of memory, or bugs (like
code trying to call xmalloc(-1) by mistake). A little more information
may help tracking bugs reported by users.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge-recursive: Avoid excessive output for and reprocessing of renames
Elijah Newren [Fri, 20 Aug 2010 12:55:40 +0000 (06:55 -0600)]
merge-recursive: Avoid excessive output for and reprocessing of renames

In 5a2580d (merge_recursive: Fix renames across paths below D/F conflicts
2010-07-09) and ae74548 (merge-recursive: Fix multiple file rename across
D/F conflict 2010-08-17), renames across D/F conflicts were fixed by
making process_renames() consider as unprocessed renames whose dst_entry
"still" had higher stage entries.  The assumption was that those higher
stage entries would have been cleared out of dst_entry by that point in
cases where the conflict could be resolved (normal renames with no D/F
conflicts).  That is not the case -- higher stage entries will remain in
all cases.

Fix this by checking for higher stage entries corresponding to D/F
conflicts, namely that stages 2 and 3 have exactly one nonzero mode between
them.  The nonzero mode stage corresponds to a file at the path, while the
stage with a zero mode will correspond to a directory at that path (since
rename/delete conflicts will have already been handled before this codepath
is reached.)

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint' to sync with 1.7.2.2
Junio C Hamano [Thu, 19 Aug 2010 23:04:41 +0000 (16:04 -0700)]
Merge branch 'maint' to sync with 1.7.2.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGit 1.7.2.2 v1.7.2.2
Junio C Hamano [Thu, 19 Aug 2010 23:03:18 +0000 (16:03 -0700)]
Git 1.7.2.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'tr/xsize-bits' into maint
Junio C Hamano [Thu, 19 Aug 2010 22:49:54 +0000 (15:49 -0700)]
Merge branch 'tr/xsize-bits' into maint

* tr/xsize-bits:
  xsize_t: check whether we lose bits

14 years agoMerge branch 'jc/sha1-name-find-fix' into maint
Junio C Hamano [Thu, 19 Aug 2010 22:49:24 +0000 (15:49 -0700)]
Merge branch 'jc/sha1-name-find-fix' into maint

* jc/sha1-name-find-fix:
  sha1_name.c: fix parsing of ":/token" syntax

Conflicts:
sha1_name.c

14 years agoautoconf: don't use platform regex if it lacks REG_STARTEND
Jonathan Nieder [Tue, 17 Aug 2010 09:24:42 +0000 (09:24 +0000)]
autoconf: don't use platform regex if it lacks REG_STARTEND

If the platform regex cannot match null bytes, we might as well
use the glibc version instead.

Cc: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Cc: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Tested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND
Ævar Arnfjörð Bjarmason [Tue, 17 Aug 2010 09:24:41 +0000 (09:24 +0000)]
t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND

Now that we have a regex engine that supports REG_STARTEND this test
should fail if "git grep" can't grep NULL characters.

Platforms that don't have a POSIX regex engine which supports
REG_STARTEND should always define NO_REGEX=YesPlease when compiling.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocompat/regex: get rid of old-style definition
Junio C Hamano [Thu, 19 Aug 2010 22:31:30 +0000 (15:31 -0700)]
compat/regex: get rid of old-style definition

These files mostly used ANSI style function definitions, but with small
number of old-style ones.  Convert them to consistently use ANSI style.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t9010-svn-fe.sh: add an +x bit to this test
Ævar Arnfjörð Bjarmason [Thu, 19 Aug 2010 15:53:50 +0000 (15:53 +0000)]
t/t9010-svn-fe.sh: add an +x bit to this test

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocompat/regex: define out variables only used under RE_ENABLE_I18N
Ævar Arnfjörð Bjarmason [Thu, 19 Aug 2010 18:30:01 +0000 (18:30 +0000)]
compat/regex: define out variables only used under RE_ENABLE_I18N

Wrap variables that were only used RE_ENABLE_I18N in `#ifdef
RE_ENABLE_I18N`. This eliminates compiler warnings when compiling with
NO_REGEX=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot9155: fix compatibility with older SVN
Eric Wong [Thu, 19 Aug 2010 19:03:18 +0000 (12:03 -0700)]
t9155: fix compatibility with older SVN

The "--parents" option did not appear until SVN 1.5.x
and is completely unnecessary in this case.

Reported-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
14 years agoMerge branch 'sp/fix-smart-http-deadlock-on-error' into maint
Junio C Hamano [Wed, 18 Aug 2010 23:30:11 +0000 (16:30 -0700)]
Merge branch 'sp/fix-smart-http-deadlock-on-error' into maint

* sp/fix-smart-http-deadlock-on-error:
  smart-http: Don't deadlock on server failure

14 years agogit-gui: ensure correct application termination in git-gui--askpass
Pat Thoyts [Wed, 18 Aug 2010 22:19:24 +0000 (23:19 +0100)]
git-gui: ensure correct application termination in git-gui--askpass

With Tk 8.5 the askpass utility can hang waiting for the wish shell
implicit event loop to exit. This patch uses an explicit event loop
to ensure correct application termination.

Reported-by: Anders Kaseorg <andersk@mit.edu>
Tested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
14 years agoChange regerror() declaration from K&R style to ANSI C (C89)
Frank Li [Tue, 17 Aug 2010 09:24:40 +0000 (09:24 +0000)]
Change regerror() declaration from K&R style to ANSI C (C89)

The MSVC headers typedef errcode as int, and thus confused the compiler in
the K&R style definition. ANSI style deconfuses it.

This patch was originally applied as v1.6.5-rc2~23 but needs to be
re-applied since compat/regex was overwritten by Ævar Arnfjörð
Bjarmason with the gawk regex engine.

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocompat/regex: get the gawk regex engine to compile within git
Ævar Arnfjörð Bjarmason [Tue, 17 Aug 2010 09:24:39 +0000 (09:24 +0000)]
compat/regex: get the gawk regex engine to compile within git

We need to define -DGAWK -DNO_MBSUPPORT so that the gawk regex engine
will compile, and include stdio.h and stddef.h in regex.h. Gawk itself
includes these headers before it includes the regex.h header.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocompat/regex: use the regex engine from gawk for compat
Ævar Arnfjörð Bjarmason [Tue, 17 Aug 2010 09:24:38 +0000 (09:24 +0000)]
compat/regex: use the regex engine from gawk for compat

Change the regex engine in compat to use the gawk engine from the
gawk-devel module in gawk CVS. This engine supports the REG_STARTEND
flag, which was optionally available in Git since v1.7.2-rc0~77^2~1.

The source was grabbed from cvs.savannah.gnu.org:/sources/gawk, and
these are the upstream versions of the files being included:

    regcomp.c               1.4
    regex.h                 1.3
    regex.h                 1.3
    regex_internal.c        1.3
    regex_internal.h        1.3
    regexec.c               1.3

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: learn --[no-]rerere-autoupdate
Jonathan Nieder [Tue, 17 Aug 2010 07:13:40 +0000 (02:13 -0500)]
merge script: learn --[no-]rerere-autoupdate

Port v1.7.0-rc0~83^2 (Teach --[no-]rerere-autoupdate option to
merge, revert and friends, 2009-12-04) to the example merge script.

After this change, all tests pass for me with the scripted
merge.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: notice @{-1} shorthand
Jonathan Nieder [Tue, 17 Aug 2010 07:11:30 +0000 (02:11 -0500)]
merge script: notice @{-1} shorthand

Port v1.6.2-rc1~10^2 (Teach @{-1} to git merge, 2009-02-13) to
the old merge script.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: handle --no-ff --no-commit correctly
Jonathan Nieder [Tue, 17 Aug 2010 07:11:03 +0000 (02:11 -0500)]
merge script: handle --no-ff --no-commit correctly

In a --no-ff merge with conflicts, "git commit" used to forget the
--no-ff when used to complete the merge.  That was fixed by
v1.6.1-rc1~134^2 (builtin-commit: use reduce_heads() only when
appropriate, 2008-10-03) for the builtin merge.  Port the change to
the merge script in contrib/examples.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: --ff-only to disallow true merge
Jonathan Nieder [Tue, 17 Aug 2010 07:10:17 +0000 (02:10 -0500)]
merge script: --ff-only to disallow true merge

Port v1.6.6-rc0~62^2 (Teach 'git merge' and 'git pull' the option
--ff-only, 2009-10-29) to the old merge script.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: handle many-way octopus
Jonathan Nieder [Tue, 17 Aug 2010 07:09:58 +0000 (02:09 -0500)]
merge script: handle many-way octopus

Based on v1.6.0-rc0~51^2~5 (Build in merge, 2008-07-07).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: handle -m --log correctly
Jonathan Nieder [Tue, 17 Aug 2010 07:06:56 +0000 (02:06 -0500)]
merge script: handle -m --log correctly

Based on v1.7.1.1~23^2 (merge: --log appends shortlog to message if
specified, 2010-05-11).  Without this change, the scripted
(non-builtin) merge does not pass t7604.

Cc: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: forbid merge -s index
Jonathan Nieder [Tue, 17 Aug 2010 07:06:06 +0000 (02:06 -0500)]
merge script: forbid merge -s index

Some git-merge-* commands are not merge strategies.  This is based on
v1.6.1-rc1~294^2~7 (builtin-merge: allow using a custom strategy,
2008-07-30) but it is less smart: we just use a hard-coded list of
forbidden strategy names.  It is okay if this falls out of date, since
the code is just an example.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: allow custom strategies
Jonathan Nieder [Tue, 17 Aug 2010 07:05:32 +0000 (02:05 -0500)]
merge script: allow custom strategies

The idea comes from v1.6.1-rc1~294^2~7 (builtin-merge: allow using a
custom strategy, 2008-07-30).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: merge -X<option>
Jonathan Nieder [Tue, 17 Aug 2010 07:05:10 +0000 (02:05 -0500)]
merge script: merge -X<option>

Without this support, the scripted merge cannot pass t6037.

Based on v1.7.0-rc0~55^2~5 (git merge -X<option>, 2009-11-25).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: improve log message subject
Jonathan Nieder [Tue, 17 Aug 2010 07:04:43 +0000 (02:04 -0500)]
merge script: improve log message subject

 - point out remote-tracking branches as "remote branch
   'upstream/master'";
 - avoid misleading log messages when a tag and branch
   share a name.

This approximates the builtin merge command's behavior well
enough to pass the relevant tests.

Based roughly on v1.6.4.2~10^2 (merge: indicate remote tracking
branches in merge message, 2009-08-09) and v1.6.4.2~10^2~1 (merge: fix
incorrect merge message for ambiguous tag/branch, 2009-08-09).

Cc: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: refuse to merge during merge
Jonathan Nieder [Tue, 17 Aug 2010 07:03:58 +0000 (02:03 -0500)]
merge script: refuse to merge during merge

Check MERGE_HEAD and bail out if it exists.  Based on v1.6.3.3~3^2
(refuse to merge during a merge, 2009-06-01).  Without this change,
the scripted merge does not pass t3030.

Cc: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: tweak unmerged files message to match builtin
Jonathan Nieder [Tue, 17 Aug 2010 07:03:36 +0000 (02:03 -0500)]
merge script: tweak unmerged files message to match builtin

Before:

You are in the middle of a conflicted merge.

After:

Merge is not possible because you have unmerged files.

I prefer the old message, but the new one is more consistent with
other commands and tests expect it.  In particular, without this
change the scripted merge does not pass t3030.

Based on v1.7.0-rc0~66^2 (Be more user-friendly when refusing to do
something because of conflict., 2010-01-12).

Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge script: --squash, --ff from unborn branch are errors
Jonathan Nieder [Tue, 17 Aug 2010 07:03:07 +0000 (02:03 -0500)]
merge script: --squash, --ff from unborn branch are errors

Port v1.6.1-rc1~319 (provide more errors for the "merge into empty
head" case, 2008-08-21) to the example merge script.

Noticed by comparison with builtin merge.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofmt-merge-msg -m to override merge title
Jonathan Nieder [Tue, 17 Aug 2010 23:00:34 +0000 (18:00 -0500)]
fmt-merge-msg -m to override merge title

Since v1.7.1.1~23^2 (merge: --log appends shortlog to message if
specified, 2010-05-11), the fmt-merge-msg backend supports custom text
to override the merge title "Merge <foo> into <bar>".

Expose this functionality for scripted callers.  Example:

 git fmt-merge-msg --log -m \
"$(printf '%s\n' \
    "Merge branch 'api-cleanup' into feature" \
    '' \
    'This is to use a few functions refactored for this purpose.'
)" <.git/FETCH_HEAD

Cc: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge-base --independent to print reduced parent list in a merge
Jonathan Nieder [Tue, 17 Aug 2010 07:01:54 +0000 (02:01 -0500)]
merge-base --independent to print reduced parent list in a merge

While show-branch --independent does not support more than MAX_REVS
revs, git internally supports more with a different algorithm.
Expose that functionality as "git merge-base --independent".

This should help scripts to catch up with builtin merge in supporting
dodecapus.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge-base --octopus to mimic show-branch --merge-base
Jonathan Nieder [Tue, 17 Aug 2010 07:01:15 +0000 (02:01 -0500)]
merge-base --octopus to mimic show-branch --merge-base

While show-branch --merge-base does not support more than MAX_REVS
revs, git supports more with a different algorithm
(v1.6.0-rc0~51^2~13, Introduce get_octopus_merge_bases() in commit.c,
2008-06-27).  Expose that functionality.

This should help scripts to catch up with builtin merge in supporting
dodecapus.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: add a SEE ALSO section for merge-base
Jonathan Nieder [Tue, 17 Aug 2010 06:59:55 +0000 (01:59 -0500)]
Documentation: add a SEE ALSO section for merge-base

For example, a person reading the merge-base man page might wonder
about the fastest way to check if one commit is an ancestor of
another (which would require rev-list).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot6200 (fmt-merge-msg): style nitpicks
Jonathan Nieder [Tue, 17 Aug 2010 06:57:40 +0000 (01:57 -0500)]
t6200 (fmt-merge-msg): style nitpicks

Guard setup with test_expect_success.  Use test_might_fail
instead of ignoring the exit code from git config --unset.
Point out setup commands that are shared by multiple tests,
to make it easy to write GIT_SKIP_TESTS specifications that
work.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot6010 (merge-base): modernize style
Jonathan Nieder [Tue, 17 Aug 2010 06:57:12 +0000 (01:57 -0500)]
t6010 (merge-base): modernize style

Guard setup with test_expect_success, put the opening quote
starting each test on the same line as the test_expect_* invocation,
and combine related actions into single tests.

While at it:

 - use test_cmp instead of expr or test $foo = $bar, for more helpful
   output with -v when tests fail;

 - use test_commit for brevity.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot7600 (merge): test merge from branch yet to be born
Jonathan Nieder [Tue, 17 Aug 2010 06:56:46 +0000 (01:56 -0500)]
t7600 (merge): test merge from branch yet to be born

Some people like to "git fetch origin && merge origin/master" from
the unborn branch provided when first initializing a repository.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot7600 (merge): check reflog entry
Jonathan Nieder [Tue, 17 Aug 2010 06:56:13 +0000 (01:56 -0500)]
t7600 (merge): check reflog entry

The details of the reflog message are not important, but
including something sane in the reflog is.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot7600 (merge): do not launch gitk for --debug
Jonathan Nieder [Tue, 17 Aug 2010 06:54:59 +0000 (01:54 -0500)]
t7600 (merge): do not launch gitk for --debug

Probably as a development aid, this test script runs gitk --all
to allow the driver to inspect history between tests when run
with --debug.  As a result, running all tests with --debug
requires closing a long series of gitk displays, one at a time.

Use git log --graph --oneline instead.  This way, the history is
available for viewing with "git show" but the test script finishes
without interaction.

Longer term, it would be nice to have an option to run a
user-specified command between tests.  This patch does not do
that.

Cc: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot7600 (merge): modernize style
Jonathan Nieder [Tue, 17 Aug 2010 06:53:56 +0000 (01:53 -0500)]
t7600 (merge): modernize style

Guard setup commands with test_expect_success, so they are easier
to visually skip over and get to the good part.  While at it:

 - use "printf '%s\n' a b ..." instead of "cat <<EOF" for test
   vectors with short lines;

 - use test_cmp instead of test foo = bar where possible, for
   better output with -v on failure;

 - do not go to extraordinary lengths to print a relevant message
   when test commands fail.  There is a patch in flight that could be
   used to restore the nice error messages in a cleaner way.

Cc: Lars Hjemli <hjemli@gmail.com>
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge: do not mistake (ancestor of) tag for branch
Jonathan Nieder [Tue, 17 Aug 2010 06:52:48 +0000 (01:52 -0500)]
merge: do not mistake (ancestor of) tag for branch

If no branch 'foo' exists but a tag 'foo' does, then
git merge foo^ results in

Merge branch 'foo' (early part)

as a commit message, because the relevant code path checks that
refs/heads/foo is a valid refname for writing rather than for
reading.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agosubmodule sync: Update "submodule.<name>.url"
David Aguilar [Wed, 18 Aug 2010 15:58:33 +0000 (08:58 -0700)]
submodule sync: Update "submodule.<name>.url"

When "git submodule sync" synchronizes the repository URLs
it only updates submodules' .git/config.  However, the old
URLs still exist in the super-project's .git/config.

Update the super-project's configuration so that commands
such as "git submodule update" use the URLs from .gitmodules.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotests: fix syntax error in "Use advise() for hints" test
Ævar Arnfjörð Bjarmason [Wed, 18 Aug 2010 14:36:44 +0000 (14:36 +0000)]
tests: fix syntax error in "Use advise() for hints" test

Change the test introduced in the "Use advise() for hints" patch by
Jonathan Nieder not to use '' for quotes inside '' delimited code. It
ended up introducing a file called <paths> to the main git repository.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'jc/maint-follow-rename-fix'
Junio C Hamano [Wed, 18 Aug 2010 19:47:18 +0000 (12:47 -0700)]
Merge branch 'jc/maint-follow-rename-fix'

* jc/maint-follow-rename-fix:
  log: test for regression introduced in v1.7.2-rc0~103^2~2
  diff --follow: do call diffcore_std() as necessary
  diff --follow: do not waste cycles while recursing

14 years agoMerge branch 'tf/string-list-init'
Junio C Hamano [Wed, 18 Aug 2010 19:47:04 +0000 (12:47 -0700)]
Merge branch 'tf/string-list-init'

* tf/string-list-init:
  string_list: Add STRING_LIST_INIT macro and make use of it.

14 years agoMerge branch 'cc/find-commit-subject'
Junio C Hamano [Wed, 18 Aug 2010 19:46:55 +0000 (12:46 -0700)]
Merge branch 'cc/find-commit-subject'

* cc/find-commit-subject:
  blame: use find_commit_subject() instead of custom code
  merge-recursive: use find_commit_subject() instead of custom code
  bisect: use find_commit_subject() instead of custom code
  revert: rename variables related to subject in get_message()
  revert: refactor code to find commit subject in find_commit_subject()
  revert: fix off by one read when searching the end of a commit subject

14 years agocvs tests: do not touch test CVS repositories shipped with source
Junio C Hamano [Mon, 16 Aug 2010 16:25:01 +0000 (09:25 -0700)]
cvs tests: do not touch test CVS repositories shipped with source

Some tests in t96xx series (cvsimport) want to write into the control area
(CVSROOT) of their test CVS repositories, but this does not work well when
the source area is made read-only (test trash directories are moved via
--root=else/where option).

Copy the supplied test CVS repository to a scratch place at the beginning
of these tests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t9602-cvsimport-branches-tags.sh: Add a PERL prerequisite
Ævar Arnfjörð Bjarmason [Fri, 13 Aug 2010 20:40:13 +0000 (20:40 +0000)]
t/t9602-cvsimport-branches-tags.sh: Add a PERL prerequisite

Change this test to declare a PERL prerequisite. These tests use the
-p switch, so they implicitly depend on Perl code, but nothing was
declaring this.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t9601-cvsimport-vendor-branch.sh: Add a PERL prerequisite
Ævar Arnfjörð Bjarmason [Fri, 13 Aug 2010 20:40:12 +0000 (20:40 +0000)]
t/t9601-cvsimport-vendor-branch.sh: Add a PERL prerequisite

Change this test to declare a PERL prerequisite. These tests use the
-p switch, so they implicitly depend on Perl code, but nothing was
declaring this.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t7105-reset-patch.sh: Add a PERL prerequisite
Ævar Arnfjörð Bjarmason [Fri, 13 Aug 2010 20:40:11 +0000 (20:40 +0000)]
t/t7105-reset-patch.sh: Add a PERL prerequisite

Change this test to declare a PERL prerequisite. These tests use the
-p switch, so they implicitly depend on Perl code, but nothing was
declaring this.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t9001-send-email.sh: convert setup code to tests
Ævar Arnfjörð Bjarmason [Fri, 13 Aug 2010 20:40:10 +0000 (20:40 +0000)]
t/t9001-send-email.sh: convert setup code to tests

Change the setup code in t/t9001-send-email.sh to use
test_expect_success. This way it isn't needlessly run in environments
where the test prerequisites aren't met.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t9001-send-email.sh: change from skip_all=* to prereq skip
Ævar Arnfjörð Bjarmason [Fri, 13 Aug 2010 20:40:09 +0000 (20:40 +0000)]
t/t9001-send-email.sh: change from skip_all=* to prereq skip

Change this test to skip test with test prerequisites, and to do setup
work in tests. This improves the skipped statistics on platforms where
the test isn't run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t9001-send-email.sh: Remove needless PROG=* assignment
Ævar Arnfjörð Bjarmason [Fri, 13 Aug 2010 20:40:08 +0000 (20:40 +0000)]
t/t9001-send-email.sh: Remove needless PROG=* assignment

Remove the PROG=* assignment from t9001-send-email.sh. It's been there
since v1.4.0-rc1~30 when the test was originally added, but only tests
that source annotate-tests.sh need it, it was seemingly introduced to
this test via copy/paste coding.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t9600-cvsimport.sh: change from skip_all=* to prereq skip
Ævar Arnfjörð Bjarmason [Fri, 13 Aug 2010 20:40:07 +0000 (20:40 +0000)]
t/t9600-cvsimport.sh: change from skip_all=* to prereq skip

Change this test to skip test with test prerequisites, and to do setup
work in tests. This improves the skipped statistics on platforms where
the test isn't run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agolib-patch-mode tests: change from skip_all=* to prereq skip
Ævar Arnfjörð Bjarmason [Fri, 13 Aug 2010 20:40:06 +0000 (20:40 +0000)]
lib-patch-mode tests: change from skip_all=* to prereq skip

Change this test to skip test with test prerequisites, and to do setup
work in tests. This improves the skipped statistics on platforms where
the test isn't run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t3701-add-interactive.sh: change from skip_all=* to prereq skip
Ævar Arnfjörð Bjarmason [Fri, 13 Aug 2010 20:40:05 +0000 (20:40 +0000)]
t/t3701-add-interactive.sh: change from skip_all=* to prereq skip

Change this test to skip test with test prerequisites, and to do setup
work in tests. This improves the skipped statistics on platforms where
the test isn't run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotests: Move FILEMODE prerequisite to lib-prereq-FILEMODE.sh
Ævar Arnfjörð Bjarmason [Fri, 13 Aug 2010 20:40:04 +0000 (20:40 +0000)]
tests: Move FILEMODE prerequisite to lib-prereq-FILEMODE.sh

Change the five tests that were all checking "git config --bool
core.filemode" to use a new FILEMODE prerequisite in
lib-prereq-FILEMODE.sh.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/Makefile: Create test-results dir for smoke target
Ævar Arnfjörð Bjarmason [Sat, 14 Aug 2010 11:37:05 +0000 (11:37 +0000)]
t/Makefile: Create test-results dir for smoke target

Change the smoke target to create a test-results directory. This was
done implicitly by the test-lib before my "test-lib: Don't write
test-results when HARNESS_ACTIVE" patch, but after that smoking from
the pu branch hasn't worked.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-notes: Run partial expensive test everywhere
Ævar Arnfjörð Bjarmason [Tue, 10 Aug 2010 23:37:48 +0000 (23:37 +0000)]
git-notes: Run partial expensive test everywhere

The git-notes expensive timing test is only expensive because it
either did 10,100,1k and 10k iterations or nothing.

Change it to do 10 by default, with an option to run the expensive
version with the old GIT_NOTES_TIMING_TESTS=ZomgYesPlease variable.

Since nobody was ostensibly running this test under TAP the code had
bitrotted so that it emitted invalid TAP. This change fixes that.

The old version would also mysteriously fail on systems without
/usr/bin/time, there's now a check for that using the multiple test
prerequisite facility.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t3300-funny-names: change from skip_all=* to prereq skip
Ævar Arnfjörð Bjarmason [Wed, 11 Aug 2010 19:04:10 +0000 (19:04 +0000)]
t/t3300-funny-names: change from skip_all=* to prereq skip

Change this test to skip test with test prerequisites, and to do setup
work in tests. This improves the skipped statistics on platforms where
the test isn't run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t3902-quoted: change from skip_all=* to prereq skip
Ævar Arnfjörð Bjarmason [Wed, 11 Aug 2010 19:04:09 +0000 (19:04 +0000)]
t/t3902-quoted: change from skip_all=* to prereq skip

Change this test to skip test with test prerequisites, and to do setup
work in tests. This improves the skipped statistics on platforms where
the test isn't run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t4016-diff-quote: change from skip_all=* to prereq skip
Ævar Arnfjörð Bjarmason [Wed, 11 Aug 2010 19:04:08 +0000 (19:04 +0000)]
t/t4016-diff-quote: change from skip_all=* to prereq skip

Change this test to skip test with test prerequisites, and to do setup
work in tests. This improves the skipped statistics on platforms where
the test isn't run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t5503-tagfollow: change from skip_all=* to prereq skip
Ævar Arnfjörð Bjarmason [Wed, 11 Aug 2010 19:04:07 +0000 (19:04 +0000)]
t/t5503-tagfollow: change from skip_all=* to prereq skip

Change this test to skip test with test prerequisites, and to do setup
work in tests. This improves the skipped statistics on platforms where
the test isn't run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t7005-editor: change from skip_all=* to prereq skip
Ævar Arnfjörð Bjarmason [Wed, 11 Aug 2010 19:04:06 +0000 (19:04 +0000)]
t/t7005-editor: change from skip_all=* to prereq skip

Change this test to skip test with test prerequisites, and to do setup
work in tests. This improves the skipped statistics on platforms where
the test isn't run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t5705-clone-2gb: change from skip_all=* to prereq skip
Ævar Arnfjörð Bjarmason [Wed, 11 Aug 2010 19:04:05 +0000 (19:04 +0000)]
t/t5705-clone-2gb: change from skip_all=* to prereq skip

Change this test to skip test with test prerequisites, and to do setup
work in tests. This improves the skipped statistics on platforms where
the test isn't run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t1304-default-acl: change from skip_all=* to prereq skip
Ævar Arnfjörð Bjarmason [Wed, 11 Aug 2010 19:04:04 +0000 (19:04 +0000)]
t/t1304-default-acl: change from skip_all=* to prereq skip

Change this test to skip test with test prerequisites, and to do setup
work in tests. This improves the skipped statistics on platforms where
the test isn't run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/README: Update "Skipping tests" to align with best practices
Ævar Arnfjörð Bjarmason [Wed, 28 Jul 2010 10:34:59 +0000 (10:34 +0000)]
t/README: Update "Skipping tests" to align with best practices

The example I initially added to "Skipping tests" wasn't very
good. We'd rather skip tests using the three-arg prereq form to the
test_* functions, not bail out with a skip message.

Change the documentation to reflect that, but retain the bailout
example under a disclaimer which explains that it's probably not a
good idea to use it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t7800-difftool.sh: Skip with prereq on no PERL
Ævar Arnfjörð Bjarmason [Wed, 28 Jul 2010 10:34:58 +0000 (10:34 +0000)]
t/t7800-difftool.sh: Skip with prereq on no PERL

Change t/t7800-difftool.sh to to skip with the the three-arg prereq
form of test_expect_success instead of bailing out.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t5800-remote-helpers.sh: Skip with prereq on python <2.4
Ævar Arnfjörð Bjarmason [Wed, 28 Jul 2010 10:34:57 +0000 (10:34 +0000)]
t/t5800-remote-helpers.sh: Skip with prereq on python <2.4

Change the t/t5800-remote-helpers.sh test to skip with the the
three-arg prereq form of test_expect_success instead of bailing out.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t4004-diff-rename-symlink.sh: use three-arg <prereq>
Ævar Arnfjörð Bjarmason [Wed, 28 Jul 2010 10:34:56 +0000 (10:34 +0000)]
t/t4004-diff-rename-symlink.sh: use three-arg <prereq>

Change the tests that skipped due to unavailable SYMLINKS support to
use the three-arg prereq form of test_expect_success.

This is like the "tests: implicitly skip SYMLINKS tests using
<prereq>" change, but I needed to create an additional test for some
setup code. It's in a separate change as suggested by Jonathan Nieder
for ease of reviewing.

    Date: Tue, 27 Jul 2010 16:17:37 -0500
    From: Jonathan Nieder <jrnieder@gmail.com>
    Message-ID: <20100727211737.GA11768@burratino>
In-Reply-To: <1280265254-19642-2-git-send-email-avarab@gmail.com>
    Subject: Re: [PATCH 1/4] tests: implicitly skip SYMLINKS tests using <prereq>

    Ævar Arnfjörð Bjarmason wrote:

    > +++ b/t/t4004-diff-rename-symlink.sh
    > @@ -40,8 +34,9 @@ test_expect_success \
    >  # rezrov and nitfol are rename/copy of frotz and bozbar should be
    >  # a new creation.
    >
    > -GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree >current
    > -cat >expected <<\EOF
    > +test_expect_success SYMLINKS 'setup diff output' "
    > +    GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree >current
    > +    cat >expected <<\EOF
    >  diff --git a/bozbar b/bozbar
    >  new file mode 120000
    >  --- /dev/null

    Probably belongs in a separate patch.  More importantly, it is missing
    &&-chaining (not a regression, but it is best to set a good example).

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotests: implicitly skip SYMLINKS tests using <prereq>
Ævar Arnfjörð Bjarmason [Wed, 28 Jul 2010 10:34:55 +0000 (10:34 +0000)]
tests: implicitly skip SYMLINKS tests using <prereq>

Change the tests that skipped due to unavailable SYMLINKS support to
use the three-arg prereq form of test_expect_success.

Now we get an indication of how many tests that need symlinks are
being skipped on platforms that don't support them.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMakefile: make gcov invocation configurable
Thomas Rast [Mon, 26 Jul 2010 07:43:41 +0000 (09:43 +0200)]
Makefile: make gcov invocation configurable

If you customize CC to use a different version of gcc, most likely you
also need to use a different version of gcov.  Make it configurable.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/README: Add a note about the dangers of coverage chasing
Ævar Arnfjörð Bjarmason [Sun, 25 Jul 2010 19:52:45 +0000 (19:52 +0000)]
t/README: Add a note about the dangers of coverage chasing

Having no coverage at all is almost always a bad sign, but trying to
attain 100% coverage everywhere is usually a waste of time. Add a
paragraph to explain this to future test writers.

Inspired-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/README: A new section about test coverage
Ævar Arnfjörð Bjarmason [Sun, 25 Jul 2010 19:52:44 +0000 (19:52 +0000)]
t/README: A new section about test coverage

Document how test writers can generate coverage reports, to ensure
that their tests are really testing the code they think they're
testing.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMakefile: Add cover_db_html target
Ævar Arnfjörð Bjarmason [Sun, 25 Jul 2010 19:52:43 +0000 (19:52 +0000)]
Makefile: Add cover_db_html target

Add a target to generate a detailed HTML report for the entire Git
codebase using Devel::Cover's cover(1) tool. Output it in
cover_db_html instead of the default cover_db, so that it isn't mixed
up with our raw report files.

The target depends on the coverage-report-cover-db target, it may be
run redundantly if it was previously run. But the HTML output won't be
affected by running gcov2perl twice, so I didn't try to avoid that
small redundancy.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMakefile: Add cover_db target
Ævar Arnfjörð Bjarmason [Sun, 25 Jul 2010 19:52:42 +0000 (19:52 +0000)]
Makefile: Add cover_db target

Add a target to convert the *.gcov files to a Devel::Cover
database. That database can subsequently be formatted by the cover(1)
tool which is included with Devel::Cover.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMakefile: Split out the untested functions target
Ævar Arnfjörð Bjarmason [Sun, 25 Jul 2010 19:52:41 +0000 (19:52 +0000)]
Makefile: Split out the untested functions target

Change the coverage-report target so that it doesn't generate the
coverage-untested-functions file by default. I'm adding more targets
for doing various things with the gcov files, and they shouldn't all
run by default.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMakefile: Include subdirectories in "make cover" reports
Ævar Arnfjörð Bjarmason [Sun, 25 Jul 2010 19:52:40 +0000 (19:52 +0000)]
Makefile: Include subdirectories in "make cover" reports

We generate profiling files in all the $(OBJECTS) dirs. Aggregate
results from there, and add them to the corresponding clean target.

Also expand the gcov arguments. Generate reports for things like "x()
|| y()" using --all-blocks, and add --preserve-paths since we're
profiling in subdirectories now.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitignore: Ignore files generated by "make coverage"
Ævar Arnfjörð Bjarmason [Sun, 25 Jul 2010 19:52:39 +0000 (19:52 +0000)]
gitignore: Ignore files generated by "make coverage"

The "make coverage" support added by Thomas Rast in 901c369af5 didn't
contain a corresponding patch to patch .gitignore.

Change gitignore to ignore the *.gcda, *.gcno and *.gcov files
generated by GCC and our coverage invocations.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/README: Add SMOKE_{COMMENT,TAGS}= to smoke_report target
Ævar Arnfjörð Bjarmason [Sun, 8 Aug 2010 14:49:27 +0000 (14:49 +0000)]
t/README: Add SMOKE_{COMMENT,TAGS}= to smoke_report target

The smoke server supports a free form text field with comments about a
report, and a comma delimited list of tags. Change the smoke_report
target to expose this functionality. Now smokers can send more data
that explains and categorizes the reports they're submitting.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/Makefile: Can't include GIT-BUILD-OPTIONS, it's a .sh
Ævar Arnfjörð Bjarmason [Sun, 8 Aug 2010 14:49:26 +0000 (14:49 +0000)]
t/Makefile: Can't include GIT-BUILD-OPTIONS, it's a .sh

Change the smoke testing portion of t/Makefile not to include
GIT-BUILD-OPTIONS. It's a shellscript, not a Makefile snippet, so it
had the nasty side-effect of sneaking e.g. SHELL_PATH = '/bin/sh'
(with quotes) everywhere.

Just add our own PERL_PATH variable as a workaround. The t/Makefile
already has e.g. an equivalent SHELL_PATH and TAR option which
duplicate the definitions in GIT-BUILD-OPTIONS.

Reported-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/README: Document the Smoke testing
Ævar Arnfjörð Bjarmason [Sun, 8 Aug 2010 14:49:25 +0000 (14:49 +0000)]
t/README: Document the Smoke testing

Git now has a smoke testing service at http://smoke.git.nix.is that
anyone can send reports to. Change the t/README file to mention this.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotests: Infrastructure for Git smoke testing
Ævar Arnfjörð Bjarmason [Sun, 8 Aug 2010 14:49:24 +0000 (14:49 +0000)]
tests: Infrastructure for Git smoke testing

Add the capability to send smoke reports from the Git test suite.

Currently we only notice bugs in the test suite when it's run
manually. Bugs in Git that only occur on obscure platforms or setups
that the core developers aren't using can thus go unnoticed.

This series aims to change that. With it, anyone that's interested in
avoiding bitrot in Git can volunteer to run a smoke tester. A smoke
tester periodically compiles the latest version of Git, runs the test
suite, and submits a report to a central server indicating how the
test run went.

A smoke tester might run something like this in cron:

    #!/bin/sh
    cd ~/g/git
    git fetch
    for branch in maint master next pu; do
        git checkout origin/$i &&
        make clean all &&
        cd t &&
        make smoke_report
    done

The smoker might want to compile git with non-default flags, include
bisecting functionality or run the tests under valgrind. Doing that is
outside the scope of this patch, this just adds a report submission
mechanism. But including a canonical smoke runner is something we'll
want to include eventually.

What this does now is add smoke and smoke_report targets to t/Makefile
(this example only uses a few tests for demonstration):

    $ make clean smoke
    rm -f -r 'trash directory'.* test-results
    rm -f t????/cvsroot/CVSROOT/?*
    rm -f -r valgrind/bin
    rm -f .prove
    perl ./harness --git-version="1.7.2.1.173.gc9b40" \
                    --no-verbose \
                    --archive="test-results/git-smoke.tar.gz" \
                    t0000-basic.sh t0001-init.sh t0002-gitfile.sh t0003-attributes.sh t0004-unwritable.sh t0005-signals.sh t0006-date.sh
    t0000-basic.sh ....... ok
    t0001-init.sh ........ ok
    t0002-gitfile.sh ..... ok
    t0003-attributes.sh .. ok
    t0004-unwritable.sh .. ok
    t0005-signals.sh ..... ok
    t0006-date.sh ........ ok
    All tests successful.

    Test Summary Report
    -------------------
    t0000-basic.sh     (Wstat: 0 Tests: 46 Failed: 0)
      TODO passed:   5
    Files=7, Tests=134,  3 wallclock secs ( 0.06 usr  0.05 sys +  0.23 cusr  1.33 csys =  1.67 CPU)
    Result: PASS

    TAP Archive created at /home/avar/g/git/t/test-results/git-smoke.tar.gz

The smoke target uses TAP::Harness::Archive to aggregate the test
results into a tarball. The tarball contains two things, the output of
every test file that was run, and a metadata file:

Tarball contents:

    $ tar xzvf git-smoke.tar.gz
    t0004-unwritable.sh
    t0001-init.sh
    t0002-gitfile.sh
    t0005-signals.sh
    t0000-basic.sh
    t0003-attributes.sh
    t0006-date.sh
    meta.yml

A test report:

    $ cat t0005-signals.sh
    ok 1 - sigchain works
    # passed all 1 test(s)
    1..1

A metadata file:

    ---
    extra_properties:
    file_attributes:
      -
        description: t0000-basic.sh
        end_time: 1280437324.61398
        start_time: 1280437324.22186
      -
        description: t0001-init.sh
        end_time: 1280437325.12346
        start_time: 1280437324.62393
      -
        description: t0002-gitfile.sh
        end_time: 1280437325.29428
        start_time: 1280437325.13646
      -
        description: t0003-attributes.sh
        end_time: 1280437325.59678
        start_time: 1280437325.30565
      -
        description: t0004-unwritable.sh
        end_time: 1280437325.77376
        start_time: 1280437325.61003
      -
        description: t0005-signals.sh
        end_time: 1280437325.85426
        start_time: 1280437325.78727
      -
        description: t0006-date.sh
        end_time: 1280437326.2362
        start_time: 1280437325.86768
    file_order:
      - t0000-basic.sh
      - t0001-init.sh
      - t0002-gitfile.sh
      - t0003-attributes.sh
      - t0004-unwritable.sh
      - t0005-signals.sh
      - t0006-date.sh
    start_time: 1280437324
    stop_time: 1280437326

The "extra_properties" hash is where we'll stick Git-specific info,
like whether Git was compiled with gettext or the fallback regex
engine, and what branch we're compiling. Currently no metadata like
this is included.

The entire tarball is then submitted to a central smokebox at
smoke.git.nix.is. This is done with curl(1) via the "smoke_report"
target:

    $ make smoke_report
    curl \
                    -H "Expect: " \
                    -F project=Git \
                    -F architecture=x86_64 \
                    -F platform=Linux \
                    -F revision="1.7.2.1.173.gc9b40" \
                    -F report_file=@test-results/git-smoke.tar.gz \
                    http://smoke.git.nix.is/app/projects/process_add_report/1 \
            | grep -v ^Redirecting
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  117k  100    63  100  117k      3   6430  0:00:21  0:00:18  0:00:03     0
    Reported #8 added.

Reports are then made available on the smokebox via a web interface:

    http://smoke.git.nix.is/app/projects/smoke_reports/1

The smoke reports are also mirrored to a Git repository hosted on
GitHub:

    http://github.com/gitsmoke/smoke-reports

The Smolder SQLite database that contains metadata about the reports
is also made available:

    http://github.com/gitsmoke/smoke-database

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotest-lib: Multi-prereq support only checked the last prereq
Ævar Arnfjörð Bjarmason [Wed, 11 Aug 2010 12:04:38 +0000 (12:04 +0000)]
test-lib: Multi-prereq support only checked the last prereq

The support for multiple test prerequisites added by me in "test-lib:
Add support for multiple test prerequisites" was broken.

The for iterated over each prerequisite and returned true/false within
a case statement, but since it missed a return statement only the last
prerequisite in the list of prerequisites was ever considered, the
rest were ignored.

Fix that by changing the test_have_prereq code to something less
clever that keeps a count of the total prereqs and the ones we have
and compares the count at the end.

This comes with the added advantage that it's easy to list the missing
prerequisites in the test output, implement that while I'm at it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotests: A SANITY test prereq for testing if we're root
Ævar Arnfjörð Bjarmason [Fri, 6 Aug 2010 22:09:09 +0000 (22:09 +0000)]
tests: A SANITY test prereq for testing if we're root

Some tests depend on not being able to write to files after chmod
-w. This doesn't work when running the tests as root.

Change test-lib.sh to test if this works, and if so it sets a new
SANITY test prerequisite. The tests that use this previously failed
when run under root.

There was already a test for this in t3600-rm.sh, added by Junio C
Hamano in 2283645 in 2006. That check now uses the new SANITY
prerequisite.

Some of this was resurrected from the "Tests in Cygwin" thread in May
2009:

    http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118385

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/README: Document the predefined test prerequisites
Ævar Arnfjörð Bjarmason [Fri, 6 Aug 2010 21:19:25 +0000 (21:19 +0000)]
t/README: Document the predefined test prerequisites

The README for the test library suggested that you grep the
test-lib.sh for test_set_prereq to see what the preset prerequisites
were.

Remove that bit, and write a section explaining all the preset
prerequisites. Most of the text was lifted from from Junio C Hamano
and Johannes Sixt, See the "Tests in Cygwin" thread in May 2009 for
the originals:

    http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118385
    http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118434

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotest-lib: Print missing prerequisites in test output
Ævar Arnfjörð Bjarmason [Fri, 6 Aug 2010 21:19:24 +0000 (21:19 +0000)]
test-lib: Print missing prerequisites in test output

Change the test output to print needed prerequisites as part of the
TAP. This makes it easy to see at a glance why a test was
skipped. Before:

    ok 7 # skip <message>
    ok 9 # skip <message>

After:

    ok 7 # skip <message> (prereqs: DONTHAVEIT)
    ok 9 # skip <message> (prereqs: HAVEIT,DONTHAVEIT)

This'll also be useful for smoke testing output, where the developer
reading the output may not be familiar with the system where tests are
being skipped.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotest-lib: Add support for multiple test prerequisites
Ævar Arnfjörð Bjarmason [Fri, 6 Aug 2010 21:19:23 +0000 (21:19 +0000)]
test-lib: Add support for multiple test prerequisites

Change the test_have_prereq function in test-lib.sh to support a
comma-separated list of prerequisites. This is useful for tests that
need e.g. both POSIXPERM and SANITY.

The implementation was stolen from Junio C Hamano and Johannes Sixt,
the tests and documentation were not. See the "Tests in Cygwin" thread
in May 2009 for the originals:

    http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118385
    http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118434

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotest-lib: Don't write test-results when HARNESS_ACTIVE
Ævar Arnfjörð Bjarmason [Wed, 11 Aug 2010 19:37:31 +0000 (19:37 +0000)]
test-lib: Don't write test-results when HARNESS_ACTIVE

TAP harnesses don't need to read test-results/*, since they keep track
of the number of passing/failing tests internally. Skip the generation
of these files when HARNESS_ACTIVE is set.

It's now possible to run the Git test suite without writing anything
to the t/ directory at all if you use a TAP harness and the --root
switch:

    cd t
    sudo mount -t tmpfs none /tmp/memory -o size=300m
    prove -j9 ./t[0-9]*.sh :: --root=/tmp/memory

The I/O that the ~500 test-results/* files contributed was very
minimal, but I thought this was worth mentioning.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>