gitweb.git
Fix naming scheme for configure cache variables.Ralf Wildenhues Mon, 19 Jan 2009 20:34:36 +0000 (21:34 +0100)

Fix naming scheme for configure cache variables.

In order to be cached, configure variables need to contain the
string '_cv_', and they should begin with a package-specific
prefix in order to avoid interfering with third-party macros.
Rename ld_dashr, ld_wl_rpath, ld_rpath to git_cv_ld_dashr etc.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: use shell for-loop rather than Make's foreach... Brandon Casey Tue, 20 Jan 2009 01:44:03 +0000 (19:44 -0600)

Makefile: use shell for-loop rather than Make's foreach loop during install

The install target uses a foreach loop to generate a single long shell
command line to handle installation of the built-in git commands. The
maximum length of the argument list varies by platform, and this use of
foreach quickly grows the length of the argument list. Current git can
exceed the default maximum argument list length on IRIX 6.5 of 20480
depending on the installation path.

Rather than using make's foreach loop to pre-generate the shell command
line, use a shell for-loop and allow the shell to iterate through each of
the built-in commands.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use uppercase POSIX compliant signals for the 'trap... Markus Heidelberg Mon, 19 Jan 2009 23:43:26 +0000 (00:43 +0100)

use uppercase POSIX compliant signals for the 'trap' command

In 'man 1p trap' there is written:

"Implementations may permit names with the SIG prefix or ignore case
in signal names as an extension."

So change the lowercase signals to uppercase, which is POSIX compliant
instead of being an extension.

There wasn't anybody claiming that it doesn't work, but there was a bug
with using a signal with the SIG prefix, which is an extension as well.
So let's play it safe and change it, since it doesn't hurt anyone.

While at it, also convert 8 indentation spaces to 1 tab character.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/difftool: remove distracting 'echo' in the... Markus Heidelberg Mon, 19 Jan 2009 23:41:18 +0000 (00:41 +0100)

contrib/difftool: remove distracting 'echo' in the SIGINT handler

When interrupting git-difftool with Ctrl-C, the output of this echo
command led to having the cursor at the beginning of the line below the
shell prompt.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/difftool: change trap condition from SIGINT... Markus Heidelberg Mon, 19 Jan 2009 23:38:16 +0000 (00:38 +0100)

contrib/difftool: change trap condition from SIGINT to INT

git-difftool worked for me on an up-to-date Gentoo Linux at home, but
didn't work on a somewhat older Ubuntu Linux 7.10 at work and failed
with the following error, where 'Makefile' was locally modified:

trap: 244: SIGINT: bad trap
external diff died, stopping at Makefile.

In 'man 1p trap' there is written:

"The condition can be EXIT, 0 (equivalent to EXIT), or a signal
specified using a symbolic name, without the SIG prefix, [...]"

"Implementations may permit names with the SIG prefix or ignore case
in signal names as an extension."

So now we do it the POSIX compliant way instead of using an extension.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: more compact summary and without extra quotesSanti Béjar Mon, 19 Jan 2009 22:45:16 +0000 (23:45 +0100)

commit: more compact summary and without extra quotes

Update the report format again to save the screen real estates, while
avoiding from enclosing the one-line summary of the commit log inside
double quotes pair, which looks awkward when the message begins or ends
with a double quote. The old format looked like this:

[master]: created d9a5491: "foo:bar"

Simply removing the double quotes were found to be confusing as a message
often begins with a short-word (area of the system) and a colon.

The new format looks like this:

[master d9a5491] foo:bar

As discussed in the git mailing list:

http://thread.gmane.org/gmane.comp.version-control.git/101687/focus=101735

Signed-off-by: Santi Béjar <santi@agolina.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Introduce for_each_recent_reflog_ent().Junio C Hamano Tue, 20 Jan 2009 06:18:29 +0000 (22:18 -0800)

Introduce for_each_recent_reflog_ent().

This can be used to scan only the last few kilobytes of a reflog, as a
cheap optimization when the data you are looking for is likely to be
found near the end of it. The caller is expected to fall back to the
full scan if that is not the case.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

interpret_nth_last_branch(): plug small memleakJunio C Hamano Tue, 20 Jan 2009 05:58:31 +0000 (21:58 -0800)

interpret_nth_last_branch(): plug small memleak

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Optimize color_parse_memRené Scharfe Tue, 20 Jan 2009 04:30:30 +0000 (23:30 -0500)

Optimize color_parse_mem

Commit 5ef8d77a implemented color_parse_mem, a function for
parsing colors from a non-NUL-terminated string, by simply
allocating a new NUL-terminated string and calling
color_parse. This had a small but measurable speed impact on
a user format that used the advanced color parsing. E.g.,

# uses quick parsing
$ time ./git log --pretty=tformat:'%Credfoo%Creset' >/dev/null
real 0m0.673s
user 0m0.652s
sys 0m0.016s

# uses color_parse_mem
$ time ./git log --pretty=tformat:'%C(red)foo%C(reset)' >/dev/null
real 0m0.692s
user 0m0.660s
sys 0m0.032s

This patch implements color_parse_mem as the primary
function, with color_parse as a wrapper for strings. This
gives comparable timings to the first case above.

Original patch by René. Commit message and debugging by Jeff
King.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix combined use of whitespace ignore options to diffKeith Cascio Mon, 19 Jan 2009 18:03:04 +0000 (10:03 -0800)

Fix combined use of whitespace ignore options to diff

The code used to misbehave when options to ignore certain whitespaces
(-w -b and --ignore-at-eol) were combined.

Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'kc/maint-diff-bwi-fix'Junio C Hamano Tue, 20 Jan 2009 05:17:47 +0000 (21:17 -0800)

Merge branch 'kc/maint-diff-bwi-fix'

