Commit Graph

3495 Commits

Author SHA1 Message Date
Junio C Hamano
dda8f4bf2b Merge branch 'uk/maint-shortlog-encoding' into maint
* uk/maint-shortlog-encoding:
  t4201: use ISO8859-1 rather than ISO-8859-1
  shortlog: respect commit encoding
2009-12-03 13:56:50 -08:00
Junio C Hamano
c8b1d761f6 Merge branch 'fc/maint-format-patch-pathspec-dashes' into maint
* fc/maint-format-patch-pathspec-dashes:
  format-patch: add test for parsing of "--"
  format-patch: fix parsing of "--" on the command line
2009-12-03 13:54:25 -08:00
Junio C Hamano
3920917861 Merge branch 'rj/maint-t9700' into maint
* rj/maint-t9700:
  t9700-perl-git.sh: Fix a test failure on Cygwin
2009-12-03 13:52:22 -08:00
Junio C Hamano
2936824af2 Merge branch 'ls/maint-mailinfo-no-inbody' into maint
* ls/maint-mailinfo-no-inbody:
  git am/mailinfo: Don't look at in-body headers when rebasing
2009-12-03 13:52:16 -08:00
Junio C Hamano
9c1506af6a Merge branch 'pb/maint-use-custom-perl' into maint
* pb/maint-use-custom-perl:
  Make sure $PERL_PATH is defined when the test suite is run.
2009-12-03 13:51:41 -08:00
Junio C Hamano
f2c0ca4fae Merge branch 'bc/grep-i-F' into maint
* bc/grep-i-F:
  grep: Allow case insensitive search of fixed-strings
2009-12-03 13:51:26 -08:00
Miklos Vajna
02b47cd77e builtin-commit: add --date option
This is like --author: allow a user to specify a given date without
using the GIT_AUTHOR_DATE environment variable.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-03 12:41:22 -08:00
Matthew Ogilvie
e4597aae65 run test suite without dashed git-commands in PATH
Only put bin-wrappers in the PATH (not GIT_EXEC_PATH), to emulate the
default installed user environment, and ensure all the programs run
correctly in such an environment.  This is now the default, although
it can be overridden with a --with-dashes test option when running
tests.

Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-03 11:38:00 -08:00
Johan Herland
488bdf2ebe Fix crasher on encountering SHA1-like non-note in notes tree
When loading a notes tree, the code primarily looks for SHA1-like paths
whose total length (discounting directory separators) are 40 chars
(interpreted as valid note entries) or less (interpreted as subtree
entries that may in turn contain note entries when unpacked).

However, there is an additional condition that must hold for valid
subtree entries: They must be _tree_ objects (duh).

This patch adds an appropriate test for this condition, thereby fixing
the crash that occured when passing a non-tree object to the tree-walk
API.

The patch also adds another selftest verifying correct behaviour of
non-notes in note trees.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-03 10:10:35 -08:00
Brandon Casey
907a0b1e04 t9001: use older Getopt::Long boolean prefix '--no' rather than '--no-'
The '--no-chain-reply-to' option is a Getopt::Long boolean option. The
'--no-' prefix (as in --no-chain-reply-to) for boolean options is not
supported in Getopt::Long version 2.32 which was released with Perl 5.8.0.
This version only supports '--no' as in '--nochain-reply-to'.  More recent
versions of Getopt::Long, such as version 2.34, support either prefix. So
use the older form in the tests.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-03 10:07:17 -08:00
Brandon Casey
3994e8a98d t4201: use ISO8859-1 rather than ISO-8859-1
Some ancient platforms do not have an extensive list of alternate names for
character encodings.  For example, Solaris 7 and IRIX 6.5 do not know that
ISO-8859-1 is the same as ISO8859-1.  Modern platforms do know this, so use
the older name.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-03 10:06:13 -08:00
Junio C Hamano
0748494e86 Merge branch 'maint'
* maint:
  Prepare for 1.6.5.4
  merge: do not add standard message when message is given with -m option
  Do not misidentify "git merge foo HEAD" as an old-style invocation

Conflicts:
	RelNotes
2009-12-02 10:30:12 -08:00
Junio C Hamano
ce9d823b91 merge: do not add standard message when message is given with -m option
Even if the user explicitly gave her own message to "git merge", the
command still added its standard merge message.  It resulted in a
useless repetition like this:

    % git merge -m "Merge early part of side branch" `git rev-parse side~2`
    % git show -s
    commit 37217141e7519629353738d5e4e677a15096206f
    Merge: e68e646 a1d2374
    Author: しらいし ななこ <nanako3@lavabit.com>
    Date:   Wed Dec 2 14:33:20 2009 +0900

	Merge early part of side branch

	Merge commit 'a1d2374f8f52f4e8a53171601a920b538a6cec23'

The gave her own message because she didn't want git to add the
standard message (if she wanted to, she wouldn't have given one,
or she would have prepared it using git-fmt-merge-msg command).

Noticed by Nanako Shiraishi

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-02 10:02:08 -08:00
Junio C Hamano
9eba92f684 Merge branch 'fc/maint-format-patch-pathspec-dashes'
Conflicts:
	t/t4014-format-patch.sh
2009-11-30 14:46:09 -08:00
Junio C Hamano
684d0d8dcf Merge branch 'jc/pretty-lf'
Conflicts:
	pretty.c
	t/t6006-rev-list-format.sh
2009-11-30 14:44:22 -08:00
Junio C Hamano
c142465c07 Merge branch 'em/commit-claim' 2009-11-30 14:43:26 -08:00
Junio C Hamano
0c7cc135c5 Merge branch 'fc/send-email-envelope' 2009-11-30 14:42:50 -08:00
Junio C Hamano
a689faeb58 Merge branch 'uk/maint-shortlog-encoding'
Conflicts:
	builtin-shortlog.c
2009-11-30 14:42:28 -08:00
Junio C Hamano
1bab4bba54 Merge branch 'ns/send-email-no-chain-reply-to' 2009-11-30 14:35:18 -08:00
Junio C Hamano
b918eb6c2a Merge branch 'bw/diff-color-hunk-header' 2009-11-30 14:34:45 -08:00
Matthew Ogilvie
e160da7f60 t/README: Document GIT_TEST_INSTALLED and GIT_TEST_EXEC_PATH
These were added without documentation in 2009-03-16 (6720721).

Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-29 23:09:56 -08:00
Matthew Ogilvie
5d59a4016b t3409 t4107 t7406 t9150: use dashless commands
This is needed to allow test suite to run against a standard
install bin directory instead of GIT_EXEC_PATH.

Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-29 23:09:47 -08:00
Matthew Ogilvie
42ac496edc t2300: use documented technique to invoke git-sh-setup
This is needed to allow the test suite to run against a standard
install bin directory instead of GIT_EXEC_PATH.

Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-29 18:00:14 -08:00
Nanako Shiraishi
528fb08732 prepare send-email for smoother change of --chain-reply-to default
Give a warning message when send-email uses chain-reply-to to thread the
messages because of the current default, not because the user explicitly
asked to, either from the command line or from the configuration.

This way, by the time 1.7.0 switches the default, everybody will be ready.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-29 00:51:35 -08:00
Bert Wesarg
89cb73a19a Give the hunk comment its own color
Inspired by the coloring of quilt.

Introduce a separate color and paint the hunk comment part, i.e. the name
of the function, in a separate color "diff.func" (defaults to plain).

Whitespace between hunk header and hunk comment is printed in plain color.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-28 10:05:44 -08:00
Felipe Contreras
c89e324145 send-email: automatic envelope sender
This adds the option to specify the envelope sender as "auto" which
would pick the 'from' address. This is good because now we can specify
the address only in one place in $HOME/.gitconfig and change it easily.

[jc: added tests]

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-27 23:45:24 -08:00
Junio C Hamano
06a4755270 emit_line(): don't emit an empty <SET><RESET> followed by a newline
When emit_line() is called with an empty line (but non-zero length, as we
send line terminating LF or CRLF to the function), it used to emit
<SET><RESET> followed by a newline.  Stop the wastefulness.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-27 22:33:53 -08:00
Michael J Gruber
14ed05ddd6 t7508-status.sh: Add tests for status -s
The new short status has been completely untested so far. Introduce
tests by duplicating all tests which are present for the long format.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-27 15:14:59 -08:00
Junio C Hamano
41d5b7e362 Merge branch 'maint'
* maint:
  builtin-apply.c: pay attention to -p<n> when determining the name
2009-11-27 00:56:05 -08:00
Felipe Contreras
7e93d3b9e5 format-patch: add test for parsing of "--"
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-26 21:23:55 -08:00
Junio C Hamano
ec7fc0b1a4 builtin-apply.c: pay attention to -p<n> when determining the name
The patch structure has def_name component that is used to validate the
sanity of a "diff --git" patch by checking pathnames that appear on the
patch header lines for consistency.  The git_header_name() function is
used to compute this out of "diff --git a/... b/..." line, but the code
always stripped one level of prefix (i.e. "a/" and "b/"), without paying
attention to -p<n> option.  Code in find_name() function that parses other
lines in the patch header (e.g. "--- a/..." and "+++ b/..." lines) however
did strip the correct number of leading paths prefixes, and the sanity
check between these computed values failed.

Teach git_header_name() to honor -p<n> option like find_name() function
does.

Found and reported by Steven J. Murdoch who also wrote tests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-26 19:02:24 -08:00
Jeff King
bbbe508d77 tests: rename duplicate t1009
We should avoid duplicate test numbers, since things like
GIT_SKIP_TESTS consider something like t1009.5 to be
unambiguous.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-25 16:08:22 -08:00
Uwe Kleine-König
79f7ca063d shortlog: respect commit encoding
Don't take the author name information without re-encoding from the raw
commit object buffer.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-25 15:36:54 -08:00
Nanako Shiraishi
5d166ccb89 t1200: fix a timing dependent error
The fourth test of show-branch in t1200 test was failing but only
sometimes. It only failed when two commits created in an earlier
test had different timestamps. When they were created within the
same second, the actual output matched the expected output.

Fix this by using test_tick to force reliable timestamps and update
the expected output so it does not to depend on the commits made in
the same sacond.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-25 00:00:32 -08:00
Sverre Rabbelier
2fe40b6300 Add Python support library for remote helpers
This patch introduces parts of a Python package called
"git_remote_helpers" containing the building blocks for
remote helpers written in Python.

No actual remote helpers are part of this patch, this patch only
includes the common basics needed to start writing such helpers.

The patch includes the necessary Makefile additions to build and
install the git_remote_helpers Python package along with the rest of
Git.

This patch is based on Johan Herland's git_remote_cvs patch and
has been improved by the following contributions:
- David Aguilar: Lots of Python coding style fixes
- David Aguilar: DESTDIR support in Makefile

Cc: David Aguilar <davvid@gmail.com>
Cc: Johan Herland <johan@herland.net>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-24 15:50:20 -08:00
Junio C Hamano
e61f25f3a6 Merge branch 'jc/log-stdin'
* jc/log-stdin:
  Add trivial tests for --stdin option to log family
  Make --stdin option to "log" family read also pathspecs
  setup_revisions(): do not call get_pathspec() too early
  Teach --stdin option to "log" family
  read_revision_from_stdin(): use strbuf

Conflicts:
	revision.c
2009-11-23 22:30:08 -08:00
Junio C Hamano
2a971012b6 Merge branch 'mr/gitweb-snapshot'
* mr/gitweb-snapshot:
  t/gitweb-lib: Split HTTP response with non-GNU sed
  gitweb: Smarter snapshot names
  gitweb: Document current snapshot rules via new tests
  t/gitweb-lib.sh: Split gitweb output into headers and body
  gitweb: check given hash before trying to create snapshot
2009-11-23 22:28:31 -08:00
Brian Gernhardt
f74a83fcf0 t/gitweb-lib: Split HTTP response with non-GNU sed
Recognizing \r in a regex is something GNU sed will do, but other sed
implementation's won't (e.g. BSD sed on OS X).  Instead of two sed
invocations, use a single Perl script to split output into headers
and body.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-23 22:26:58 -08:00
Junio C Hamano
783cfafb91 Merge branch 'cc/replace'
* cc/replace:
  Documentation: talk a little bit about GIT_NO_REPLACE_OBJECTS
  Documentation: fix typos and spelling in replace documentation
  replace: use a GIT_NO_REPLACE_OBJECTS env variable
2009-11-23 22:24:01 -08:00
Johannes Sixt
4fa80cf0e0 t4014-format-patch: do not assume 'test' is available as non-builtin
One test case used 'xargs test', which assumes that 'test' is available
as external program. At least on MinGW it is not.