* kc/maint-diff-bwi-fix:
test more combinations of ignore-whitespace options to diff

test more combinations of ignore-whitespace options... Keith Cascio Thu, 15 Jan 2009 00:48:24 +0000 (16:48 -0800)

test more combinations of ignore-whitespace options to diff

There are three flags involved (-w -b and --ignore-space-at-eol) which
makes 8 combinations possible in total, but only 3 cases are tested (none,
-w alone and -b alone).

This adds the other 5 cases.

Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Tue, 20 Jan 2009 03:58:58 +0000 (19:58 -0800)

Merge branch 'maint'

* maint:
shell: Document that 'cvs server' is a valid command

shell: Document that 'cvs server' is a valid commandLars Noschinski Mon, 19 Jan 2009 17:06:43 +0000 (18:06 +0100)

shell: Document that 'cvs server' is a valid command

git-shell's man page explicitly lists all allowed commands, but 'cvs
server' was missing. Add it.

Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix reflog parsing for a malformed branch switching... Junio C Hamano Tue, 20 Jan 2009 00:44:08 +0000 (16:44 -0800)

Fix reflog parsing for a malformed branch switching entry

target can be NULL when we failed to parse the message.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix parsing of @{-1}@{1}Johannes Schindelin Sat, 17 Jan 2009 18:08:12 +0000 (19:08 +0100)

Fix parsing of @{-1}@{1}

To do that, Git no longer looks forward for the '@{' corresponding to the
closing '}' but backward, and dwim_ref() as well as dwim_log() learnt
about the @{-<N>} notation.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

interpret_nth_last_branch(): avoid traversing the reflo... Junio C Hamano Mon, 19 Jan 2009 08:04:25 +0000 (00:04 -0800)

interpret_nth_last_branch(): avoid traversing the reflog twice

You can have quite a many reflog entries, but you typically won't recall
which branch you were on after switching branches for more than several
times.

Instead of reading the reflog twice, this reads the branch switching event
and keeps as many entries as the user asked from the latest such entries,
which is the minimum required to be able to switch back to the branch we
were recently on.

[jc: improvements from Dscho squashed in]

Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash completion: refactor diff optionsThomas Rast Mon, 19 Jan 2009 21:18:00 +0000 (22:18 +0100)

bash completion: refactor diff options

diff, log and show all take the same diff options. Refactor them from
__git_diff and __git_log into a variable, and complete them in
__git_show too.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash completion: move pickaxe options to logThomas Rast Mon, 19 Jan 2009 21:17:59 +0000 (22:17 +0100)

bash completion: move pickaxe options to log

Move the options --pickaxe-all and --pickaxe-regex to git-log, where
they make more sense than with git-diff.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

difftool: put the cursor on the editable file for VimDavid Aguilar Mon, 19 Jan 2009 05:34:29 +0000 (21:34 -0800)

difftool: put the cursor on the editable file for Vim

You only need to edit worktree files when comparing against
the worktree. Put the cursor automatically into its window for
vimdiff and gvimdiff to avoid doing <C-w>l every time.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

difftool: fix documentation problemsDavid Aguilar Mon, 19 Jan 2009 05:27:19 +0000 (21:27 -0800)

difftool: fix documentation problems

This patch makes the difftool docs always refer to the
git-difftool script using the dashed form of the name.
Only command examples use the non-dashed form now.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://git.bogomips.org/git-svnJunio C Hamano Mon, 19 Jan 2009 06:29:37 +0000 (22:29 -0800)

Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
git-svn: Show UUID in svn info for added directories with svn 1.5.5
git-svn: avoid importing nested git repos
git-svn: fix SVN 1.1.x compatibility
git-svn: Add --localtime option to "fetch"
git-svn: better attempt to handle broken symlink updates
git-svn: handle empty files marked as symlinks in SVN

git-svn: Show UUID in svn info for added directories... Marcel Koeppen Mon, 19 Jan 2009 02:02:01 +0000 (03:02 +0100)

git-svn: Show UUID in svn info for added directories with svn 1.5.5

In svn 1.5.5 the output of "svn info" for added directories was changed
and now shows the repository UUID. This patch implements the same
behavior for "git svn info" and makes t9119-git-svn-info.17 pass if
svn 1.5.5 is used.

Signed-off-by: Marcel Koeppen <git-dev@marzelpan.de>
Acked-by: Eric Wong <normalperson@yhbt.net>

git-am: re-fix the diag message printingJunio C Hamano Mon, 19 Jan 2009 03:34:31 +0000 (19:34 -0800)

git-am: re-fix the diag message printing

The $FIRSTLINE variable is from the user's commit and can contain
arbitrary backslash escapes that may be (mis)interpreted when given to
"echo", depending on the implementation. Use "printf" to work around the
issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn: avoid importing nested git reposEric Wong Mon, 12 Jan 2009 02:23:38 +0000 (18:23 -0800)

git-svn: avoid importing nested git repos

Some SVN repositories contain git repositories within them
(hopefully accidentally checked in). Since git refuses to track
nested ".git" repositories, this can be a problem when fetching
updates from SVN.

Thanks to Morgan Christiansson for the report and testing.

Signed-off-by: Eric Wong <normalperson@yhbt.net>

git-svn: fix SVN 1.1.x compatibilityEric Wong Sun, 18 Jan 2009 06:11:44 +0000 (22:11 -0800)

git-svn: fix SVN 1.1.x compatibility

The get_log() function in the Perl SVN API introduced the limit
parameter in 1.2.0. However, this got discarded in our SVN::Ra
compatibility layer when used with SVN 1.1.x. We now emulate
the limit functionality in older SVN versions by preventing the
original callback from being called if the given limit has been
reached. This emulation is less bandwidth efficient, but SVN
1.1.x is becoming rarer now.

Additionally, the --limit parameter in svn(1) uses the
aforementioned get_log() functionality change in SVN 1.2.x.
t9129 no longer depends on --limit to work and instead uses
Perl to parse out the commit message.

Thanks to Tom G. Christensen for the bug report.

Signed-off-by: Eric Wong <normalperson@yhbt.net>

git-svn: Add --localtime option to "fetch"Pete Harlan Sun, 18 Jan 2009 04:10:14 +0000 (20:10 -0800)

git-svn: Add --localtime option to "fetch"

By default git-svn stores timestamps of fetched commits in
Subversion's UTC format. Passing --localtime to fetch will convert
them to the timezone of the server on which git-svn is run.

This makes the timestamps of a resulting "git log" agree with what
"svn log" shows for the same repository.

Signed-off-by: Pete Harlan <pgit@pcharlan.com>
Acked-by: Eric Wong <normalperson@yhbt.net>

git-svn: better attempt to handle broken symlink updatesEric Wong Mon, 12 Jan 2009 00:51:11 +0000 (16:51 -0800)

git-svn: better attempt to handle broken symlink updates

This is a followup to 7fc35e0e94782bbbefb920875813519038659930,
(workaround a for broken symlinks in SVN).

Since broken SVN clients can commit svn:special files without
the magic "link " prefix, this can affect delta application
when we update the broken svn:special file. So now we fall
back and retry the delta application on symlinks if having
a "link " prefix fails.

Our behavior differs from svn(1) (v1.5.1) slightly:

When a svn:special file is created w/o a "link " prefix, svn
will create a regular file (mode 100644 to git) with the
contents of the blob as-is.

Our behavior is to continue creating the symlink (mode 120000
to git) with the contents of the blob as-is. While this
differs from current svn(1) behavior, this is easier and more
efficient to implement (and the correctness of the svn(1) is
debatable, since it's a workaround for a bug in the first
place).

More information on this SVN bug is described here:
http://subversion.tigris.org/issues/show_bug.cgi?id=2692

Signed-off-by: Eric Wong <normalperson@yhbt.net>

git-svn: handle empty files marked as symlinks in SVNEric Wong Mon, 12 Jan 2009 00:51:10 +0000 (16:51 -0800)

git-svn: handle empty files marked as symlinks in SVN

Broken SVN clients generate empty files with the svn:special set
to '*'. This attempts to denote a symlink pointing to a file
with an empty path (""), which cannot be generated on a POSIX
system.

Thus, we mimic the behavior of svn(1) and create a zero-byte
file in our tree.

Signed-off-by: Eric Wong <normalperson@yhbt.net>

Documentation: avoid using undefined parametersAnders Melchiorsen Sun, 18 Jan 2009 14:36:58 +0000 (15:36 +0100)

Documentation: avoid using undefined parameters

The <ref> parameter has not been introduced, so rewrite to
avoid it.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: mention branches rather than headsAnders Melchiorsen Sun, 18 Jan 2009 14:36:57 +0000 (15:36 +0100)

Documentation: mention branches rather than heads

The "matching refs" semantics works only on matching branches these days.
Instead of using "heads" which traditionally has been used more or less
interchangeably with "refs", say "branch" explicitly here.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: remove a redundant elaborationAnders Melchiorsen Sun, 18 Jan 2009 14:36:56 +0000 (15:36 +0100)

Documentation: remove a redundant elaboration

The comment in parentheses is wrong, as one has to leave out both the
colon and <dst>. This situation is covered by the section a few lines
down:

A parameter <ref> without a colon pushes the <ref> from the source
repository to the destination repository under the same name.

So, just remove the parentheses.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: git push repository can also be a remoteAnders Melchiorsen Sun, 18 Jan 2009 14:36:55 +0000 (15:36 +0100)

Documentation: git push repository can also be a remote

This is copied from pull-fetch-param.txt and helps the reader
to not get stuck in the URL section.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

lstat_cache(): introduce clear_lstat_cache() functionKjetil Barvik Sun, 18 Jan 2009 15:14:54 +0000 (16:14 +0100)

lstat_cache(): introduce clear_lstat_cache() function

If you want to completely clear the contents of the lstat_cache(), then
call this new function.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

lstat_cache(): introduce invalidate_lstat_cache() functionKjetil Barvik Sun, 18 Jan 2009 15:14:53 +0000 (16:14 +0100)

lstat_cache(): introduce invalidate_lstat_cache() function

In some cases it could maybe be necessary to say to the cache that
"Hey, I deleted/changed the type of this pathname and if you currently
have it inside your cache, you should deleted it".

This patch introduce a function which support this.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

lstat_cache(): introduce has_dirs_only_path() functionKjetil Barvik Sun, 18 Jan 2009 15:14:52 +0000 (16:14 +0100)

lstat_cache(): introduce has_dirs_only_path() function

The create_directories() function in entry.c currently calls stat()
or lstat() for each path component of the pathname 'path' each and every
time. For the 'git checkout' command, this function is called on each
file for which we must do an update (ce->ce_flags & CE_UPDATE), so we get
lots and lots of calls.

To fix this, we make a new wrapper to the lstat_cache() function, and
call the wrapper function instead of the calls to the stat() or the
lstat() functions. Since the paths given to the create_directories()
function, is sorted alphabetically, the new wrapper would be very
cache effective in this situation.

To support it we must update the lstat_cache() function to be able to
say that "please test the complete length of 'name'", and also to give
it the length of a prefix, where the cache should use the stat()
function instead of the lstat() function to test each path component.

Thanks to Junio C Hamano, Linus Torvalds and Rene Scharfe for valuable
comments to this patch!

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

lstat_cache(): introduce has_symlink_or_noent_leading_p... Kjetil Barvik Sun, 18 Jan 2009 15:14:51 +0000 (16:14 +0100)

lstat_cache(): introduce has_symlink_or_noent_leading_path() function