Moreover, 'git format-patch' was invoked in a pipeline, but not as the
last command. Rewrite the test case to catch breakage in 'git format-patch'
as well.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-23 02:55:59 -08:00
Junio C Hamano
d21fc9342c Add trivial tests for --stdin option to log family
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-23 00:49:47 -08:00
Junio C Hamano
65c042d44d Merge branch 'bg/fetch-multi'
* bg/fetch-multi:
  Re-implement 'git remote update' using 'git fetch'
  builtin-fetch: add --dry-run option
  builtin-fetch: add --prune option
  teach warn_dangling_symref to take a FILE argument
  remote: refactor some logic into get_stale_heads()
  Add missing test for 'git remote update --prune'
  Add the configuration option skipFetchAll
  Teach the --multiple option to 'git fetch'
  Teach the --all option to 'git fetch'
2009-11-23 00:03:15 -08:00
Junio C Hamano
c1c30ab31d Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn:
  git svn: strip leading path when making empty dirs
  git svn: always reuse existing remotes on fetch
2009-11-22 19:01:15 -08:00
Eric Wong
9be30eed61 git svn: strip leading path when making empty dirs
Since unhandled.log stores paths relative to the repository
root, we need to strip out leading path components if the
directories we're tracking are not the repository root.

Reported-by: Björn Steinbrink
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-11-22 18:15:42 -08:00
Junio C Hamano
038188637e Merge branch 'rj/maint-t9700'
* rj/maint-t9700:
  t9700-perl-git.sh: Fix a test failure on Cygwin
2009-11-22 16:40:52 -08:00
Junio C Hamano
6d975c24a9 Merge branch 'ls/maint-mailinfo-no-inbody'
* ls/maint-mailinfo-no-inbody:
  git am/mailinfo: Don't look at in-body headers when rebasing
2009-11-22 16:40:26 -08:00
Junio C Hamano
37e3b6104e Merge branch 'pb/maint-use-custom-perl'
* pb/maint-use-custom-perl:
  Make sure $PERL_PATH is defined when the test suite is run.
2009-11-22 16:28:46 -08:00
Junio C Hamano
3fa384d27e Merge branch 'bc/grep-i-F'
* bc/grep-i-F:
  grep: Allow case insensitive search of fixed-strings
2009-11-22 16:28:29 -08:00
René Scharfe
37bb5d7443 strbuf_add_wrapped_text(): factor out strbuf_add_indented_text()
Add a new helper function, strbuf_add_indented_text(), to indent text
without a width limit, and call it from strbuf_add_wrapped_text().  It
respects both indent (applied to the first line) and indent2 (applied to
the rest of the lines); indent2 was ignored by the indent-only path of
strbuf_add_wrapped_text() before the patch.

Two simple test cases are added, one exercising strbuf_add_wrapped_text()
and the other strbuf_add_indented_text().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-22 16:22:02 -08:00
René Scharfe
b482759983 grep: unset GREP_OPTIONS before spawning external grep
While we're at it, also unset GREP_COLOR and GREP_COLORS in case colouring
is not enabled, to be on the safe side.  The presence of these variables
alone is not sufficient to trigger coloured output with GNU grep, but
other implementations may behave differently.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-22 16:20:59 -08:00
Junio C Hamano
4f333bc1d3 t9001: test --envelope-sender option of send-email
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-22 12:08:44 -08:00
Junio C Hamano
885d492f69 Merge branch 'jh/notes' (early part)
* 'jh/notes' (early part):
  Add selftests verifying concatenation of multiple notes for the same commit
  Refactor notes code to concatenate multiple notes annotating the same object
  Add selftests verifying that we can parse notes trees with various fanouts
  Teach the notes lookup code to parse notes trees with various fanout schemes
  Teach notes code to free its internal data structures on request
  Add '%N'-format for pretty-printing commit notes
  Add flags to get_commit_notes() to control the format of the note string
  t3302-notes-index-expensive: Speed up create_repo()
  fast-import: Add support for importing commit notes
  Teach "-m <msg>" and "-F <file>" to "git notes edit"
  Add an expensive test for git-notes
  Speed up git notes lookup
  Add a script to edit/inspect notes
  Introduce commit notes

Conflicts:
	.gitignore
	Documentation/pretty-formats.txt
	pretty.c
2009-11-20 23:53:55 -08:00
Junio C Hamano
905bf7742c Merge branch 'sp/smart-http'
* sp/smart-http: (37 commits)
  http-backend: Let gcc check the format of more printf-type functions.
  http-backend: Fix access beyond end of string.
  http-backend: Fix bad treatment of uintmax_t in Content-Length
  t5551-http-fetch: Work around broken Accept header in libcurl
  t5551-http-fetch: Work around some libcurl versions
  http-backend: Protect GIT_PROJECT_ROOT from /../ requests
  Git-aware CGI to provide dumb HTTP transport
  http-backend: Test configuration options
  http-backend: Use http.getanyfile to disable dumb HTTP serving
  test smart http fetch and push
  http tests: use /dumb/ URL prefix
  set httpd port before sourcing lib-httpd
  t5540-http-push: remove redundant fetches
  Smart HTTP fetch: gzip requests
  Smart fetch over HTTP: client side
  Smart push over HTTP: client side
  Discover refs via smart HTTP server when available
  http-backend: more explict LocationMatch
  http-backend: add example for gitweb on same URL
  http-backend: use mod_alias instead of mod_rewrite
  ...

Conflicts:
	.gitignore
	remote-curl.c
2009-11-20 23:51:23 -08:00
Junio C Hamano
376f39fbea Merge branch 'jn/editor-pager'
* jn/editor-pager:
  Provide a build time default-pager setting
  Provide a build time default-editor setting
  am -i, git-svn: use "git var GIT_PAGER"
  add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR"
  Teach git var about GIT_PAGER
  Teach git var about GIT_EDITOR
  Suppress warnings from "git var -l"
  Do not use VISUAL editor on dumb terminals
  Handle more shell metacharacters in editor names
2009-11-20 23:48:52 -08:00
Junio C Hamano
1a02a85d63 Merge branch 'bg/format-patch-doc-update'
* bg/format-patch-doc-update:
  format-patch: Add "--no-stat" as a synonym for "-p"
  format-patch documentation: Fix formatting
  format-patch documentation: Remove diff options that are not useful
  format-patch: Always generate a patch
2009-11-20 23:47:10 -08:00
Junio C Hamano
aa437791d8 Merge branch 'tr/filter-branch'
* tr/filter-branch:
  filter-branch: nearest-ancestor rewriting outside subdir filter
  filter-branch: stop special-casing $filter_subdir argument
2009-11-20 23:46:14 -08:00
Junio C Hamano
6a09ff14fb Merge branch 'jl/submodule-add-noname'
* jl/submodule-add-noname:
  git submodule add: make the <path> parameter optional
2009-11-20 23:46:07 -08:00
Junio C Hamano
3fa95ce52b Merge branch 'sb/ls-tree-parseopt'
* sb/ls-tree-parseopt:
  ls-tree: migrate to parse-options
  t3101: test more ls-tree options
2009-11-20 23:46:03 -08:00
Junio C Hamano
1b8dbdb41e Merge branch 'jp/fetch-cull-many-refs'
* jp/fetch-cull-many-refs:
  remote: fix use-after-free error detected by glibc in ref_remove_duplicates
  fetch: Speed up fetch of large numbers of refs
  remote: Make ref_remove_duplicates faster for large numbers of refs
2009-11-20 23:44:35 -08:00
Lukas Sandström
d25e51596b git am/mailinfo: Don't look at in-body headers when rebasing
When we are rebasing we know that the header lines in the
patch are good and that we don't need to pick up any headers
from the body of the patch.

This makes it possible to rebase commits whose commit message
start with "From" or "Date".

Test vectors by Jeff King.

Signed-off-by: Lukas Sandström <luksan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-20 23:14:02 -08:00
Christian Couder
6476b38b1f replace: use a GIT_NO_REPLACE_OBJECTS env variable
This has the same effect as --no-replace-objects option; git ignores the
replace refs.  When --no-replace-objects option is passed to git, this
environment variable is set to "1" and exported to subprocesses in order
to propagate the same setting.

It is useful for example for scripts, as the git commands used in them can
now be aware that they must not read replace refs.

Tested-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-20 22:08:10 -08:00
Greg Bacon
3e97c7c6af No diff -b/-w output for all-whitespace changes
Change git-diff's whitespace-ignoring modes to generate
output only if a non-empty patch results, which git-apply
rejects.

Update the tests to look for the new behavior.

Signed-off-by: Greg Bacon <gbacon@dbresearch.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-20 22:00:36 -08:00
Thomas Rast
7a0d61bb45 describe: do not use unannotated tag even if exact match
4d23660 (describe: when failing, tell the user about options that
work, 2009-10-28) forgot to update the shortcut path where the code
detected and used a possible exact match.  This means that an
unannotated tag on HEAD would be used by 'git describe'.

Guard this code path against the new circumstances, where unannotated
tags can be present in ->util even if we're not actually planning to
use them.

While there, also add some tests for --all.

Reported by 'yashi' on IRC.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-20 21:58:11 -08:00
Ramsay Jones
81f40262a4 t9700-perl-git.sh: Fix a test failure on Cygwin
The t/t9700/test.pl script uses method invocation syntax when
using the Cwd module to determine the current working directory.
This fails on cygwin, since cygwin perl specifically checks for
any arguments to the cwd() function and croak()'s with the message
"Usage: Cwd::cwd()". (In perl v5.8.8 distribution, see the file
perl-5.8.8/cygwin/cygwin.c lines 139-157)

In order to avoid the problem, we replace the method invocation
syntax with a simple function call.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-19 23:01:09 -08:00
Junio C Hamano
aa17bacc14 Merge branch 'sb/tutorial-test'
* sb/tutorial-test:
  t1200: prepare for merging with Fast-forward bikeshedding
  t1200: further modernize test script style
  t1200: Make documentation and test agree
  t1200: cleanup and modernize test style
2009-11-17 22:03:02 -08:00
Johan Herland
d4e1b47a92 Basic build infrastructure for Python scripts
This patch adds basic boilerplate support (based on corresponding Perl
sections) for enabling the building and installation Python scripts.

There are currently no Python scripts being built, and when Python
scripts are added in future patches, their building and installation
can be disabled by defining NO_PYTHON.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-17 21:45:45 -08:00
Junio C Hamano
643faeea5f Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn:
  Document git-svn's first-parent rule
  git svn: attempt to create empty dirs on clone+rebase
  git svn: add authorsfile test case for ~/.gitconfig
  git svn: read global+system config for clone+init
  git svn: handle SVN merges from revisions past the tip of the branch
2009-11-17 08:59:27 -08:00
Philippe Bruhat (BooK)
be38ca3d19 Make sure $PERL_PATH is defined when the test suite is run.
Some test scripts run Perl scripts as if they were git-* scripts, and
thus need to use the same perl that will be put in the shebang line of
git*.perl commands. $PERL_PATH therefore needs to be used instead of
a bare "perl".

The tests can fail if another perl is found in $PATH before the one
defined in $PERL_PATH.

Example test failure caused by this: the perl defined in $PERL_PATH has
Error.pm installed, and therefore the Git.pm's Makefile.PL doesn't install
the private copy. The perl from $PATH doesn't have Error.pm installed, and
all git*.perl scripts invoked during the test will fail loading Error.pm.

Makefile patch by Jeff King <peff@peff.net>.

Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-17 08:37:03 -08:00
Stephen Boyd
3ea6025e17 t3101: test more ls-tree options
Add tests for --full-name, --full-tree, --abbrev, and --name-only.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-16 21:35:26 -08:00
Brian Collins
5183bf6727 grep: Allow case insensitive search of fixed-strings
"git grep" currently an error when you combine the -F and -i flags.
This isn't in line with how GNU grep handles it.

This patch allows the simultaneous use of those flags.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Brian Collins <bricollins@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-16 16:06:46 -08:00
Junio C Hamano
5e9cb8666b Merge branch 'jk/maint-add-p-empty' into maint
* jk/maint-add-p-empty:
  add-interactive: handle deletion of empty files
2009-11-16 00:02:44 -08:00
Junio C Hamano
d404a3e1a5 Merge branch 'js/maint-diff-color-words' into maint
* js/maint-diff-color-words:
  diff --color-words: bit of clean-up
  diff --color-words -U0: fix the location of hunk headers
  t4034-diff-words: add a test for word diff without context

Conflicts:
	diff.c
2009-11-16 00:01:56 -08:00
Junio C Hamano
1f9d282bd1 Merge branch 'jk/maint-format-patch-p-suppress-stat' into maint
* jk/maint-format-patch-p-suppress-stat:
  format-patch: make "-p" suppress diffstat
2009-11-15 23:07:49 -08:00
Junio C Hamano
958742ba43 Merge branch 'jk/maint-1.6.3-ls-files-i' into maint
* jk/maint-1.6.3-ls-files-i:
  ls-files: unbreak "ls-files -i"