In some cases, especially inside the unpack-trees.c file, and inside
the verify_absent() function, we can avoid some unnecessary calls to
lstat(), if the lstat_cache() function can also be told to keep track
of non-existing directories.

So we update the lstat_cache() function to handle this new fact,
introduce a new wrapper function, and the result is that we save lots
of lstat() calls for a removed directory which previously contained
lots of files, when we call this new wrapper of lstat_cache() instead
of the old one.

We do similar changes inside the unlink_entry() function, since if we
can already say that the leading directory component of a pathname
does not exist, it is not necessary to try to remove a pathname below
it!

Thanks to Junio C Hamano, Linus Torvalds and Rene Scharfe for valuable
comments to this patch!

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

lstat_cache(): more cache effective symlink/directory... Kjetil Barvik Sun, 18 Jan 2009 15:14:50 +0000 (16:14 +0100)

lstat_cache(): more cache effective symlink/directory detection

Make the cache functionality more effective. Previously when A/B/C/D
was in the cache and A/B/C/E/file.c was called for, there was no match
at all from the cache. Now we use the fact that the paths "A", "A/B"
and "A/B/C" are already tested, and we only need to do an lstat() call
on "A/B/C/E".

We only cache/store the last path regardless of its type. Since the
cache functionality is always used with alphabetically sorted names
(at least it seems so for me), there is no need to store both the last
symlink-leading path and the last real-directory path. Note that if
the cache is not called with (mostly) alphabetically sorted names,
neither the old, nor this new one, would be very effective.

Previously, when symlink A/B/C/S was cached/stored in the symlink-
leading path, and A/B/C/file.c was called for, it was not easy to use
the fact that we already knew that the paths "A", "A/B" and "A/B/C"
are real directories.

Avoid copying the first path components of the name 2 zillion times
when we test new path components. Since we always cache/store the
last path, we can copy each component as we test those directly into
the cache. Previously we ended up doing a memcpy() for the full
path/name right before each lstat() call, and when updating the cache
for each time we have tested a new path component.

We also use less memory, that is, PATH_MAX bytes less memory on the
stack and PATH_MAX bytes less memory on the heap.

Thanks to Junio C Hamano, Linus Torvalds and Rene Scharfe for valuable
comments to this patch!

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetool: put the cursor on the editable file for VimMarkus Heidelberg Sat, 17 Jan 2009 21:28:45 +0000 (22:28 +0100)

mergetool: put the cursor on the editable file for Vim

When resolving conflicts, you only need to edit the $MERGED file. Put
the cursor automatically into its window for vimdiff and gvimdiff to
avoid doing <C-w>l every time.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Tested-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7700: demonstrate misbehavior of 'repack -a' when... Brandon Casey Fri, 9 Jan 2009 22:14:39 +0000 (16:14 -0600)

t7700: demonstrate misbehavior of 'repack -a' when local packs exist

The ability to "...fatten [the] local repository by packing everything that
is needed by the local ref into a single new pack, including things that are
borrowed from alternates"[1] is supposed to be provided by the '-a' or '-A'
options to repack when '-l' is not used, but there is a flaw. For each
pack in the local repository without a .keep file, repack supplies a
--unpacked=<pack> argument to pack-objects.

The --unpacked option to pack-objects, with or without an argument, causes
pack-objects to ignore any object which is packed in a pack not mentioned
in an argument to --unpacked=. So, if there are local packs, and
'repack -a' is called, then any objects which reside in packs accessible
through alternates will _not_ be packed. If there are no local packs, then
no --unpacked argument will be supplied, and repack will behave as expected.

[1] http://mid.gmane.org/7v8wrwidi3.fsf@gitster.siamese.dyndns.org

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test more combinations of ignore-whitespace options... Keith Cascio Thu, 15 Jan 2009 00:48:24 +0000 (16:48 -0800)

test more combinations of ignore-whitespace options to diff

There are three flags involved (-w -b and --ignore-space-at-eol) which
makes 8 combinations possible in total, but only 3 cases are tested (none,
-w alone and -b alone).

This adds the other 5 cases.

Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ds/uintmax-config'Junio C Hamano Sun, 18 Jan 2009 07:08:53 +0000 (23:08 -0800)

Merge branch 'ds/uintmax-config'

* ds/uintmax-config:
autoconf: Enable threaded delta search when pthreads are supported

Merge branch 'gb/gitweb-opml'Junio C Hamano Sun, 18 Jan 2009 07:07:19 +0000 (23:07 -0800)

Merge branch 'gb/gitweb-opml'

* gb/gitweb-opml:
gitweb: suggest name for OPML view
gitweb: don't use pathinfo for global actions

Merge branch 'mv/apply-parse-opt'Junio C Hamano Sun, 18 Jan 2009 07:06:53 +0000 (23:06 -0800)

Merge branch 'mv/apply-parse-opt'

* mv/apply-parse-opt:
Resurrect "git apply --flags -" to read from the standard input
parse-opt: migrate builtin-apply.

Merge branch 'tr/rebase-root'Junio C Hamano Sun, 18 Jan 2009 07:06:38 +0000 (23:06 -0800)

Merge branch 'tr/rebase-root'

* tr/rebase-root:
rebase: update documentation for --root
rebase -i: learn to rebase root commit
rebase: learn to rebase root commit
rebase -i: execute hook only after argument checking

Merge branch 'gb/gitweb-patch'Junio C Hamano Sun, 18 Jan 2009 07:06:19 +0000 (23:06 -0800)

Merge branch 'gb/gitweb-patch'

* gb/gitweb-patch:
gitweb: link to patch(es) view in commit(diff) and (short)log view
gitweb: add patches view
gitweb: change call pattern for git_commitdiff
gitweb: add patch view

Conflicts:
gitweb/gitweb.perl

Merge branch 'ap/clone-into-empty'Junio C Hamano Sun, 18 Jan 2009 07:05:54 +0000 (23:05 -0800)

Merge branch 'ap/clone-into-empty'

* ap/clone-into-empty:
Allow cloning to an existing empty directory
add is_dot_or_dotdot inline function

Merge branch 'jc/maint-format-patch'Junio C Hamano Sun, 18 Jan 2009 07:05:50 +0000 (23:05 -0800)

Merge branch 'jc/maint-format-patch'

* jc/maint-format-patch:
format-patch: show patch text for the root commit

Merge branch 'tr/maint-no-index-fixes'Junio C Hamano Sun, 18 Jan 2009 07:05:38 +0000 (23:05 -0800)

Merge branch 'tr/maint-no-index-fixes'

* tr/maint-no-index-fixes:
diff --no-index -q: fix endless loop
diff --no-index: test for pager after option parsing
diff: accept -- when using --no-index

Merge branch 'as/autocorrect-alias'Junio C Hamano Sun, 18 Jan 2009 07:05:34 +0000 (23:05 -0800)

Merge branch 'as/autocorrect-alias'

* as/autocorrect-alias:
git.c: make autocorrected aliases work

Merge branch 'rs/fgrep'Junio C Hamano Sun, 18 Jan 2009 07:05:28 +0000 (23:05 -0800)

Merge branch 'rs/fgrep'

* rs/fgrep:
grep: don't call regexec() for fixed strings
grep -w: forward to next possible position after rejected match

Merge branch 'rs/maint-shortlog-foldline'Junio C Hamano Sun, 18 Jan 2009 07:05:23 +0000 (23:05 -0800)

Merge branch 'rs/maint-shortlog-foldline'

* rs/maint-shortlog-foldline:
shortlog: handle multi-line subjects like log --pretty=oneline et. al. do

Merge branch 'mh/maint-commit-color-status'Junio C Hamano Sun, 18 Jan 2009 07:05:19 +0000 (23:05 -0800)

Merge branch 'mh/maint-commit-color-status'

* mh/maint-commit-color-status:
git-status -v: color diff output when color.ui is set
git-commit: color status output when color.ui is set

Merge branch 'maint'Junio C Hamano Sun, 18 Jan 2009 07:04:40 +0000 (23:04 -0800)

Merge branch 'maint'

* maint:
Update draft release notes for 1.6.1.1
builtin-fsck: fix off by one head count
t5540: clarify that http-push does not handle packed-refs on the remote
http-push: when making directories, have a trailing slash in the path name
http-push: fix off-by-path_len
Documentation: let asciidoc align related options
githooks.txt: add missing word
builtin-commit.c: do not remove COMMIT_EDITMSG

Update draft release notes for 1.6.1.1Junio C Hamano Sun, 18 Jan 2009 07:04:35 +0000 (23:04 -0800)

Update draft release notes for 1.6.1.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>

bundle: allow the same ref to be given more than onceJunio C Hamano Sun, 18 Jan 2009 06:27:08 +0000 (22:27 -0800)

bundle: allow the same ref to be given more than once

"git bundle create x master master" used to create a bundle that lists
the same branch (master) twice. Cloning from such a bundle resulted in
a needless warning "warning: Duplicated ref: refs/remotes/origin/master".

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint-1.6.0' into maintJunio C Hamano Sun, 18 Jan 2009 06:39:49 +0000 (22:39 -0800)

Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
builtin-fsck: fix off by one head count
Documentation: let asciidoc align related options
githooks.txt: add missing word
builtin-commit.c: do not remove COMMIT_EDITMSG

builtin-fsck: fix off by one head countChristian Couder Sun, 18 Jan 2009 03:46:09 +0000 (04:46 +0100)

builtin-fsck: fix off by one head count

According to the man page, if "git fsck" is passed one or more heads, it
should verify connectivity and validity of only objects reachable from the
heads it is passed.

However, since 5ac0a20 (Make builtin-fsck.c use parse_options.,
2007-10-15) the command behaved as if no heads were passed, when given
only one argument.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

revision walker: include a detached HEAD in --allJohannes Schindelin Fri, 16 Jan 2009 12:52:53 +0000 (13:52 +0100)

revision walker: include a detached HEAD in --all

When HEAD is detached, --all should list it, too, logically, as a
detached HEAD is by definition a temporary, unnamed branch.

It is especially necessary to list it when garbage collecting, as
the detached HEAD would be trashed.

Noticed by Thomas Rast.

Note that this affects creating bundles with --all; I contend that it
is a good change to add the HEAD, so that cloning from such a bundle
will give you a current branch. However, I had to fix t5701 as it
assumed that --all does not imply HEAD.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix gitdir detection when in subdir of gitdirSZEDER Gábor Fri, 16 Jan 2009 15:37:33 +0000 (16:37 +0100)

Fix gitdir detection when in subdir of gitdir

If the current working directory is a subdirectory of the gitdir (e.g.
<repo>/.git/refs/), then setup_git_directory_gently() will climb its
parent directories until it finds itself in a gitdir. However, no
matter how many parent directories it climbs, it sets
'GIT_DIR_ENVIRONMENT' to ".", which is obviously wrong.

This behaviour affected at least 'git rev-parse --git-dir' and hence
caused some errors in bash completion (e.g. customized command prompt
when on a detached head and completion of refs).

To fix this, we set the absolute path of the found gitdir instead.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-am: Make it easier to see which patch failedJonas Flodén Fri, 16 Jan 2009 14:34:47 +0000 (15:34 +0100)

git-am: Make it easier to see which patch failed

When git-am fails it's not always easy to see which patch failed,
since it's often hidden by a lot of error messages.
Add an extra line which prints the name of the failed patch just
before the resolve message to make it easier to find.