2009-11-15 23:07:32 -08:00
Junio C Hamano
6dbdba00ea Merge branch 'jc/maint-blank-at-eof' into maint
* jc/maint-blank-at-eof:
  diff -B: colour whitespace errors
  diff.c: emit_add_line() takes only the rest of the line
  diff.c: split emit_line() from the first char and the rest of the line
  diff.c: shuffling code around
  diff --whitespace: fix blank lines at end
  core.whitespace: split trailing-space into blank-at-{eol,eof}
  diff --color: color blank-at-eof
  diff --whitespace=warn/error: fix blank-at-eof check
  diff --whitespace=warn/error: obey blank-at-eof
  diff.c: the builtin_diff() deals with only two-file comparison
  apply --whitespace: warn blank but not necessarily empty lines at EOF
  apply --whitespace=warn/error: diagnose blank at EOF
  apply.c: split check_whitespace() into two
  apply --whitespace=fix: detect new blank lines at eof correctly
  apply --whitespace=fix: fix handling of blank lines at the eof
2009-11-15 23:06:34 -08:00
Eric Wong
6111b93499 git svn: attempt to create empty dirs on clone+rebase
We parse unhandled.log files for empty_dir statements and make a
best effort attempt to recreate empty directories on fresh
clones and rebase.  This should cover the majority of cases
where users work off a single branch or for projects where
branches do not differ in empty directories.

Since this cannot affect "normal" git commands like "checkout"
or "reset", so users switching between branches in a single
working directory should use the new "git svn mkdirs" command
after switching branches.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-11-15 19:30:06 -08:00
Junio C Hamano
002a9ec005 Merge branch 'js/maint-diff-color-words'
* js/maint-diff-color-words:
  diff --color-words: bit of clean-up
  diff --color-words -U0: fix the location of hunk headers
  t4034-diff-words: add a test for word diff without context

Conflicts:
	diff.c
2009-11-15 16:41:29 -08:00
Junio C Hamano
4d8c325888 Merge branch 'fc/doc-fast-forward'
* fc/doc-fast-forward:
  Use 'fast-forward' all over the place

Conflicts:
	builtin-merge.c
2009-11-15 16:41:02 -08:00
Junio C Hamano
3176bd0b0d Merge branch 'jk/maint-add-p-empty'
* jk/maint-add-p-empty:
  add-interactive: handle deletion of empty files
2009-11-15 16:40:46 -08:00
Julian Phillips
95c96d48e6 remote: fix use-after-free error detected by glibc in ref_remove_duplicates
In ref_remove_duplicates, when we encounter a duplicate and remove it
from the list we need to make sure that the prev pointer stays
pointing at the last entry and also skip over adding the just freed
entry to the string_list.

Previously fetch could crash with:
*** glibc detected *** git: corrupted double-linked list: ...

Also add a test to try and catch problems with duplicate removal in
the future.

Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-14 16:03:06 -08:00
Eric Wong
e2f8617b26 git svn: add authorsfile test case for ~/.gitconfig
The commit for:
    git svn: read global+system config for clone+init

Initially lacked a test case because the author was unable to
reproduce it under his test environment, this adds it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-11-14 14:43:59 -08:00
Toby Allsopp
753dc384dc git svn: handle SVN merges from revisions past the tip of the branch
When recording the revisions that it has merged, SVN sets the top
revision to be the latest revision in the repository, which is not
necessarily a revision on the branch that is being merged from.  When
it is not on the branch, git-svn fails to add the extra parent to
represent the merge because it relies on finding the commit on the
branch that corresponds to the top of the SVN merge range.

In order to correctly handle this case, we look for the maximum
revision less than or equal to the top of the SVN merge range that is
actually on the branch being merged from.

[ew: This includes the following (squashed) commit to prevent
     errors during bisect:]

  Author: Toby Allsopp <toby.allsopp@navman.co.nz>
  Date:   Fri Nov 13 09:48:39 2009 +1300

    git-svn: add (failing) test for SVN 1.5+ merge with intervening commit

    This test exposes a bug in git-svn's handling of SVN 1.5+ mergeinfo
    properties.  The problematic case is when there is some commit on an
    unrelated branch after the last commit on the merged-from branch.
    When SVN records the mergeinfo property, it records the latest
    revision in the whole repository, which, in the problematic case, is
    not on the branch it is merging from.

    To trigger the git-svn bug, we modify t9151 to include two SVN merges,
    the second of which has an intervening commit.  The SVN dump was
    generated using SVN 1.6.6 (on Debian squeeze amd64).

Signed-off-by: Toby Allsopp <toby.allsopp@navman.co.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-11-14 13:37:59 -08:00
Jonathan Nieder
8f4b576ad1 Provide a build time default-editor setting
Provide a DEFAULT_EDITOR knob to allow setting the fallback
editor to use instead of vi (when VISUAL, EDITOR, and GIT_EDITOR
are unset).  The value can be set at build time according to a
system’s policy.  For example, on Debian systems, the default
editor should be the 'editor' command.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-13 12:20:54 -08:00
Jonathan Nieder
d33738d7d3 Do not use VISUAL editor on dumb terminals
Refuse to use $VISUAL and fall back to $EDITOR if TERM is unset
or set to "dumb".  Traditionally, VISUAL is set to a screen
editor and EDITOR to a line-based editor, which should be more
useful in that situation.

vim, for example, is happy to assume a terminal supports ANSI
sequences even if TERM is dumb (e.g., when running from a text
editor like Acme).  git already refuses to fall back to vi on a
dumb terminal if GIT_EDITOR, core.editor, VISUAL, and EDITOR are
unset, but without this patch, that check is suppressed by
VISUAL=vi.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-13 12:15:28 -08:00
Thomas Rast
f2f3a6b802 filter-branch: nearest-ancestor rewriting outside subdir filter
Since a0e4639 (filter-branch: fix ref rewriting with
--subdirectory-filter, 2008-08-12) git-filter-branch has done
nearest-ancestor rewriting when using a --subdirectory-filter.

However, that rewriting strategy is also a useful building block in
other tasks.  For example, if you want to split out a subset of files
from your history, you would typically call

  git filter-branch -- <refs> -- <files>

But this fails for all refs that do not point directly to a commit
that affects <files>, because their referenced commit will not be
rewritten and the ref remains untouched.

The code was already there for the --subdirectory-filter case, so just
introduce an option that enables it independently.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-13 11:26:43 -08:00
Junio C Hamano
6a93158c33 Merge branch 'jk/maint-format-patch-p-suppress-stat'
* jk/maint-format-patch-p-suppress-stat:
  format-patch: make "-p" suppress diffstat
2009-11-10 12:35:56 -08:00
Junio C Hamano
92396402e2 Merge branch 'jk/maint-1.6.3-ls-files-i'
* jk/maint-1.6.3-ls-files-i:
  ls-files: unbreak "ls-files -i"
2009-11-10 12:33:28 -08:00
Junio C Hamano
3cc335181f Merge branch 'bg/merge-ff-only'
* bg/merge-ff-only:
  Teach 'git merge' and 'git pull' the option --ff-only
2009-11-10 12:32:59 -08:00
Junio C Hamano
48cbf915a4 Merge branch 'jp/dirty-describe'
* jp/dirty-describe:
  Teach "git describe" --dirty option
2009-11-10 12:30:43 -08:00
Björn Gustavsson
02bc5b03f5 format-patch: Always generate a patch
Jeff King recently reinstated -p to suppress the default diffstat
(as -p used to work before 68daa64, about 14 months ago).

However, -p is also needed in combination with certain options
(e.g. --stat or --numstat) in order to produce any patch at all.
The documentation does not mention this.

Since the purpose of format-patch is to produce a patch that
can be emailed, it does not make sense that certain combination
of options will suppress the generation of the patch itself.

Therefore:

* Update 'git format-patch' to always generate a patch.

* Since the --name-only, --name-status, and --check suppresses
  the generation of the patch, disallow those options,
  and remove the description of them in the documentation.

* Remove the reference to -p in the description of -U.

* Remove the descriptions of the options that are synonyms for -p
  plus another option (--patch-with-raw and --patch-with-stat).

* While at it, slightly tweak the description of -p itself
  to say that it generates "plain patches", so that you can
  think of -p as "plain patch" as an mnemonic aid.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10 11:37:47 -08:00
Björn Gustavsson
e2d41c64bf Add missing test for 'git remote update --prune'
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10 01:01:07 -08:00
Björn Gustavsson
7cc91a2f71 Add the configuration option skipFetchAll
Implement the configuration skipFetchAll option to allow
certain remotes to be skipped when doing 'git fetch --all' and
'git remote update'. The existing skipDefaultUpdate variable
is still honored (by 'git fetch --all' and 'git remote update').
(If both are set in the configuration file with different values,
the value of the last occurrence will be used.)

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10 01:01:07 -08:00
Björn Gustavsson
16679e373f Teach the --multiple option to 'git fetch'
Add the --multiple option to specify that all arguments are either
groups or remotes. The primary reason for adding this option is
to allow us to re-implement 'git remote update' using fetch.

It would have been nice if this option was not needed, but since
the colon in a refspec is optional, it is in general not possible
to know whether a single, colon-less argument is a remote or a
refspec.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10 01:01:07 -08:00
Björn Gustavsson
9c4a036b34 Teach the --all option to 'git fetch'
'git remote' is meant for managing remotes and 'git fetch' is meant
for actually fetching data from remote repositories. Therefore, it is
not logical that you must use 'git remote update' to fetch from
more than one repository at once.

Add the --all option to 'git fetch', to tell it to attempt to fetch
from all remotes. Also, if --all is not given, the <repository>
argument is allowed to be the name of a group, to allow fetching
from all repositories in the group.

Other options except -v and -q are silently ignored.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10 01:01:06 -08:00
Shawn O. Pearce
203666352f t5551-http-fetch: Work around broken Accept header in libcurl
Unfortunately at least one version of libcurl has a bug causing
it to include "Accept: */*" in the same POST request where we have
already asked for "Accept: application/x-git-upload-pack-response".

This is a bug in libcurl, not Git, or our test vector.  The
application has explicitly asked the server for a single content
type, but libcurl has mistakenly also told the server the client
application will accept */*, which is any content type.

Based on the libcurl change log, this "Accept: */*" header bug
may have been fixed in version 7.18.1 released March 30, 2008:

  http://curl.haxx.se/changes.html#7_18_1

Rather than require users to upgrade libcurl we change the test
vector to trim this line out of the 2nd request.

Reported-by: Tarmigan <tarmigan+git@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-09 16:41:13 -08:00
Shawn O. Pearce
0a8fcbdca2 t5551-http-fetch: Work around some libcurl versions
Some versions of libcurl report their output when GIT_CURL_VERBOSE
is set differently than other versions do.  At least one variant
(version unknown but likely pre-7.18.1) reports the POST payload to
stderr, and omits the blank line after each HTTP request/response.
We clip these lines out of the stderr output now before doing the
compare, so we aren't surprised by this trivial difference.

Reported-by: Tarmigan <tarmigan+git@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-09 16:40:49 -08:00
Shawn O. Pearce
34b6cb8bb0 http-backend: Protect GIT_PROJECT_ROOT from /../ requests
Eons ago HPA taught git-daemon how to protect itself from /../
attacks, which Junio brought back into service in d79374c7b5
("daemon.c and path.enter_repo(): revamp path validation").

I did not carry this into git-http-backend as originally we relied
only upon PATH_TRANSLATED, and assumed the HTTP server had done
its access control checks to validate the resolved path was within
a directory permitting access from the remote client.  This would
usually be sufficient to protect a server from requests for its
/etc/passwd file by http://host/smart/../etc/passwd sorts of URLs.

However in 917adc0360 Mark Lodato added GIT_PROJECT_ROOT as an
additional method of configuring the CGI.  When this environment
variable is used the web server does not generate the final access
path and therefore may blindly pass through "/../etc/passwd"
in PATH_INFO under the assumption that "/../" might have special
meaning to the invoked CGI.

Instead of permitting these sorts of malformed path requests, we
now reject them back at the client, with an error message for the
server log.  This matches git-daemon behavior.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-09 16:37:33 -08:00
Mark Rada
b629275fd0 gitweb: Smarter snapshot names
Teach gitweb how to produce nicer snapshot names by only using the
short hash id.  If clients make requests using a tree-ish that is not
a partial or full SHA-1 hash, then the short hash will also be appended
to whatever they asked for.  If clients request snapshot of a tag
(which means that $hash ('h') parameter has 'refs/tags/' prefix),
use only tag name.

Update tests cases in t9502-gitweb-standalone-parse-output.

Gitweb uses the following format for snapshot filenames:
  <sanitized project name>-<version info>.<snapshot suffix>
where <sanitized project name> is project name with '.git' or '/.git'
suffix stripped, unless '.git' is the whole project name.  For
snapshot prefix it uses:
  <sanitized project name>-<version info>/
as compared to <sanitized project name>/ before (without version info).

Current rules for <version info>:
* if 'h' / $hash parameter is SHA-1 or shortened SHA-1, use SHA-1
  shortened to to 7 characters