Signed-off-by: Jonas Flodén <jonas@floden.nu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib: add 'git difftool' for launching common merge... David Aguilar Fri, 16 Jan 2009 08:00:02 +0000 (00:00 -0800)

contrib: add 'git difftool' for launching common merge tools

'git difftool' is a git command that allows you to compare and edit files
between revisions using common merge tools. 'git difftool' does what
'git mergetool' does but its use is for non-merge situations such as
when preparing commits or comparing changes against the index.
It uses the same configuration variables as 'git mergetool' and
provides the same command-line interface as 'git diff'.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

checkout: implement "-" abbreviation, add docs and... Thomas Rast Sat, 17 Jan 2009 16:09:56 +0000 (17:09 +0100)

checkout: implement "-" abbreviation, add docs and tests

Have '-' mean the same as '@{-1}', i.e., the last branch we were on.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_name: support @{-N} syntax in get_sha1()Thomas Rast Sat, 17 Jan 2009 16:09:55 +0000 (17:09 +0100)

sha1_name: support @{-N} syntax in get_sha1()

Let get_sha1() parse the @{-N} syntax, with docs and tests.

Note that while @{-1}^2, @{-2}~5 and such are supported, @{-1}@{1} is
currently not allowed.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_name: tweak @{-N} lookupThomas Rast Sat, 17 Jan 2009 16:09:54 +0000 (17:09 +0100)

sha1_name: tweak @{-N} lookup

Have the lookup only look at "interesting" checkouts, meaning those
that tell you "Already on ..." don't count even though they also cause
a reflog entry.

Let interpret_nth_last_branch() return the number of characters
parsed, so that git-checkout can verify that the branch spec was
@{-N}, not @{-1}^2 or something like that. (The latter will be added
later.)

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

checkout: implement "@{-N}" shortcut name for N-th... Junio C Hamano Sat, 17 Jan 2009 16:09:53 +0000 (17:09 +0100)

checkout: implement "@{-N}" shortcut name for N-th last branch

Implement a shortcut @{-N} for the N-th last branch checked out, that
works by parsing the reflog for the message added by previous
git-checkout invocations. We expand the @{-N} to the branch name, so
that you end up on an attached HEAD on that branch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add is_regex_special()René Scharfe Sat, 17 Jan 2009 15:50:37 +0000 (16:50 +0100)

Add is_regex_special()

Add is_regex_special(), a character class macro for chars that have a
special meaning in regular expressions.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Change NUL char handling of isspecial()René Scharfe Sat, 17 Jan 2009 15:50:34 +0000 (16:50 +0100)

Change NUL char handling of isspecial()

Replace isspecial() by the new macro is_glob_special(), which is more,
well, specialized. The former included the NUL char in its character
class, while the letter only included characters that are special to
file name globbing.

The new name contains underscores because they enhance readability
considerably now that it's made up of three words. Renaming the
function is necessary to document its changed scope.

The call sites of isspecial() are updated to check explicitly for NUL.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Reformat ctype.cRené Scharfe Sat, 17 Jan 2009 15:50:29 +0000 (16:50 +0100)

Reformat ctype.c

Enhance the readability of ctype.c by using an enum instead of macros
to initialize the character class table. This allows the use of a single
letter to mark a char, making the table fit within 80 columns.

Also list the index of the last entry in each row in the following comment.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add ctype testRené Scharfe Sat, 17 Jan 2009 15:50:13 +0000 (16:50 +0100)

Add ctype test

Manipulating the character class table in ctype.c by hand is error prone.
To ensure that typos are found quickly, add a test program and script.

test-ctype checks the output of the character class macros isspace() et.
al. by applying them on all possible char values and consulting a list of
all characters in the particular class. It doesn't check tolower() and
toupper(); this could be added later.

The test script t0070-fundamental.sh is created because there is no good
place for the ctype test, yet -- except for t0000-basic.sh perhaps, but
it doesn't run well on Windows, yet.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash: refactor 'git log --pretty=<format>' optionsSZEDER Gábor Fri, 16 Jan 2009 16:02:15 +0000 (17:02 +0100)

bash: refactor 'git log --pretty=<format>' options

Both 'git log' and 'show' have the same '--pretty=<format>' option
with the same formats. So refactor these formats into a common
variable.

While at it, also add 'format:' to the list.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash: add missing format-patch command line optionsSZEDER Gábor Fri, 16 Jan 2009 16:02:04 +0000 (17:02 +0100)

bash: add missing format-patch command line options

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash: remove unnecessary checks for long options with... SZEDER Gábor Fri, 16 Jan 2009 16:01:57 +0000 (17:01 +0100)

bash: remove unnecessary checks for long options with argument

__gitcomp takes care of it since 5447aac7 (bash: fix long option with
argument double completion, 2008-03-05)

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5540: clarify that http-push does not handle packed... Johannes Schindelin Sat, 17 Jan 2009 15:41:41 +0000 (16:41 +0100)

t5540: clarify that http-push does not handle packed-refs on the remote

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http-push: when making directories, have a trailing... Johannes Schindelin Sat, 17 Jan 2009 15:11:51 +0000 (16:11 +0100)

http-push: when making directories, have a trailing slash in the path name

The function lock_remote() sends MKCOL requests to make leading
directories; However, if it does not put a forward slash '/' at the end of
the path, the server sends a 301 redirect.

By leaving the '/' in place, we can avoid this additional step.

Incidentally, at least one version of Curl (7.16.3) does not resend
credentials when it follows a 301 redirect, so this commit also fixes
a bug.

Original patch by Tay Ray Chuan <rctay89@gmail.com>.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http-push: fix off-by-path_lenJohannes Schindelin Sat, 17 Jan 2009 15:36:26 +0000 (16:36 +0100)

http-push: fix off-by-path_len