* otherwise if 'h' / $hash parameter is tag name (it begins with
  'refs/tags/' prefix, use tag name (with 'refs/tags/' stripped
* otherwise if 'h' / $hash parameter starts with 'refs/heads/' prefix,
  strip this prefix, convert '/' into '.', and append shortened SHA-1
  after '-', i.e. use <sanitized hash>-<shortened sha1>

Signed-off-by: Mark Rada <marada@uwaterloo.ca>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-08 19:22:45 -08:00
Jakub Narebski
3ce9450a81 gitweb: Document current snapshot rules via new tests
Add t9502-gitweb-standalone-parse-output test script, which runs
gitweb as a CGI script from the commandline and checks that it
produces the correct output.

Currently this test script contains only tests of snapshot naming
(proposed name of snapshot file) and snapshot prefix (prefix of files
in the archive / snapshot).  It defines and uses 'tar' snapshot
format, without compression, for easy checking of snapshot prefix.
Testing is done using check_snapshot function.

Gitweb uses the following format for snapshot filenames:
  <sanitized project name>-<hash parameter><snapshot suffix>
where <sanitized project name> is project name with '.git' or '/.git'
suffix stripped, unless '.git' is the whole project name.  For
snapshot prefix it uses simply:
  <sanitized project name>/

Disadvantages of current snapshot rules:
* There exists convention that <basename>.<suffix> archive unpacks to
  <basename>/ directory (<basename>/ is prefix of archive).  Gitweb
  does not respect it
* Snapshot links generated by gitweb use full SHA-1 id as a value of
  'h' / $hash parameter.  With current rules it leads to long file
  names like e.g. repo-1005c80cc11c531d327b12195027cbbb4ff9e3cb.tgz
* For handcrafted URLs, where 'h' / $hash parameter is a symbolic
  'volatile' revision name such as "HEAD" or "next" snapshot name
  doesn't tell us what exact version it was created from
* Proposed filename in Content-Disposition header should not contain
  any directory path information, which means that it should not
  contain '/' (see RFC2183)... which means that snapshot naming is
  broken for $hash being e.g. hirearchical branch name such as
  'xx/test'

This would be improved in next commit.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-08 19:22:33 -08:00
Jeff King
1d46f2ea14 format-patch: make "-p" suppress diffstat
Once upon a time, format-patch would use its default stat
plus patch format only when no diff format was given on the
command line. This meant that "format-patch -p" would
suppress the stat and show just the patch.

Commit 68daa64 changed this to keep the stat format when we
had an "implicit" patch format, like "-U5". As a side
effect, this meant that an explicit patch format was now
ignored (because cmd_format_patch didn't know the reason
that the format was set way down in diff_opt_parse).

This patch unbreaks what 68daa64 did (while still preserving
what 68daa64 was trying to do), reinstating "-p" to suppress
the default behavior. We do this by parsing "-p" ourselves
in format-patch, and noting whether it was used explicitly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-08 17:01:36 -08:00
Junio C Hamano
6e31f3dbb5 Merge branch 'jc/commit-s-subject-is-not-a-footer'
* jc/commit-s-subject-is-not-a-footer:
  builtin-commit.c: fix logic to omit empty line before existing footers
2009-11-06 23:17:47 -08:00
Junio C Hamano
e5138436dd builtin-commit.c: fix logic to omit empty line before existing footers
"commit -s" used to add an empty line before adding S-o-b line only when
the last line of the existing log message is not another S-o-b line, but
c1e01b0 (commit: More generous accepting of RFC-2822 footer lines.,
2009-10-28) introduced logic to omit this empty line when the message ends
with a run of "footer" lines, to cover S-o-b's friends, e.g. Acked-by.

However, the logic was overzealous and missed one corner case.  A message
that consists of a single line that begins with Token + colon, it can be
mistaken as a S-o-b's friend.  We do want an empty line in such a case.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-06 23:17:26 -08:00
Junio C Hamano
5c5dd6e5a4 t1200: prepare for merging with Fast-forward bikeshedding
A tree-wide bikeshedding to replace "fast forward" into "fast-forward" is
in 'master'.  Since we want to keep this "test modernization" series
mergeable also to the maintenance track, we would need to tweak the test
to accept both old spellings and new spellings.

Sigh...  This kind of headache is the primary reason we try not to allow
such a tree-wide bike-shedding, but the damage has already been done.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-06 23:01:33 -08:00
Junio C Hamano
b9f3bde150 t1200: further modernize test script style
Instead of using bare "cmp", use "test_cmp".  Output when the test is run
with a -v option becomes easier to diagnose when something goes wrong
because on saner platforms test_cmp uses "diff -u".

There is no need to put an extra backslash to a line that ends with a '|'
(i.e. the upstream of a pipe).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-06 22:53:53 -08:00
Stephen Boyd
7c5858a643 t1200: Make documentation and test agree
There were some differences between t1200 and the gitcore-tutorial. Add
missing tests for manually merging two branches, and use the same
commands in both files.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-06 22:44:34 -08:00
Stephen Boyd
1a994dc3d2 t1200: cleanup and modernize test style
Many parts of the tests in t1200 are run outside the test harness,
circumventing the usefulness of -v and spewing messages to stdout when
-v isn't used. Fix these problems by modernizing the test a bit.

An extra test_done has existed since commit 6a74642 (git-commit --amend:
two fixes., 2006-04-20) leading to the last 6 tests never being run.
Remove it and teach the resolve merge test about fast-forward merges.
Also fix the last test's incorrect find command and prune before
checking for unpacked objects so we remove the unreachable conflict-marked
blob.

Finally, we remove the TODO notes, because fetch, push, and clone have
their own tests since t1200 was introduced and we're not going to add
them here 4 years later.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-06 22:44:34 -08:00
Shawn O. Pearce
7f640b778f http-backend: Test configuration options
Test the major configuration settings which control access to
the repository:

  http.getanyfile
  http.uploadpack
  http.receivepack

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-04 17:58:16 -08:00
Shawn O. Pearce
7da4e2280c test smart http fetch and push
The top level directory "/smart/" of the test Apache server is mapped
through our git-http-backend CGI, but uses the same underlying
repository space as the server's document root.  This is the most
simple installation possible.

Server logs are checked to verify the client has accessed only the
smart URLs during the test.  During fetch testing the headers are
also logged from libcurl to ensure we are making a reasonably sane
HTTP request, and getting back reasonably sane response headers
from the CGI.

When validating the request headers used during smart fetch we munge
away the actual Content-Length and replace it with the placeholder
"xxx".  This avoids unnecessary varability in the test caused by
an unrelated change in the requested capabilities in the first want
line of the request.  However, we still want to look for and verify
that Content-Length was used, because smaller payloads should be
using Content-Length and not "Transfer-Encoding: chunked".

When validating the server response headers we must discard both
Content-Length and Transfer-Encoding, as Apache2 can use either
format to return our response.

During development of this test I observed Apache returning both
forms, depending on when the processes got CPU time.  If our CGI
returned the pack data quickly, Apache just buffered the whole
thing and returned a Content-Length.  If our CGI took just a bit
too long to complete, Apache flushed its buffer and instead used
"Transfer-Encoding: chunked".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-04 17:58:16 -08:00
Shawn O. Pearce
024bb12566 http tests: use /dumb/ URL prefix
To clarify what part of the HTTP transprot is being tested we change
the URLs used by existing tests to include /dumb/ at the start,
indicating they use the non-Git aware code paths.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-04 17:58:16 -08:00
Clemens Buchacher
859d1fb427 set httpd port before sourcing lib-httpd
If LIB_HTTPD_PORT is not set already, lib-httpd will set it to the
default 8111.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-04 17:58:16 -08:00
Tay Ray Chuan
eeb3aeddb2 t5540-http-push: remove redundant fetches
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-04 17:58:15 -08:00
Erick Mattos
c51f6ceed6 commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author
When we use -c, -C, or --amend, we are trying one of two things: using the
source as a template or modifying a commit with corrections.

When these options are used, the authorship and timestamp recorded in the
newly created commit are always taken from the original commit.  This is
inconvenient when we just want to borrow the commit log message or when
our change to the code is so significant that we should take over the
authorship (with the blame for bugs we introduce, of course).

The new --reset-author option is meant to solve this need by regenerating
the timestamp and setting the committer as the new author.

Signed-off-by: Erick Mattos <erick.mattos@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-04 16:59:15 -08:00
Junio C Hamano
3bb18e58fc Merge branch 'jn/show-normalized-refs'
* jn/show-normalized-refs:
  t1402: Make test executable
2009-11-02 10:46:36 -08:00
Stephen Boyd
74de278113 t1402: Make test executable
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-02 10:46:23 -08:00
Junio C Hamano
5f809ff509 fixup tr/stash-format merge 2009-10-30 20:18:31 -07:00
Junio C Hamano
d39d667169 Merge branch 'js/diff-verbose-submodule'
* js/diff-verbose-submodule:
  add tests for git diff --submodule
  Add the --submodule option to the diff option family
2009-10-30 20:16:26 -07:00
Junio C Hamano
68d00fd834 Merge branch 'jn/show-normalized-refs'
* jn/show-normalized-refs:
  check-ref-format: simplify --print implementation
  git check-ref-format --print
  Add tests for git check-ref-format

Conflicts:
	Documentation/git-check-ref-format.txt
2009-10-30 20:07:33 -07:00
Clemens Buchacher
d8f67d205e remote-helpers: return successfully if everything up-to-date
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-30 19:20:54 -07:00
Shawn O. Pearce
ae4efe1957 Move WebDAV HTTP push under remote-curl
The remote helper interface now supports the push capability,
which can be used to ask the implementation to push one or more
specs to the remote repository.  For remote-curl we implement this
by calling the existing WebDAV based git-http-push executable.

Internally the helper interface uses the push_refs transport hook
so that the complexity of the refspec parsing and matching can be
reused between remote implementations.  When possible however the
helper protocol uses source ref name rather than the source SHA-1,
thereby allowing the helper to access this name if it is useful.

>From Clemens Buchacher <drizzd@aon.at>:
 update http tests according to remote-curl capabilities

 o Pushing packed refs is now fixed.

 o The transport helper fails if refs are already up-to-date. Add
   a test for that.

 o The transport helper will notice if refs are already
   up-to-date. We therefore need to update server info in the
   unpacked-refs test.

 o The transport helper will purge deleted branches automatically.

 o Use a variable ($ORIG_HEAD) instead of full SHA-1 name.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Daniel Barkalow <barkalow@iabervon.org>
CC: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-30 19:20:54 -07:00
Jakub Narebski
46e09f3105 t/gitweb-lib.sh: Split gitweb output into headers and body
Save HTTP headers into gitweb.headers, and the body of message into
gitweb.body in gitweb_run()

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-30 16:34:49 -07:00
Björn Gustavsson
134748353b Teach 'git merge' and 'git pull' the option --ff-only
For convenience in scripts and aliases, add the option
--ff-only to only allow fast-forwards (and up-to-date,
despite the name).

Disallow combining --ff-only and --no-ff, since they
flatly contradict each other.

Allow all other options to be combined with --ff-only
(i.e. do not add any code to handle them specially),
including the following options:

* --strategy (one or more): As long as the chosen merge
  strategy results in up-to-date or fast-forward, the
  command will succeed.

* --squash: I cannot imagine why anyone would want to
  squash commits only if fast-forward is possible, but I
  also see no reason why it should not be allowed.

* --message: The message will always be ignored, but I see
  no need to explicitly disallow providing a redundant message.

Acknowledgements: I did look at Yuval Kogman's earlier
patch (107768 in gmane), mainly as shortcut to find my
way in the code, but I did not copy anything directly.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-30 16:02:26 -07:00
Jeff King
15c6bf0df4 t915{0,1}: use $TEST_DIRECTORY
Because --root can put our trash directories elsewhere,
using ".." may not always work.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-30 15:03:10 -07:00
Michael J Gruber
ab3d175f87 Make t9150 and t9151 test scripts executable
so that they can be run individually as
(cd t && ./t9150-svk-mergetickets.sh)
etc. just like all other test scripts.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-30 15:02:50 -07:00
Jeff King
500348aa68 ls-files: unbreak "ls-files -i"
Commit b5227d8 changed the behavior of "ls-files" with
respect to includes, but accidentally broke the "-i" option
The original behavior was:

  1. if no "-i" is given, cull all results according to --exclude*
  2. if "-i" is given, show the inverse of (1)

The broken behavior was:

  1. if no "-i" is given:
     a. for "-o", cull results according to --exclude*
     b. for index files, always show all
  2. if "-i" is given:
     a. for "-o", shows the inverse of (1a)
     b. for index files, always show all

The fixed behavior keeps the new (1b) behavior introduced
by b5227d8, but fixes the (2b) behavior to show only ignored
files, not all files.

This patch also tweaks the documentation. The original text
was somewhat obscure in the first place, but it is also now
inaccurate (the relationship between (1b) and (2b) is not
quite a "reverse").

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-30 14:41:29 -07:00
Johannes Schindelin
a4ca1465ec diff --color-words -U0: fix the location of hunk headers
Colored word diff without context lines firstly printed all the hunk
headers among each other and then printed the diff.

This was due to the code relying on getting at least one context line at
the end of each hunk, where the colored words would be flushed (it is
done that way to be able to ignore rewrapped lines).

Noticed by Markus Heidelberg.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-30 09:42:56 -07:00
Markus Heidelberg
168eff3c80 t4034-diff-words: add a test for word diff without context
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-30 09:42:52 -07:00
David Brown
c1e01b0c51 commit: More generous accepting of RFC-2822 footer lines.
'git commit -s' will insert a blank line before the Signed-off-by
line at the end of the message, unless this last line is a
Signed-off-by line itself.  Common use has other trailing lines
at the ends of commit text, in the style of RFC2822 headers.

Be more generous in considering lines to be part of this footer.
If the last paragraph of the commit message reasonably resembles
RFC-2822 formatted lines, don't insert that blank line.

The new Signed-off-by line is still only suppressed when the
author's existing Signed-off-by is the last line of the message.

Signed-off-by: David Brown <davidb@quicinc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-28 11:03:01 -07:00
Jeff King
24ab81ae4d add-interactive: handle deletion of empty files
Usually we show deletion as a big hunk deleting all of the
file's text. However, for files with no content, the diff
shows just the 'deleted file mode ...' line. This patch
cause "add -p" (and related commands) to recognize that line
and explicitly ask about deleting the file.

We only add the "stage this deletion" hunk for empty files,
since other files will already ask about the big content
deletion hunk. We could also change those files to simply
display "stage this deletion", but showing the actual
deleted content is probably what an interactive user wants.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-27 23:19:04 -07:00
Jean Privat
9f67d2e827 Teach "git describe" --dirty option
With the --dirty option, git describe works on HEAD but append s"-dirty"
iff the contents of the work tree differs from HEAD.  E.g.

  $ git describe --dirty
  v1.6.5-15-gc274db7
  $ echo >> Makefile
  $ git describe --dirty
  v1.6.5-15-gc274db7-dirty

The --dirty option can also be used to specify what is appended, instead
of the default string "-dirty".

  $ git describe --dirty=.mod
  v1.6.5-15-gc274db7.mod

Many build scripts use `git describe` to produce a version number based on
the description of HEAD (on which the work tree is based) + saying that if
the build contains uncommitted changes.  This patch helps the writing of
such scripts since `git describe --dirty` does directly the intended thing.

Three possiblities were considered while discussing this new feature:

1. Describe the work tree by default and describe HEAD only if "HEAD" is
   explicitly specified

     Pro: does the right thing by default (both for users and for scripts)
     Pro: other git commands that works on the work tree by default
     Con: breaks existing scripts used by the Linux kernel and other projects

2. Use --worktree instead of --dirty

     Pro: does what it says: "git describe --worktree" describes the work tree
     Con: other commands do not require a --worktree option when working
          on the work tree (it often is the default mode for them)
     Con: unusable with an optional value: "git describe --worktree=.mod"
	  is quite unintuitive.

3. Use --dirty as in this patch

     Pro: makes sense to specify an optional value (what the dirty mark is)
     Pro: does not have any of the big cons of previous alternatives
	  * does not break scripts
	  * is not inconsistent with other git commands

This patch takes the third approach.

Signed-off-by: Jean Privat <jean@pryen.org>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-27 12:46:22 -07:00
Sam Vilain
dff589ef94 git-svn: convert SVN 1.5+ / svnmerge.py svn:mergeinfo props to parents
This feature is long overdue; convert SVN's merge representation to git's
as revisions are imported.  This works by converting the list of revisions
in each line of the svn:mergeinfo into git revision ranges, and then
checking the latest of each of these revision ranges for A) being new and
B) now being completely merged.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-10-26 23:54:24 -07:00
Sam Vilain
ce62683096 git-svn: add test data for SVN 1.5+ merge, with script.
Dump generated with SVN 1.5.1 (on lenny amd64).  This test
should hopefully cover all but a few intermediate versions of
the svnmerge.py script.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-10-26 23:51:55 -07:00
Sam Vilain
f1264bd654 git-svn: convert SVK merge tickets to extra parents
SVK is a simple case to start with, as its idea of merge parents
matches git's one.  When a svk:merge ticket is encountered, check each
of the listed merged revisions to see if they are in the history of
this commit; if not, then we have encountered a merge - record it.

[ew: minor formatting cleanups]

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-10-26 23:51:31 -07:00
Sam Vilain
a5e9c7dfe4 git-svn: allow test setup script to support PERL env. var
Possibly the 'perl' in the PATH is not the one to be used for the tests;
let PERL set in the environment select it.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-10-26 23:49:02 -07:00
Sam Vilain
cb74a0ca61 git-svn: add test data for SVK merge, with script.
Dump generated with SVK 2.0.2 and SVN 1.5.1 (on lenny amd64).

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-10-26 23:45:41 -07:00
Junio C Hamano
071b489682 Merge branch 'maint-1.6.4' into maint
* maint-1.6.4:
  ls-files: excludes should not impact tracked files
2009-10-25 15:34:41 -07:00
Junio C Hamano
caa7dac163 Merge branch 'jk/maint-1.6.3-ls-files-no-ignore-cached' into maint-1.6.4
* jk/maint-1.6.3-ls-files-no-ignore-cached:
  ls-files: excludes should not impact tracked files
2009-10-25 15:34:27 -07:00
Junio C Hamano
18fbc94c3c Merge branch 'maint'
* maint:
  t7800-difftool: fix the effectless GIT_DIFFTOOL_PROMPT test
  Work around option parsing bug in the busybox tar implementation
2009-10-25 00:21:26 -07:00
Felipe Contreras
a75d7b5409 Use 'fast-forward' all over the place
It's a compound word.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-24 23:50:28 -07:00
Markus Heidelberg
3319df6f3a t7800-difftool: fix the effectless GIT_DIFFTOOL_PROMPT test
GIT_DIFFTOOL_PROMPT doesn't have any effect if overridden with --prompt.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-24 17:21:24 -07:00
Junio C Hamano
02d56fab8b Merge branch 'maint'
* maint:
  Fix list of released versions in the toc document
  Do not fail "describe --always" in a tag-less repository
2009-10-23 22:40:18 -07:00
Junio C Hamano
0adc030615 Merge branch 'jp/maint-send-email-fold' into maint
* jp/maint-send-email-fold:
  git-send-email.perl: fold multiple entry "Cc:" and multiple single line "RCPT TO:"s
2009-10-23 22:30:42 -07:00
Junio C Hamano
70ed433c2b Merge branch 'pv/maint-add-p-no-exclude' into maint
* pv/maint-add-p-no-exclude:
  git-add--interactive: never skip files included in index
2009-10-23 22:29:19 -07:00
Jens Lehmann
86140d56c1 add tests for git diff --submodule
Copied from the submodule summary test and changed to reflect the
differences in the output of git diff --submodule.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-23 17:07:33 -07:00
Junio C Hamano
024ab976ff Do not fail "describe --always" in a tag-less repository
This fixes a regression introduce by d68dc34 (git-describe: Die early if
there are no possible descriptions, 2009-08-06).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-23 12:00:41 -07:00
Junio C Hamano
3694209ca1 Merge branch 'maint'
* maint:
  Document `delta` attribute in "git help attributes".
  Mark files in t/t5100 as UTF-8
  Remove a left-over file from t/t5100
2009-10-21 17:33:15 -07:00
Johannes Sixt
814a9bfee9 Mark files in t/t5100 as UTF-8
This enables gitk to show the patch text with correct glyphs if the locale
is not UTF-8.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-21 11:27:50 -07:00
Johannes Sixt
66bcb6a68f Remove a left-over file from t/t5100
This mbox file must have been added by accident in e9fe804 (git-mailinfo:
Fix getting the subject from the in-body [PATCH] line, 2008-07-14).

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-21 11:27:48 -07:00
Thomas Rast
8f8f5476cd Introduce new pretty formats %g[sdD] for reflog information
Add three new --pretty=format escapes:

  %gD  long  reflog descriptor (e.g. refs/stash@{0})
  %gd  short reflog descriptor (e.g. stash@{0})
  %gs  reflog message

This is achieved by passing down the reflog info, if any, inside the
pretty_print_context struct.

We use the newly refactored get_reflog_selector(), and give it some
extra functionality to extract a shortened ref.  The shortening is
cached inside the commit_reflogs struct; the only allocation of it
happens in read_complete_reflog(), where it is initialised to 0.  Also
add another helper get_reflog_message() for the message extraction.

Note that the --format="%h %gD: %gs" tests may not work in real
repositories, as the --pretty formatter doesn't know to leave away the
": " on the last commit in an incomplete (because git-gc removed the
old part) reflog.  This equivalence is nevertheless the main goal of
this patch.

Thanks to Jeff King for reviews, the %gd testcase and documentation.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19 22:28:26 -07:00
Johan Herland
a099469bbc Add selftests verifying concatenation of multiple notes for the same commit
Also verify that multiple references to the _same_ note blob are _not_
concatenated.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19 19:00:24 -07:00
Johan Herland
0057c0917d Add selftests verifying that we can parse notes trees with various fanouts
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19 19:00:24 -07:00
Johan Herland
3ed24b6aaf t3302-notes-index-expensive: Speed up create_repo()
Creating repos with 10/100/1000/10000 commits and notes takes a lot of time.
However, using git-fast-import to do the job is a lot more efficient than
using plumbing commands to do the same.

This patch decreases the overall run-time of this test on my machine from
~3 to ~1 minutes.

Signed-off-by: Johan Herland <johan@herland.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19 19:00:24 -07:00
Johan Herland
a8dd2e7d2b fast-import: Add support for importing commit notes
Introduce a 'notemodify' subcommand of the 'commit' command. This subcommand
is similar to 'filemodify', except that no mode is supplied (all notes have
mode 0644), and the path is set to the hex SHA1 of the given "comittish".

This enables fast import of note objects along with their associated commits,
since the notes can now be named using the mark references of their
corresponding commits.

The patch also includes a test case of the added functionality.

Signed-off-by: Johan Herland <johan@herland.net>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19 19:00:24 -07:00
Johan Herland
d9246d4303 Teach "-m <msg>" and "-F <file>" to "git notes edit"
The "-m" and "-F" options are already the established method
(in both git-commit and git-tag) to specify a commit/tag message
without invoking the editor. This patch teaches "git notes edit"
to respect the same options for specifying a notes message without
invoking the editor.

Multiple "-m" and/or "-F" options are concatenated as separate
paragraphs.

The patch also updates the "git notes" documentation and adds
selftests for the new functionality. Unfortunately, the added
selftests include a couple of lines with trailing whitespace
(without these the test will fail). This may cause git to warn
about "whitespace errors".

This patch has been improved by the following contributions:
- Thomas Rast: fix trailing whitespace in t3301

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19 18:59:43 -07:00
Johannes Schindelin
a5b0c24f3e Add an expensive test for git-notes
git-notes have the potential of being pretty expensive, so test with
a lot of commits.  A lot.  So to make things cheaper, you have to
opt-in explicitely, by setting the environment variable
GIT_NOTES_TIMING_TESTS.

This patch has been improved by the following contributions:
- Junio C Hamano: tests: fix "export var=val"

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19 18:59:42 -07:00
Johannes Schindelin
65d9fb487f Add a script to edit/inspect notes
The script 'git notes' allows you to edit and show commit notes, by
calling either

	git notes show <commit>

or

	git notes edit <commit>

This patch has been improved by the following contributions:
- Tor Arne Vestbø: fix printing of multi-line notes
- Michael J Gruber: test and handle empty notes gracefully
- Thomas Rast:
  - only clean up message file when editing
  - use GIT_EDITOR and core.editor over VISUAL/EDITOR
  - t3301: fix confusing quoting in test for valid notes ref
  - t3301: use test_must_fail instead of !
  - refuse to edit notes outside refs/notes/
- Junio C Hamano: tests: fix "export var=val"
- Christian Couder: documentation: fix 'linkgit' macro in "git-notes.txt"
- Johan Herland: minor cleanup and bugfixing in git-notes.sh (v2)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Tor Arne Vestbø <tavestbo@trolltech.com>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19 18:59:42 -07:00
Junio C Hamano
e79999b1a2 Merge branch 'bg/rebase-reword'
* bg/rebase-reword:
  rebase -i: fix reword when using a terminal editor
  Teach 'rebase -i' the command "reword"