When getting the result of remote_ls(), we were advancing the variable
"path" to the relative path inside the repository.

However, then we went on to malloc a bogus amount of memory: we were
subtracting the prefix length _again_, quite possibly getting something
negative, which xmalloc() interprets as really, really much.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: let asciidoc align related optionsMarkus Heidelberg Fri, 16 Jan 2009 21:42:33 +0000 (22:42 +0100)

Documentation: let asciidoc align related options

Fixes the description of the -t option in git-mergetool, which
failed to hint that it takes an argument.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

expand --pretty=format color optionsJeff King Sat, 17 Jan 2009 15:38:46 +0000 (10:38 -0500)

expand --pretty=format color options

Currently, the only colors available to --pretty=format
users are red, green, and blue. Rather than expand it with a
few new colors, this patch makes the usual config color
syntax available, including more colors, backgrounds, and
attributes.

Because colors are no longer bounded to a single word (e.g.,
%Cred), this uses a more advanced syntax that features a
beginning and end delimiter (but the old syntax still
works). So you can now do:

git log --pretty=tformat:'%C(yellow)%h%C(reset) %s'

to emulate --pretty=oneline, or even

git log --pretty=tformat:'%C(cyan magenta bold)%s%C(reset)'

if you want to relive the awesomeness of 4-color CGA.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

color: make it easier for non-config to parse color... Jeff King Sat, 17 Jan 2009 15:32:30 +0000 (10:32 -0500)

color: make it easier for non-config to parse color specs

We have very featureful color-parsing routines which are
used for color.diff.* and other options. Let's make it
easier to use those routines from other parts of the code.

This patch adds a color_parse_mem() helper function which
takes a length-bounded string instead of a NUL-terminated
one. While the helper is only a few lines long, it is nice
to abstract this out so that:

- callers don't forget to free() the temporary buffer

- right now, it is implemented in terms of color_parse().
But it would be more efficient to reverse this and
implement color_parse in terms of color_parse_mem.

This also changes the error string for an invalid color not
to mention the word "config", since it is not always
appropriate (and when it is, the context is obvious since
the offending config variable is given).

Finally, while we are in the area, we clean up the parameter
names in the declaration of color_parse; the var and value
parameters were reversed from the actual implementation.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: let asciidoc align related optionsMarkus Heidelberg Fri, 16 Jan 2009 21:42:33 +0000 (22:42 +0100)

Documentation: let asciidoc align related options

Command line options can share the same paragraph of description, if
they are related or synonymous. In these cases they should be written
among each other, so that asciidoc can format them itself.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

githooks.txt: add missing wordStephan Beyer Fri, 16 Jan 2009 20:36:06 +0000 (21:36 +0100)

githooks.txt: add missing word

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-commit.c: do not remove COMMIT_EDITMSGStephan Beyer Fri, 16 Jan 2009 19:40:05 +0000 (20:40 +0100)

builtin-commit.c: do not remove COMMIT_EDITMSG

git-commit tries to remove the file ./COMMIT_EDITMSG instead of
$GIT_DIR/COMMIT_EDITMSG after commit preparation (e.g. running
hooks, launching editor).
This behavior exists since f5bbc3225c4b07 "Port git commit to C".

Some test cases (e.g. t/t7502-commit.sh) rely on the existence of
$GIT_DIR/COMMIT_EDITMSG after committing and, I guess, many people
are used to it. So it is best not to remove it.

This patch just removes the removal of COMMIT_EDITMSG.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

run_hook(): allow more than 9 hook argumentsStephan Beyer Sat, 17 Jan 2009 03:02:55 +0000 (04:02 +0100)

run_hook(): allow more than 9 hook arguments

This is done using the ALLOC_GROW macro.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

run_hook(): check the executability of the hook before... Stephan Beyer Fri, 16 Jan 2009 19:10:01 +0000 (20:10 +0100)

run_hook(): check the executability of the hook before filling argv

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

api-run-command.txt: talk about run_hook()Stephan Beyer Fri, 16 Jan 2009 19:10:00 +0000 (20:10 +0100)

api-run-command.txt: talk about run_hook()

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Move run_hook() from builtin-commit.c into run-command... Stephan Beyer Fri, 16 Jan 2009 19:09:59 +0000 (20:09 +0100)

Move run_hook() from builtin-commit.c into run-command.c (libgit)

A function that runs a hook is used in several Git commands.
builtin-commit.c has the one that is most general for cases without
piping. The one in builtin-gc.c prints some useful warnings.
This patch moves a merged version of these variants into libgit and
lets the other builtins use this libified run_hook().

The run_hook() function used in receive-pack.c feeds the standard
input of the pre-receive or post-receive hooks. This function is
renamed to run_receive_hook() because the libified run_hook() cannot
handle this.

Mentored-by: Daniel Barkalow <barkalow@iabervon.org>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

checkout: don't crash on file checkout before running... Stephan Beyer Fri, 16 Jan 2009 19:09:58 +0000 (20:09 +0100)

checkout: don't crash on file checkout before running post-checkout hook

In the case of

git init
echo exit >.git/hooks/post-checkout
chmod +x .git/hooks/post-checkout
touch foo
git add foo
rm foo
git checkout -- foo

git-checkout resulted in a Segmentation fault, because there is no new
branch set for the post-checkout hook.

This patch makes use of the null SHA as it is set for the old branch.

While at it, I removed the xstrdup() around the sha1_to_hex(...) calls
in builtin-checkout.c/post_checkout_hook() because sha1_to_hex()
uses four buffers for the hex-dumped SHA and we only need two.
(Duplicating one buffer is only needed if we need more than four.)

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

color-words: make regex configurable via attributesThomas Rast Sat, 17 Jan 2009 16:29:48 +0000 (17:29 +0100)

color-words: make regex configurable via attributes