2009-10-19 00:49:21 -07:00
Junio C Hamano
ee50af1566 Merge branch 'jp/maint-send-email-fold'
* jp/maint-send-email-fold:
  git-send-email.perl: fold multiple entry "Cc:" and multiple single line "RCPT TO:"s
2009-10-18 23:01:37 -07:00
Junio C Hamano
804edc13ae Merge branch 'cc/replace-no-replace'
* cc/replace-no-replace:
  git: add --no-replace-objects option to disable replacing
2009-10-18 23:01:31 -07:00
Junio C Hamano
e38d1c555e Merge branch 'jk/maint-1.6.3-ls-files-no-ignore-cached'
* jk/maint-1.6.3-ls-files-no-ignore-cached:
  ls-files: excludes should not impact tracked files
2009-10-18 23:01:22 -07:00
Junio C Hamano
619a644d6d "checkout A...B" switches to the merge base between A and B
When flipping commits around on topic branches, I often end up doing
this sequence:

 * Run "log --oneline next..jc/frotz" to find out the first commit
   on 'jc/frotz' branch not yet merged to 'next';

 * Run "checkout $that_commit^" to detach HEAD to the parent of it;

 * Rebuild the series on top of that commit; and

 * "show-branch jc/frotz HEAD" and "diff jc/frotz HEAD" to verify.

Introduce a new syntax to "git checkout" to name the commit to switch to,
to make the first two steps easier.  When the branch to switch to is
specified as A...B (you can omit either A or B but not both, and HEAD
is used instead of the omitted side), the merge base between these two
commits are computed, and if there is one unique one, we detach the HEAD
at that commit.

With this, I can say "checkout next...jc/frotz".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-18 12:34:56 -07:00
Junio C Hamano
9981c808b4 Merge branch 'jc/maint-blank-at-eof'
* jc/maint-blank-at-eof:
  diff -B: colour whitespace errors
  diff.c: emit_add_line() takes only the rest of the line
  diff.c: split emit_line() from the first char and the rest of the line
  diff.c: shuffling code around
  diff --whitespace: fix blank lines at end
  core.whitespace: split trailing-space into blank-at-{eol,eof}
  diff --color: color blank-at-eof
  diff --whitespace=warn/error: fix blank-at-eof check
  diff --whitespace=warn/error: obey blank-at-eof
  diff.c: the builtin_diff() deals with only two-file comparison
  apply --whitespace: warn blank but not necessarily empty lines at EOF
  apply --whitespace=warn/error: diagnose blank at EOF
  apply.c: split check_whitespace() into two
  apply --whitespace=fix: detect new blank lines at eof correctly
  apply --whitespace=fix: fix handling of blank lines at the eof
2009-10-17 00:11:03 -07:00
Junio C Hamano
7641eb400f Merge branch 'maint'
* maint:
  GIT 1.6.5.1
  grep: do not segfault when -f is used
2009-10-17 00:10:33 -07:00
Junio C Hamano
050dfc4535 Merge branch 'maint-1.6.4' into maint
* maint-1.6.4:
  grep: do not segfault when -f is used
2009-10-16 23:47:58 -07:00
Matt Kraai
cfe370c647 grep: do not segfault when -f is used
"git grep" would segfault if its -f option was used because it would
try to use an uninitialized strbuf, so initialize the strbuf.

Thanks to Johannes Sixt <j.sixt@viscovery.net> for the help with the
test cases.

Signed-off-by: Matt Kraai <kraai@ftbfs.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-16 23:47:47 -07:00
Junio C Hamano
c274db7057 Merge branch 'pv/maint-add-p-no-exclude'
* pv/maint-add-p-no-exclude:
  git-add--interactive: never skip files included in index
2009-10-14 16:13:20 -07:00
Junio C Hamano
695f9523dd Merge branch 'maint'
* maint:
  sha1_file: Fix infinite loop when pack is corrupted
2009-10-14 16:10:37 -07:00
Shawn O. Pearce
b3118bdc91 sha1_file: Fix infinite loop when pack is corrupted
Some types of corruption to a pack may confuse the deflate stream
which stores an object.  In Andy's reported case a 36 byte region
of the pack was overwritten, leading to what appeared to be a valid
deflate stream that was trying to produce a result larger than our
allocated output buffer could accept.

Z_BUF_ERROR is returned from inflate() if either the input buffer
needs more input bytes, or the output buffer has run out of space.
Previously we only considered the former case, as it meant we needed
to move the stream's input buffer to the next window in the pack.

We now abort the loop if inflate() returns Z_BUF_ERROR without
consuming the entire input buffer it was given, or has filled
the entire output buffer but has not yet returned Z_STREAM_END.
Either state is a clear indicator that this loop is not working
as expected, and should not continue.

This problem cannot occur with loose objects as we open the entire
loose object as a single buffer and treat Z_BUF_ERROR as an error.

Reported-by: Andy Isaacson <adi@hexapodia.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-14 13:39:37 -07:00
Christian Couder
b0fa7ab51b git: add --no-replace-objects option to disable replacing
Commit dae556b (environment: add global variable to disable replacement)
adds a variable to enable/disable replacement, and it is enabled by
default for most commands.

So there is no way to disable it for some commands, which is annoying
when we want to get information about a commit that has been replaced.

For example:

$ git cat-file -p N

would output information about the replacement commit if commit N is
replaced.

With the "--no-replace-objects" option that this patch adds it is
possible to get information about the original commit using:

$ git --no-replace-objects cat-file -p N

While at it, let's add some documentation about this new option in the
"git replace" man page too.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-13 01:07:29 -07:00
Junio C Hamano
38eedc634b git check-ref-format --print
Tolerating empty path components in ref names means each ref does
not have a unique name.  This creates difficulty for porcelains
that want to see if two branches are equal.  Add a helper associating
to each ref a canonical name.

If a user asks a porcelain to create a ref "refs/heads//master",
the porcelain can run "git check-ref-format --print refs/heads//master"
and only deal with "refs/heads/master" from then on.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-12 16:39:59 -07:00
Jonathan Nieder
58a05c74e7 Add tests for git check-ref-format
The "git check-ref-format" command is a basic command various
porcelains rely on.  Test its functionality to make sure it does
not unintentionally change.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-12 16:24:25 -07:00
Thomas Rast
77abcbdc26 Let --decorate show HEAD position
'git log --graph --oneline --decorate --all' is a useful way to get a
general overview of the repository state, similar to 'gitk --all'.
Let it indicate the position of HEAD by loading that ref too, so that
the --decorate code can see it.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-12 16:22:35 -07:00
Jeff King
b5227d80ae ls-files: excludes should not impact tracked files
In all parts of git, .gitignore and other exclude files
impact only how we treat untracked files; they should have
no effect on files listed in the index.

This behavior was originally implemented very early on in
9ff768e, but only for --exclude-from. Later, commit 63d285c
accidentally caused us to trigger the behavior for
--exclude-per-directory.

This patch totally ignores excludes for files found in the
index. This means we are reversing the original intent of
9ff768e, while at the same time fixing the accidental
behavior of 63d285c. This is a good thing, though, as the
way that 9ff768e behaved does not really make sense with the
way exclusions are used in modern git.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-12 16:12:49 -07:00
Pauli Virtanen
b145b211ba git-add--interactive: never skip files included in index
Make "git add -p" to not skip files that are in index even if they are
excluded (by .gitignore etc.). This fixes the contradictory behavior
that "git status" and "git commit -a" listed such files as modified, but
"git add -p FILENAME" ignored them.

Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-10 14:56:13 -07:00
Joe Perches
02461e0e28 git-send-email.perl: fold multiple entry "Cc:" and multiple single line "RCPT TO:"s
Some MTAs reject Cc: lines longer than 78 chars.
Avoid this by using the same join as "To:" ",\n\t"
so each subsequent Cc entry is on a new line.

RCPT TO: should have a single entry per line.
see: http://www.ietf.org/rfc/rfc2821.txt

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-09 17:02:21 -07:00
Junio C Hamano
a17a9606e4 Merge branch 'rs/maint-archive-prefix'
* rs/maint-archive-prefix:
  Git archive and trailing "/" in prefix
2009-10-09 16:27:16 -07:00
René Scharfe
ebfbdb340a Git archive and trailing "/" in prefix
With --prefix=string that does not end with a slash, the top-level entries
are written out with the specified prefix as expected, but no paths in the
directories are added.

Fix this by adding the prefix in write_archive_entry() instead of letting
get_pathspec() and read_tree_recursive() pair; they are designed to only
handle prefixes that are path components.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-08 22:17:07 -07:00
Björn Gustavsson
6741aa6c39 Teach 'rebase -i' the command "reword"
Make it easier to edit just the commit message for a commit
using 'git rebase -i' by introducing the "reword" command.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-07 21:46:41 -07:00
Junio C Hamano
9fa708dab1 Pretty-format: %[+-]x to tweak inter-item newlines
This teaches the "pretty" machinery to expand '%+x' to a LF followed by
the expansion of '%x' if and only if '%x' expands to a non-empty string,
and to remove LFs before '%-x' if '%x' expands to an empty string.  This
works for any supported expansion placeholder 'x'.

This is expected to be immediately useful to reproduce the commit log
message with "%s%+b%n"; "%s%n%b%n" adds one extra LF if the log message is
a one-liner.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-04 23:43:32 -07:00
Junio C Hamano
a7aebb9d00 Merge branch 'maint'
* maint:
  show-branch: fix segfault when showbranch.default exists
2009-10-04 14:48:51 -07:00
Junio C Hamano
04ce83e2b9 Merge branch 'jc/maint-1.6.4-show-branch-default' into maint
* jc/maint-1.6.4-show-branch-default:
  show-branch: fix segfault when showbranch.default exists
2009-10-04 14:48:44 -07:00
Junio C Hamano
3af1cae469 show-branch: fix segfault when showbranch.default exists
When running "git show-branch" without any parameter in a repository that
has showbranch.default defined, we used to rely on the fact that our
handcrafted option parsing loop never looked at av[0].

The array of default strings had the first real command line argument in
default_arg[0], but the option parser wanted to look at the array starting
at av[1], so we assigned the address of -1th element to av to force the
loop start working from default_arg[0].

This no longer worked since 5734365 (show-branch: migrate to parse-options
API, 2009-05-21), as parse_options_start() saved the incoming &av[0] in
its ctx->out and later in parse_options_end() it did memmove to ctx->out
(with ctx->cpidx == 0), overwriting the memory before default_arg[] array.

I am not sure if this is a bug in parse_options(), or a bug in the caller,
and tonight I do not have enough concentration to figure out which.  In
any case, this patch works the issue around.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-04 14:44:34 -07:00
Johan Sageryd
dbc1b1f710 Fix '--relative-date'
This fixes '--relative-date' so that it does not give '0
year, 12 months', for the interval 360 <= diff < 365.

Signed-off-by: Johan Sageryd <j416@1616.se>
Signed-off-by: Jeff King <peff@peff.net>
2009-10-03 06:04:38 -04:00
Mark Rada
b4ae5e2ac4 tests: make all test files executable
For consistency with the rest of the test files.

Signed-off-by: Mark Rada <marada@uwaterloo.ca>
Signed-off-by: Jeff King <peff@peff.net>
2009-10-02 04:00:02 -04:00
Mark Rada
fdb0c36e90 gitweb: check given hash before trying to create snapshot
Makes things nicer in cases when you hand craft the snapshot URL but
make a typo in defining the hash variable (e.g. netx instead of next);
you will now get an error message instead of a broken tarball.

Tests for t9501 are included to demonstrate added functionality.

Signed-off-by: Mark Rada <marada@uwaterloo.ca>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-09-29 10:06:51 -07:00
Andreas Schwab
6bbfd1fa98 parse-opt: ignore negation of OPT_NONEG for ambiguity checks
parse_long_opt always matches both --opt and --no-opt for any option
"opt", and only get_value checks whether --no-opt is actually valid.
Since the options for git branch contains both "no-merged" and "merged"
there are two matches for --no-merge, but no exact match.  With this
patch the negation of a NONEG option is rejected earlier, but it changes
the error message from "option `no-opt' isn't available" to "unknown
option `no-opt'".

[jk: added test]

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-09-29 07:28:47 -07:00
Jens Lehmann
1414e5788b git submodule add: make the <path> parameter optional
When <path> is not given, use the "humanish" part of the source repository
instead.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-22 12:24:49 -07:00
Junio C Hamano
af4f640529 Merge branch 'jc/maint-unpack-objects-strict' into maint
* jc/maint-unpack-objects-strict:
  Fix "unpack-objects --strict"

Conflicts:
	builtin-unpack-objects.c
2009-09-16 14:45:18 -07:00
Junio C Hamano
bd91890c62 Merge branch 'jk/maint-1.6.3-checkout-unborn' into maint
* jk/maint-1.6.3-checkout-unborn:
  checkout: do not imply "-f" on unborn branches
2009-09-16 14:26:56 -07:00
Junio C Hamano
bba287531b Merge branch 'jc/maint-checkout-index-to-prefix' into maint
* jc/maint-checkout-index-to-prefix:
  check_path(): allow symlinked directories to checkout-index --prefix
2009-09-16 14:26:40 -07:00
Junio C Hamano
afd9db4173 Merge branch 'jc/maint-1.6.0-blank-at-eof' (early part) into jc/maint-blank-at-eof
* 'jc/maint-1.6.0-blank-at-eof' (early part):
  diff --whitespace: fix blank lines at end
  core.whitespace: split trailing-space into blank-at-{eol,eof}
  diff --color: color blank-at-eof
  diff --whitespace=warn/error: fix blank-at-eof check
  diff --whitespace=warn/error: obey blank-at-eof
  diff.c: the builtin_diff() deals with only two-file comparison
  apply --whitespace: warn blank but not necessarily empty lines at EOF
  apply --whitespace=warn/error: diagnose blank at EOF
  apply.c: split check_whitespace() into two
  apply --whitespace=fix: detect new blank lines at eof correctly
  apply --whitespace=fix: fix handling of blank lines at the eof
2009-09-15 03:28:08 -07:00
Junio C Hamano
d68fe26f3e diff --whitespace: fix blank lines at end
The earlier logic tried to colour any and all blank lines that were added
beyond the last blank line in the original, but this was very wrong.  If
you added 96 blank lines, a non-blank line, and then 3 blank lines at the
end, only the last 3 lines should trigger the error, not the earlier 96
blank lines.

We need to also make sure that the lines are after the last non-blank line
in the postimage as well before deciding to paint them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-14 22:18:36 -07:00
Clemens Buchacher
98df233e2d test local clone by copying
Test the effect of an earlier change by f7835a2 (preserve mtime of local
clone, 2009-09-12) to keep stale loose object files stale in the new
repository when a local clone is made by copying files in .git/
directory.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 13:22:29 -07:00
Junio C Hamano
79cb645f9a Merge branch 'jt/pushinsteadof'
* jt/pushinsteadof:
  Add url.<base>.pushInsteadOf: URL rewriting for push only
  Wrap rewrite globals in a struct in preparation for adding another set
2009-09-13 01:33:20 -07:00
Junio C Hamano
5b590d783a Merge branch 'maint'
* maint:
  GIT 1.6.4.3
  svn: properly escape arguments for authors-prog
  http.c: remove verification of remote packs
  grep: accept relative paths outside current working directory
  grep: fix exit status if external_grep() punts

Conflicts:
	GIT-VERSION-GEN
	RelNotes
2009-09-13 01:30:53 -07:00
Mark Lodato
d3d7d47e6e svn: properly escape arguments for authors-prog
Previously, the call to authors-prog was not properly escaped, so any
special characters in the Subversion username, such as spaces and
semi-colons, would be interpreted by the shell rather than being passed
in as the first argument.  Now all unsafe characters are escaped using
"git rev-parse --sq-quote"

[ew: switched from "\Q..\E" to "rev-parse --sq-quote"]

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 01:28:07 -07:00
Junio C Hamano
45c58ba00a Merge branch 'cb/maint-1.6.3-grep-relative-up' into maint
* cb/maint-1.6.3-grep-relative-up:
  grep: accept relative paths outside current working directory
  grep: fix exit status if external_grep() punts

Conflicts:
	t/t7002-grep.sh
2009-09-13 01:24:20 -07:00
Josh Triplett
1c2eafb89b Add url.<base>.pushInsteadOf: URL rewriting for push only
This configuration option allows systematically rewriting fetch-only URLs
to push-capable URLs when used with push.  For instance:

[url "ssh://example.org/"]
    pushInsteadOf = "git://example.org/"

This will allow clones of "git://example.org/path/to/repo" to subsequently
push to "ssh://example.org/path/to/repo", without manually configuring
pushurl for that remote.

Includes documentation for the new option, bash completion updates, and
test cases (both that pushInsteadOf applies to push, that it does not
apply to fetch, and that it is ignored when pushURL is already defined).

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-08 01:18:46 -07:00
Junio C Hamano
b8711f520b Merge branch 'jc/mailinfo-scissors'
* jc/mailinfo-scissors:
  mailinfo.scissors: new configuration
  am/mailinfo: Disable scissors processing by default
  Documentation: describe the scissors mark support of "git am"
  Teach mailinfo to ignore everything before -- >8 -- mark
  builtin-mailinfo.c: fix confusing internal API to mailinfo()
2009-09-07 15:25:37 -07:00
Junio C Hamano
2da9f8e370 Merge branch 'jk/clone-b'
* jk/clone-b:
  clone: add --branch option to select a different HEAD
2009-09-07 15:24:53 -07:00
Junio C Hamano
e4d1afbcf2 Merge branch 'jc/upload-pack-hook'
* jc/upload-pack-hook:
  upload-pack: feed "kind [clone|fetch]" to post-upload-pack hook
  upload-pack: add a trigger for post-upload-pack hook
2009-09-07 15:24:47 -07:00
Junio C Hamano
54f0bdc811 Merge branch 'tr/reset-checkout-patch'
* tr/reset-checkout-patch:
  stash: simplify defaulting to "save" and reject unknown options
  Make test case number unique
  tests: disable interactive hunk selection tests if perl is not available
  DWIM 'git stash save -p' for 'git stash -p'
  Implement 'git stash save --patch'
  Implement 'git checkout --patch'
  Implement 'git reset --patch'
  builtin-add: refactor the meat of interactive_add()
  Add a small patch-mode testing library
  git-apply--interactive: Refactor patch mode code
  Make 'git stash -k' a short form for 'git stash save --keep-index'
2009-09-07 15:24:38 -07:00
Clemens Buchacher
493b7a08d8 grep: accept relative paths outside current working directory
"git grep" would barf at relative paths pointing outside the current
working directory (or subdirectories thereof). Use quote_path_relative(),
which can handle such cases just fine.

[jc: added tests.]

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-07 15:03:04 -07:00
Junio C Hamano
690ed84363 diff --color: color blank-at-eof
Since the coloring logic processed the patch output one line at a time, we
couldn't easily color code the new blank lines at the end of file.

Reuse the adds_blank_at_eof() function to find where the runs of such
blank lines start, keep track of the line number in the preimage while
processing the patch output one line at a time, and paint the new blank
lines that appear after that line to implement this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-04 11:50:27 -07:00
Junio C Hamano
467babf8d0 diff --whitespace=warn/error: fix blank-at-eof check
The "diff --check" logic used to share the same issue as the one fixed for
"git apply" earlier in this series, in that a patch that adds new blank
lines at end could appear as

    @@ -l,5 +m,7 @@$
    _context$
    _context$
    -deleted$
    +$
    +$
    +$
    _$
    _$

where _ stands for SP and $ shows a end-of-line.  Instead of looking at
each line in the patch in the callback, simply count the blank lines from
the end in two versions, and notice the presence of new ones.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-04 11:50:27 -07:00
Junio C Hamano
5b5061efd8 diff --whitespace=warn/error: obey blank-at-eof
The "diff --check" code used to conflate trailing-space whitespace error
class with this, but now we have a proper separate error class, we should
check it under blank-at-eof, not trailing-space.

The whitespace error is not about _having_ blank lines at end, but about
adding _new_ blank lines.  To keep the message consistent with what is
given by "git apply", call whitespace_error_string() to generate it,
instead of using a hardcoded custom message.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-04 11:50:26 -07:00
Junio C Hamano
94ea026b35 apply --whitespace: warn blank but not necessarily empty lines at EOF
The whitespace error of adding blank lines at the end of file should
trigger if you added a non-empty line at the end, if the contents of the
line is full of whitespaces.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-04 11:50:26 -07:00
Junio C Hamano
77b15bbd88 apply --whitespace=warn/error: diagnose blank at EOF
"git apply" strips new blank lines at EOF under --whitespace=fix option,
but neigher --whitespace=warn nor --whitespace=error paid any attention to
these errors.

Introduce a new whitespace error class, blank-at-eof, to make the
whitespace error handling more consistent.

The patch adds a new "linenr" field to the struct fragment in order to
record which line the hunk started in the input file, but this is needed
solely for reporting purposes.  The detection of this class of whitespace
errors cannot be done while parsing a patch like we do for all the other
classes of whitespace errors.  It instead has to wait until we find where
to apply the hunk, but at that point, we do not have an access to the
original line number in the input file anymore, hence the new field.

Depending on your point of view, this may be a bugfix that makes warn and
error in line with fix.  Or you could call it a new feature.  The line
between them is somewhat fuzzy in this case.

Strictly speaking, triggering more errors than before is a change in
behaviour that is not backward compatible, even though the reason for the
change is because the code was not checking for an error that it should
have.  People who do not want added blank lines at EOF to trigger an error
can disable the new error class.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-04 11:50:26 -07:00
Junio C Hamano
efa574438f apply --whitespace=fix: detect new blank lines at eof correctly
The command tries to strip blank lines at the end of the file added by a
patch.  It is done by first detecting if a hunk in patch has additional
blank lines at the end of itself, and if so checking if such a hunk
applies at the end of file.  This patch addresses a bug in the logic to
implement the former (the previous one addressed a bug in the latter).

If the original ends with blank lines, often the patch hunk ends like
this:

    @@ -l,5 +m,7 @@$
    _context$
    _context$
    -deleted$
    +$
    +$
    +$
    _$
    _$

where _ stands for SP and $ shows a end-of-line.  This example patch adds
three trailing blank lines, but the code fails to notice it, because it
only pays attention to added blank lines at the very end of the hunk.  In
this example, the three added blank lines do not appear textually at the
end in the patch, even though you can see that they are indeed added at
the end, if you rearrange the diff like this:

    @@ -l,5 +m,7 @@$
    _context$
    _context$
    -deleted$
    _$
    _$
    +$
    +$
    +$

The fix is not to reset the number of (candidate) added blank lines at the
end when the loop sees a context line that is empty.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-04 11:44:40 -07:00
Junio C Hamano
ef2035c5e5 apply --whitespace=fix: fix handling of blank lines at the eof
b94f2ed (builtin-apply.c: make it more line oriented, 2008-01-26) broke
the logic used to detect if a hunk adds blank lines at the end of the
file.  With the new code after that commit:

 - img holds the contents of the file that the hunk is being applied to;

 - preimage has the lines the hunk expects to be in img; and

 - postimage has the lines the hunk wants to update the part in img that
   corresponds to preimage with.

and we need to compare if the last line of preimage (not postimage)
matches the last line of img to see if the hunk applies at the end of the
file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-04 02:35:24 -07:00
Junio C Hamano
bc29df6022 Merge branch 'maint-1.6.3' into maint
* maint-1.6.3:
  git-clone: add missing comma in --reference documentation
  git-cvsserver: no longer use deprecated 'git-subcommand' commands
  clone: disconnect transport after fetching
2009-09-03 09:42:56 -07:00
Junio C Hamano
ba7e81430a Merge branch 'maint-1.6.2' into maint-1.6.3
* maint-1.6.2:
  git-clone: add missing comma in --reference documentation
  clone: disconnect transport after fetching
2009-09-03 09:42:38 -07:00
Junio C Hamano
193a5d195b Merge branch 'maint'
* maint:
  git-cvsserver: no longer use deprecated 'git-subcommand' commands
  clone: disconnect transport after fetching
2009-09-02 19:52:18 -07:00
Junio C Hamano
daf85d97f8 Merge branch 'maint-1.6.3' into maint
* maint-1.6.3:
  git-cvsserver: no longer use deprecated 'git-subcommand' commands
  clone: disconnect transport after fetching
2009-09-02 19:51:55 -07:00
Junio C Hamano
8cc15acfb8 Merge branch 'maint-1.6.2' into maint-1.6.3
* maint-1.6.2:
  clone: disconnect transport after fetching
2009-09-02 18:45:44 -07:00
Jeff King
12d4996622 clone: disconnect transport after fetching
The current code just leaves the transport in whatever state
it was in after performing the fetch.  For a non-empty clone
over the git protocol, the transport code already
disconnects at the end of the fetch.

But for an empty clone, we leave the connection hanging, and
eventually close the socket when clone exits. This causes
the remote upload-pack to complain "the remote end hung up
unexpectedly". While this message is harmless to the clone
itself, it is unnecessarily scary for a user to see and may
pollute git-daemon logs.

This patch just explicitly calls disconnect after we are
done with the remote end, which sends a flush packet to
upload-pack and cleanly disconnects, avoiding the error
message.

Other transports are unaffected or slightly improved:

 - for a non-empty repo over the git protocol, the second
   disconnect is a no-op (since we are no longer connected)

 - for "walker" transports (like HTTP or FTP), we actually
   free some used memory (which previously just sat until
   the clone process exits)

 - for "rsync", disconnect is always a no-op anyway

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-02 18:39:02 -07:00
Matthieu Moy
3c2eb80fe3 stash: simplify defaulting to "save" and reject unknown options
With the earlier DWIM patches, certain combination of options defaulted
to the "save" command correctly while certain equally valid combination
did not.  For example, "git stash -k" were Ok but "git stash -q -k" did
not work.

This makes the logic of defaulting to "save" much simpler. If there are no
non-flag arguments, it is clear that there is no command word, and we
default to "save" subcommand.  This rule prevents "git stash -q apply"
from quietly creating a stash with "apply" as the message.

This also teaches "git stash save" to reject an unknown option.  This is
to keep a mistyped "git stash save --quite" from creating a stash with a
message "--quite", and this safety is more important with the new logic
to default to "save" with any option-looking argument without an explicit
comand word.

[jc: this is based on Matthieu's 3-patch series, and a follow-up
discussion, and he and Peff take all the credit; if I have introduced bugs
while reworking, they are mine.]

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-01 22:03:11 -07:00
Junio C Hamano
554555ac7d Merge branch 'lt/approxidate'
* lt/approxidate:
  fix approxidate parsing of relative months and years
  tests: add date printing and parsing tests
  refactor test-date interface
  Add date formatting and parsing functions relative to a given time
  Further 'approxidate' improvements
  Improve on 'approxidate'

Conflicts:
	date.c
2009-08-31 22:11:36 -07:00
Junio C Hamano
909beb860b Merge branch 'mr/gitweb-snapshot'
* mr/gitweb-snapshot:
  gitweb: add t9501 tests for checking HTTP status codes
  gitweb: split test suite into library and tests
  gitweb: improve snapshot error handling
2009-08-31 22:09:53 -07:00
Jeff King
931e8e27d9 fix approxidate parsing of relative months and years
These were broken by b5373e9. The problem is that the code
marks the month and year with "-1" for "we don't know it
yet", but the month and year code paths were not adjusted to
fill in the current time before doing their calculations
(whereas other units follow a different code path and are
fine).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-30 22:04:56 -07:00
Jeff King
34dc6e73b0 tests: add date printing and parsing tests
Until now, there was no coverage of relative date printing
or approxidate parsing routines (mainly because we had no
way of faking the "now" time for relative date calculations,
which made consistent testing impossible).

This new script tries to exercise the basic features of
show_date and approxidate. Most of the tests are just "this
obvious thing works" to prevent future regressions, with a
few exceptions:

  - We confirm the fix in 607a9e8 that relative year/month
    dates in the latter half of a year round correctly.

  - We confirm that the improvements in b5373e9 and 1bddb25
    work.

  - A few tests are marked to expect failure, which are
    regressions recently introduced by the two commits
    above.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-30 22:04:56 -07:00
Junio C Hamano
f324cb50be Sync with 1.6.4.2 2009-08-29 14:52:03 -07:00
Nanako Shiraishi
e71c008dce Remove unused t/t8005/iso8859-5.txt
This file is no longer used since 54bc13c (t8005: Nobody writes Russian in
shift_jis, 2009-06-18).

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-29 00:50:31 -07:00
Junio C Hamano
11cae066b2 upload-pack: feed "kind [clone|fetch]" to post-upload-pack hook
A request to clone the repository does not give any "have" but asks for
all the refs we offer with "want".  When a request does not ask to clone
the repository fully, but asks to fetch some refs into an empty
repository, it will not give any "have" but its "want" won't ask for all
the refs we offer.

If we suppose (and I would say this is a rather big if) that it makes
sense to distinguish these two cases, a hook cannot reliably do this
alone.  The hook can detect lack of "have" and bunch of "want", but there
is no direct way to tell if the other end asked for all refs we offered,
or merely most of them.

Between the time we talked with the other end and the time the hook got
called, we may have acquired more refs or lost some refs in the repository
by concurrent operations.  Given that we plan to introduce selective
advertisement of refs with a protocol extension, it would become even more
difficult for hooks to guess between these two cases.

This adds "kind [clone|fetch]" to hook's input, as a stable interface to
allow the hooks to tell these cases apart.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-28 22:39:24 -07:00
Junio C Hamano
a8563ec851 upload-pack: add a trigger for post-upload-pack hook
After upload-pack successfully finishes its operation, post-upload-pack
hook can be called for logging purposes.

The hook is passed various pieces of information, one per line, from its
standard input.  Currently the following items can be fed to the hook, but
more types of information may be added in the future:

    want SHA-1::
        40-byte hexadecimal object name the client asked to include in the
        resulting pack.  Can occur one or more times in the input.

    have SHA-1::
        40-byte hexadecimal object name the client asked to exclude from
        the resulting pack, claiming to have them already.  Can occur zero
        or more times in the input.

    time float::
        Number of seconds spent for creating the packfile.

    size decimal::
        Size of the resulting packfile in bytes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-28 22:39:17 -07:00
Junio C Hamano
235db154f8 Merge branch 'mm/reset-report'
* mm/reset-report:
  reset: make the reminder output consistent with "checkout"
  Rename REFRESH_SAY_CHANGED to REFRESH_IN_PORCELAIN.
2009-08-28 19:39:26 -07:00
Junio C Hamano
4a224a9bbe Merge branch 'jk/maint-1.6.3-checkout-unborn'
* jk/maint-1.6.3-checkout-unborn:
  checkout: do not imply "-f" on unborn branches
2009-08-28 19:39:07 -07:00
Junio C Hamano
232d453766 Merge branch 'np/maint-1.6.3-deepen'
* np/maint-1.6.3-deepen:
  fix simple deepening of a repo

Conflicts:
	t/t5500-fetch-pack.sh
2009-08-28 19:38:56 -07:00
Junio C Hamano
433233e0b6 Merge branch 'jc/shortstatus'
* jc/shortstatus:
  git commit --dry-run -v: show diff in color when asked
  Documentation/git-commit.txt: describe --dry-run
  wt-status: collect untracked files in a separate "collect" phase
  Make git_status_config() file scope static to builtin-commit.c
  wt-status: move wt_status_colors[] into wt_status structure
  wt-status: move many global settings to wt_status structure
  commit: --dry-run
  status: show worktree status of conflicted paths separately
  wt-status.c: rework the way changes to the index and work tree are summarized
  diff-index: keep the original index intact
  diff-index: report unmerged new entries
2009-08-28 19:38:19 -07:00
Brandon Casey
8648732e29 t/test-lib.sh: provide a shell implementation of the 'yes' utility
Some platforms (IRIX 6.5, Solaris 7) do not provide the 'yes' utility.
Currently, some tests, including t7610 and t9001, try to call this program.
Due to the way the tests are structured, the tests still pass even though
this program is missing.  Rather than succeeding by chance, let's provide
an implementation of the simple 'yes' utility in shell for all platforms to
use.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-28 16:36:24 -07:00
Junio C Hamano
a1eb73d917 Merge branch 'maint-1.5.6' into maint-1.6.0
* maint-1.5.6:
  revision traversal and pack: notice and die on missing commit
2009-08-27 20:03:35 -07:00
Mark Rada
e39e0d375d gitweb: add t9501 tests for checking HTTP status codes
Adds a new test file, t9501, that checks HTTP status codes and messages
from gitweb.

Currently, the only tests are for the snapshot feature.

Signed-off-by: Mark Rada <marada@uwaterloo.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-27 19:56:28 -07:00
Mark Rada
05526071cb gitweb: split test suite into library and tests
To accommodate additions to the test cases for gitweb, the preamble
from t9500 is now in its own library so that new sets of tests for
gitweb can use the same setup without copying the code.

Signed-off-by: Mark Rada <marada@uwaterloo.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-27 19:56:02 -07:00
Junio C Hamano
24343c6099 Merge branch 'as/maint-graph-interesting-fix'
* as/maint-graph-interesting-fix:
  Add tests for rev-list --graph with options that simplify history
  graph API: fix bug in graph_is_interesting()
2009-08-27 16:59:56 -07:00
Junio C Hamano
adc5423531 Merge branch 'jh/submodule-foreach'
* jh/submodule-foreach:
  git clone: Add --recursive to automatically checkout (nested) submodules
  t7407: Use 'rev-parse --short' rather than bash's substring expansion notation
  git submodule status: Add --recursive to recurse into nested submodules
  git submodule update: Introduce --recursive to update nested submodules
  git submodule foreach: Add --recursive to recurse into nested submodules
  git submodule foreach: test access to submodule name as '$name'
  Add selftest for 'git submodule foreach'
  git submodule: Cleanup usage string and add option parsing to cmd_foreach()
  git submodule foreach: Provide access to submodule name, as '$name'

Conflicts:
	Documentation/git-submodule.txt
	git-submodule.sh
2009-08-27 16:59:25 -07:00
Junio C Hamano
ab36d06f12 Merge branch 'jc/maint-unpack-objects-strict'
* jc/maint-unpack-objects-strict:
  Fix "unpack-objects --strict"

Conflicts:
	builtin-unpack-objects.c
2009-08-27 16:59:08 -07:00
Junio C Hamano
e7c693a8e1 Merge branch 'nd/sparse' (early part)
* 'nd/sparse' (early part):
  Prevent diff machinery from examining assume-unchanged entries on worktree
2009-08-27 16:56:33 -07:00
Johannes Sixt
0e098b6d79 Make test case number unique
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-27 16:45:12 -07:00
Johannes Sixt
14c674e9dc Make test case number unique
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-27 16:44:47 -07:00
Junio C Hamano
017678b4f4 am/mailinfo: Disable scissors processing by default
You can enable it by giving --scissors to "git am".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-26 22:22:22 -07:00
Junio C Hamano
200c75f0d6 Teach mailinfo to ignore everything before -- >8 -- mark
This teaches mailinfo the scissors -- >8 -- mark; the command ignores
everything before it in the message body.

For lefties among us, we also support -- 8< -- ;-)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-26 22:21:32 -07:00
Jeff King
7a4ee28f41 clone: add --branch option to select a different HEAD
We currently point the HEAD of a newly cloned repo to the
same ref as the parent repo's HEAD. While a user can then
"git checkout -b foo origin/foo" whichever branch they
choose, it is more convenient and more efficient to tell
clone which branch you want in the first place.

Based on a patch by Kirill A. Korinskiy.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-26 19:36:20 -07:00
Junio C Hamano
68ea474164 Merge branch 'maint'
* maint:
  git-log: allow --decorate[=short|full]
  Minor improvement to the write-tree documentation
  git-bisect: call the found commit "*the* first bad commit"
2009-08-26 12:15:15 -07:00
Lars Hjemli
d8526a4c3b git-log: allow --decorate[=short|full]
Commit de435ac0 changed the behavior of --decorate from printing the
full ref (e.g., "refs/heads/master") to a shorter, more human-readable
version (e.g., just "master"). While this is nice for human readers,
external tools using the output from "git log" may prefer the full
version.

This patch introduces an extension to --decorate to allow the caller to
specify either the short or the full versions.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-26 12:05:58 -07:00
Nanako Shiraishi
21d0bc2f9a git-bisect: call the found commit "*the* first bad commit"
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-26 12:05:57 -07:00
Junio C Hamano
b8132342e9 Merge branch 'jc/maint-clean-nested-dir-safety' into maint
* jc/maint-clean-nested-dir-safety:
  clean: require double -f options to nuke nested git repository and work tree
2009-08-26 12:05:57 -07:00
Junio C Hamano
bd30037e65 Merge branch 'jk/maint-merge-msg-fix' into maint
* jk/maint-merge-msg-fix:
  merge: indicate remote tracking branches in merge message
  merge: fix incorrect merge message for ambiguous tag/branch
  add tests for merge message headings
2009-08-26 12:05:57 -07:00
Junio C Hamano
6b37b3d873 Merge branch 'jc/apply-epoch-patch' into maint
* jc/apply-epoch-patch:
  apply: notice creation/removal patches produced by GNU diff
2009-08-26 12:05:57 -07:00
Junio C Hamano
6dfa21309f Merge branch 'jp/symlink-dirs' into maint
* jp/symlink-dirs:
  t6035-merge-dir-to-symlink depends on SYMLINKS prerequisite
  git-checkout: be careful about untracked symlinks
  lstat_cache: guard against full match of length of 'name' parameter
  Demonstrate bugs when a directory is replaced with a symlink
2009-08-26 12:05:57 -07:00
Junio C Hamano
bb0c8065f1 Merge branch 'maint-1.6.3' into maint
* maint-1.6.3:
  add -p: do not attempt to coalesce mode changes
  git add -p: demonstrate failure when staging both mode and hunk
2009-08-26 12:05:57 -07:00
Junio C Hamano
9e4a90ba19 Merge branch 'tr/maint-1.6.3-add-p-modeonly-fix' into maint-1.6.3
* tr/maint-1.6.3-add-p-modeonly-fix:
  add -p: do not attempt to coalesce mode changes
  git add -p: demonstrate failure when staging both mode and hunk
2009-08-26 11:22:00 -07:00