Make the --color-words splitting regular expression configurable via
the diff driver's 'wordregex' attribute. The user can then set the
driver on a file in .gitattributes. If a regex is given on the
command line, it overrides the driver's setting.

We also provide built-in regexes for the languages that already had
funcname patterns, and add an appropriate diff driver entry for C/++.
(The patterns are designed to run UTF-8 sequences into a single chunk
to make sure they remain readable.)

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

color-words: expand docs with precise semanticsThomas Rast Sat, 17 Jan 2009 16:29:47 +0000 (17:29 +0100)

color-words: expand docs with precise semantics

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

color-words: enable REG_NEWLINE to help userThomas Rast Sat, 17 Jan 2009 16:29:46 +0000 (17:29 +0100)

color-words: enable REG_NEWLINE to help user

We silently truncate a match at the newline, which may lead to
unexpected behaviour, e.g., when matching "<[^>]*>" against

<foo
bar>

since then "<foo" becomes a word (and "bar>" doesn't!) even though the
regex said only angle-bracket-delimited things can be words.

To alleviate the problem slightly, use REG_NEWLINE so that negated
classes can't match a newline. Of course newlines can still be
matched explicitly.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

color-words: take an optional regular expression descri... Johannes Schindelin Sat, 17 Jan 2009 16:29:45 +0000 (17:29 +0100)

color-words: take an optional regular expression describing words

In some applications, words are not delimited by white space. To
allow for that, you can specify a regular expression describing
what makes a word with

git diff --color-words='[A-Za-z0-9]+'

Note that words cannot contain newline characters.

As suggested by Thomas Rast, the words are the exact matches of the
regular expression.

Note that a regular expression beginning with a '^' will match only
a word at the beginning of the hunk, not a word at the beginning of
a line, and is probably not what you want.

This commit contains a quoting fix by Thomas Rast.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

color-words: change algorithm to allow for 0-character... Johannes Schindelin Sat, 17 Jan 2009 16:29:44 +0000 (17:29 +0100)

color-words: change algorithm to allow for 0-character word boundaries

Up until now, the color-words code assumed that word boundaries are
identical to white space characters.

Therefore, it could get away with a very simple scheme: it copied the
hunks, substituted newlines for each white space character, called
libxdiff with the processed text, and then identified the text to
output by the offsets (which agreed since the original text had the
same length).

This code was ugly, for a number of reasons:

- it was impossible to introduce 0-character word boundaries,

- we had to print everything word by word, and

- the code needed extra special handling of newlines in the removed part.

Fix all of these issues by processing the text such that

- we build word lists, separated by newlines,

- we remember the original offsets for every word, and

- after calling libxdiff on the wordlists, we parse the hunk headers, and
find the corresponding offsets, and then

- we print the removed/added parts in one go.

The pre and post samples in the test were provided by Santi Béjar.

Note that there is some strange special handling of hunk headers where
one line range is 0 due to POSIX: in this case, the start is one too
low. In other words a hunk header '@@ -1,0 +2 @@' actually means that
the line must be added after the _second_ line of the pre text, _not_
the first.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

color-words: refactor word splitting and use ALLOC_GROW()Johannes Schindelin Sat, 17 Jan 2009 16:29:43 +0000 (17:29 +0100)

color-words: refactor word splitting and use ALLOC_GROW()

Word splitting is now performed by the function diff_words_fill(),
avoiding having the same code twice.

In the same spirit, avoid duplicating the code of ALLOC_GROW().

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add color_fwrite_lines(), a function coloring each... Johannes Schindelin Sat, 17 Jan 2009 16:29:42 +0000 (17:29 +0100)

Add color_fwrite_lines(), a function coloring each line individually

We have to set the color before every line and reset it before every
newline. Add a function color_fwrite_lines() which does that for us.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Fri, 16 Jan 2009 02:52:35 +0000 (18:52 -0800)

Merge branch 'maint'

* maint:
t3404: Add test case for auto-amending only edited commits after "edit"
t3404: Add test case for aborted --continue after "edit"
t3501: check that commits are actually done

Merge branch 'maint-1.6.0' into maintJunio C Hamano Thu, 15 Jan 2009 22:33:54 +0000 (14:33 -0800)

Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
t3404: Add test case for auto-amending only edited commits after "edit"
t3404: Add test case for aborted --continue after "edit"
t3501: check that commits are actually done

t3404: Add test case for auto-amending only edited... Stephan Beyer Thu, 15 Jan 2009 12:56:16 +0000 (13:56 +0100)

t3404: Add test case for auto-amending only edited commits after "edit"

Add a test case for the bugfix introduced by commit c14c3c82d
"git-rebase--interactive: auto amend only edited commit".

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3404: Add test case for aborted --continue after ... Stephan Beyer Thu, 15 Jan 2009 12:56:15 +0000 (13:56 +0100)

t3404: Add test case for aborted --continue after "edit"

Add a test case for the bugfix introduced by commit 8beb1f33d
"git-rebase-interactive: do not squash commits on abort".

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3501: check that commits are actually doneStephan Beyer Thu, 15 Jan 2009 13:03:17 +0000 (14:03 +0100)

t3501: check that commits are actually done

The basic idea of t3501 is to check whether revert
and cherry-pick works on renamed files.
But as there is no pure cherry-pick/revert test, it is
good to also check if commits are actually done in that
scenario.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash-completion: Add comments to remind about required... Ted Pavlic Thu, 15 Jan 2009 16:02:23 +0000 (11:02 -0500)

bash-completion: Add comments to remind about required arguments

Add a few simple comments above commands that take arguments. These
comments are meant to remind developers of potential problems that
can occur when the script is sourced on systems with "set -u." Any
function which requires arguments really ought to be called with
explicit arguments given.

Also adds a #!bash to the top of bash completions so that editing
software can always identify that the file is of sh type.

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>