git/git.git
13 years agoTeach diff machinery to display other prefixes than "a/" and "b/"
Johannes Schindelin [Tue, 18 Dec 2007 19:32:14 +0000 (19:32 +0000)]
Teach diff machinery to display other prefixes than "a/" and "b/"

With the new options "--src-prefix=<prefix>", "--dst-prefix=<prefix>"
and "--no-prefix", you can now control the path prefixes of the diff
machinery.  These used to by hardwired to "a/" for the source prefix
and "b/" for the destination prefix.

Initial patch by Pascal Obry.  Sane option names suggested by Linus.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGIT 1.5.4-rc1 v1.5.4-rc1
Junio C Hamano [Thu, 20 Dec 2007 01:21:04 +0000 (17:21 -0800)]
GIT 1.5.4-rc1

It's been a week since -rc0, and we have quite a lot of fixes,
so here it is.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoCatch and handle git-commit failures in git-rebase --interactive
Shawn O. Pearce [Wed, 19 Dec 2007 06:45:00 +0000 (01:45 -0500)]
Catch and handle git-commit failures in git-rebase --interactive

If git-commit fails for any reason then git-rebase needs to stop
and not plow through the rest of the series.  Its unlikely that
a future git-commit will succeed if the current attempt failed.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoAvoid update hook during git-rebase --interactive
Shawn O. Pearce [Wed, 19 Dec 2007 06:41:26 +0000 (01:41 -0500)]
Avoid update hook during git-rebase --interactive

If we are rebasing changes that contain potential whitespace
errors that our .git/hooks/pre-commit hook looks for and fails
on then git-commit will fail to commit that change.  This causes
git-rebase--interactive to squash commits together, even though it
was not requested to do so by the todo file.

Passing --no-verify to git-commit makes git-rebase -i behave more
like git-rebase normally would in such conditions, providing more
consistent behavior between the different rebase implementations.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoImproved submodule merge support
Finn Arne Gangstad [Tue, 18 Dec 2007 19:50:28 +0000 (20:50 +0100)]
Improved submodule merge support

When merging conflicting submodule changes from a supermodule, generate
a conflict message saying what went wrong. Also leave the tree in a state
where git status shows the conflict, and git submodule status gives the user
enough information to do the merge manally. Previously this would just fail.

Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix interactive rebase to preserve author email address
Sean [Wed, 19 Dec 2007 21:34:27 +0000 (16:34 -0500)]
Fix interactive rebase to preserve author email address

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomake 'git describe --all --contains' work
Nicolas Pitre [Wed, 19 Dec 2007 17:53:16 +0000 (12:53 -0500)]
make 'git describe --all --contains' work

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix git-instaweb breakage on MacOS X due to the limited sed functionality
Charles Bailey [Wed, 19 Dec 2007 12:25:27 +0000 (12:25 +0000)]
Fix git-instaweb breakage on MacOS X due to the limited sed functionality

git-instaweb relied on a pipe in a sed script, but this is not supported
by MacOS X sed when using BREs.  git-instaweb relies on a working perl
in any case, and perl re are more consistent between platforms, so
replace sed invocation with an equivalent perl invocation.

Also, fix the documented -b "" to work without giving a spurious 'command
not found' error.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotest "git clone -o"
Jeff King [Wed, 19 Dec 2007 15:43:50 +0000 (10:43 -0500)]
test "git clone -o"

This tests a recently fixed regression in which "git clone
-o" didn't work at all.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoclone: fix options '-o' and '--origin' to be recognised again
Marco Roeland [Wed, 19 Dec 2007 09:15:15 +0000 (10:15 +0100)]
clone: fix options '-o' and '--origin' to be recognised again

Due to a subtle typo in a shell case pattern neither alternative worked.

Signed-off-by: Marco Roeland <marco.roeland@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit show <tag>: show the tagger
Johannes Schindelin [Tue, 18 Dec 2007 18:01:33 +0000 (18:01 +0000)]
git show <tag>: show the tagger

For commit objects, the Author is shown, so do the equivalent for
tag objects, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-svn: avoid warning when run without arguments
Eric Wong [Wed, 19 Dec 2007 08:31:43 +0000 (00:31 -0800)]
git-svn: avoid warning when run without arguments

While we're in the area, finish writing a halfway-written
comment describing what that block does...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
13 years agogit-svn: workaround a for broken symlinks in SVN
Eric Wong [Wed, 19 Dec 2007 08:06:45 +0000 (00:06 -0800)]
git-svn: workaround a for broken symlinks in SVN

It's possible for bad clients to commit symlinks without the
5-character "link " prefix in symlinks.  So guard around this
bug in SVN and make a best effort to create symlinks if the
"link " prefix is missing.

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

To be pedantic, there is still a corner case that neither we nor
SVN can handle:  If somebody made a link using a broken SVN
client where "link " is the first part of its path, e.g.
"link sausage", then we'd end up having a symlink which points
to "sausage" because we incorrectly stripped the "link ".
Hopefully this hasn't happened in practice, but if it has,
it's not our fault SVN is broken :)

Thanks to Benoit Sigoure and Sverre Johansen for reporting
and feedback.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
13 years agogit-svn: avoid leaving leftover committer/author info in rebase
Eric Wong [Sun, 16 Dec 2007 03:08:22 +0000 (19:08 -0800)]
git-svn: avoid leaving leftover committer/author info in rebase

We set the 6 environment variables for controlling
committer/author email/name/time for every commit.

We do this in the parent process to be passed to
git-commit-tree, because open3() doesn't afford us the control
of doing it only in the child process.  This means we leave them
hanging around in the main process until the next revision comes
around and all 6 environment variables are overwridden again.

Unfortunately, for the last commit, leaving them hanging around
means the git-rebase invocation will pick it up, rewriting the
rebased commit with incorrect author information.  This should fix
it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
13 years agofix style of a few comments in diff-delta.c
Nicolas Pitre [Tue, 18 Dec 2007 15:15:39 +0000 (10:15 -0500)]
fix style of a few comments in diff-delta.c

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-filter-branch.sh: more portable tr usage: use \012, not \n.
Jim Meyering [Tue, 18 Dec 2007 10:03:23 +0000 (11:03 +0100)]
git-filter-branch.sh: more portable tr usage: use \012, not \n.

I hesitate to suggest this, since GNU tr has accepted \n for 15 years,
but there are supposedly a few crufty vendor-supplied versions of tr still
in use.  Also, all of the other uses of tr-with-newline in git use \012.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofilter-branch: Remove broken and unnecessary summary of rewritten refs.
Johannes Sixt [Tue, 18 Dec 2007 07:30:47 +0000 (08:30 +0100)]
filter-branch: Remove broken and unnecessary summary of rewritten refs.

There was an attempt to list the refs that were rewritten by filtering
the output of 'git show-ref' for 'refs/original'. But it got the
grep argument wrong, which did not account for the SHA1 that is listed
before the ref.

Moreover, right before this summary is the loop that actually does the
rewriting, and the rewritten refs are listed there anyway. So this extra
summary is plainly too verbose.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix some documentation typos.
Ralf Wildenhues [Tue, 18 Dec 2007 06:07:36 +0000 (07:07 +0100)]
Fix some documentation typos.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobuiltin-blame.c: remove unneeded memclr()
Junio C Hamano [Tue, 18 Dec 2007 09:46:04 +0000 (01:46 -0800)]
builtin-blame.c: remove unneeded memclr()

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agounpack-trees: FLEX_ARRAY fix
Linus Torvalds [Tue, 18 Dec 2007 06:12:03 +0000 (22:12 -0800)]
unpack-trees: FLEX_ARRAY fix

In unpack-trees.c (line 593), we do

..
if (same(old, merge)) {
*merge = *old;
} else {
..

and that "merge" is a cache_entry pointer. If we have a non-zero
FLEX_ARRAY size, it will cause us to copy the first few bytes of the
name too.

That is technically wrong even for FLEX_ARRAY being 1, but you'll never
notice, since the filenames should always be the same with the current
code.  But if we do the same thing for a rename, we'd be screwed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix segfault in diff-delta.c when FLEX_ARRAY is 1
Pierre Habouzit [Tue, 18 Dec 2007 01:39:57 +0000 (02:39 +0100)]
Fix segfault in diff-delta.c when FLEX_ARRAY is 1

aka don't do pointer arithmetics on structs that have a FLEX_ARRAY member,
or you'll end up believing your array is 1 cell off its real address.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Tue, 18 Dec 2007 04:49:42 +0000 (20:49 -0800)]
Merge branch 'maint'

* maint:
  git-send-email: avoid duplicate message-ids
  clone: correctly report http_fetch errors

13 years agorebase -p -i: handle "no changes" gracefully
Johannes Schindelin [Mon, 17 Dec 2007 21:01:25 +0000 (21:01 +0000)]
rebase -p -i: handle "no changes" gracefully

Since commit 376ccb8cbb453343998e734d8a1ce79f57a4e092 (rebase -i: style
fixes and minor cleanups), unchanged SHA-1s are no longer mapped via
$REWRITTEN.  But the updating phase was not prepared for the old head
not being rewritten.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocument diff.external and mergetool.<tool>.path
Johannes Schindelin [Mon, 17 Dec 2007 12:21:22 +0000 (12:21 +0000)]
Document diff.external and mergetool.<tool>.path

There was no documentation for the config variables diff.external
and mergetool.<tool>.path.

Noticed by Sebastian Schuberth.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoSupport config variable diff.external
Johannes Schindelin [Mon, 17 Dec 2007 13:42:20 +0000 (13:42 +0000)]
Support config variable diff.external

We had the diff.external variable in the documentation of the config
file since its conception, but failed to respect it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoClean up documentation that references deprecated 'git peek-remote'.
Johannes Sixt [Mon, 17 Dec 2007 09:08:23 +0000 (10:08 +0100)]
Clean up documentation that references deprecated 'git peek-remote'.

Now that 'git peek-remote' is deprecated and only an alias for
'git ls-remote', it should not be referenced from other manual pages.

This also removes the description of the --exec option, which is no
longer present.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoClarify error response from 'git fetch' for bad responses
Sam Vilain [Mon, 17 Dec 2007 12:00:43 +0000 (01:00 +1300)]
Clarify error response from 'git fetch' for bad responses

This error message prints the reponse from the server at this point.
Label it as such in the output.

Signed-off-by: Sam Vilain <sam@vilain.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agothe use of 'tr' in the test suite isn't really portable
H.Merijn Brand [Mon, 17 Dec 2007 22:28:46 +0000 (23:28 +0100)]
the use of 'tr' in the test suite isn't really portable

Some versions of 'tr' only accept octal codes if entered with three digits,
and therefor misinterpret the '\0' in the test suite.

Some versions of 'tr' reject the (needless) use of character classes.

Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoPlug a resource leak in threaded pack-objects code.
Johannes Sixt [Mon, 17 Dec 2007 19:12:52 +0000 (20:12 +0100)]
Plug a resource leak in threaded pack-objects code.

A mutex and a condition variable is allocated for each thread and torn
down when the thread terminates. However, for certain workloads it can
happen that some threads are actually not started at all. In this case
we would leak the mutex and condition variable. Now we allocate them only
for those threads that are actually started.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-send-email: avoid duplicate message-ids
Jeff King [Mon, 17 Dec 2007 20:51:34 +0000 (15:51 -0500)]
git-send-email: avoid duplicate message-ids

We used to unconditionally add a message-id to the outgoing
email without bothering to check if it already had one.
Instead, let's use the existing one.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoclone: correctly report http_fetch errors
Jeff King [Mon, 17 Dec 2007 12:43:59 +0000 (07:43 -0500)]
clone: correctly report http_fetch errors

The exit status from curl was accidentally lost by the
'case' statement. We need to explicitly save it so that $?
doesn't get overwritten.

This improves the error message when fetching from an http
repository which has never had update-server-info run.
Previously, it would fail to note the fetch error and
produce multiple errors about the lack of origin branches.
It now correctly suggests running git-update-server-info.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation/git-submodule: refer to gitmodules(5)
Junio C Hamano [Mon, 17 Dec 2007 06:03:21 +0000 (22:03 -0800)]
Documentation/git-submodule: refer to gitmodules(5)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agothreaded pack-objects: Use condition variables for thread communication.
Johannes Sixt [Sun, 16 Dec 2007 19:45:34 +0000 (20:45 +0100)]
threaded pack-objects: Use condition variables for thread communication.

In the threaded pack-objects code the main thread and the worker threads
must mutually signal that they have assigned a new pack of work or have
completed their work, respectively. Previously, the code used mutexes that
were locked in one thread and unlocked from a different thread, which is
bogus (and happens to work on Linux).

Here we rectify the implementation by using condition variables: There is
one condition variable on which the main thread waits until a thread
requests new work; and each worker thread has its own condition variable
on which it waits until it is assigned new work or signaled to terminate.

As a cleanup, the worker threads are spawned only after the initial work
packages have been assigned.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobuiltin-commit: make summary output consistent with status
Junio C Hamano [Sun, 16 Dec 2007 23:05:39 +0000 (15:05 -0800)]
builtin-commit: make summary output consistent with status

This enables -B -M to the summary output after a commit is made so that
it is in line with what is shown in git-status and commit log template.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobuiltin-commit: fix summary output.
Junio C Hamano [Sun, 16 Dec 2007 23:03:58 +0000 (15:03 -0800)]
builtin-commit: fix summary output.

Because print_summary() forgot to call diff_setup_done() after futzing with
diff output options, it failed to activate recursive diff, which resulted in
an incorrect summary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobuiltin-apply: stronger indent-with-on-tab fixing
J. Bruce Fields [Sun, 16 Dec 2007 17:58:02 +0000 (12:58 -0500)]
builtin-apply: stronger indent-with-on-tab fixing

Fix any sequence of 8 spaces in initial indent, not just the case where
the 8 spaces are the first thing on the line.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobuiltin-apply: minor cleanup of whitespace detection
J. Bruce Fields [Sun, 16 Dec 2007 17:58:01 +0000 (12:58 -0500)]
builtin-apply: minor cleanup of whitespace detection

Use 0 instead of -1 for the case where not tabs or spaces are found; it
will make some later math slightly simpler.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRe-re-re-fix common tail optimization
Junio C Hamano [Sun, 16 Dec 2007 21:49:17 +0000 (13:49 -0800)]
Re-re-re-fix common tail optimization

We need to be extra careful recovering the removed common section, so
that we do not break context nor the changed incomplete line (i.e. the
last line that does not end with LF).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agowhitespace: fix config.txt description of indent-with-non-tab
J. Bruce Fields [Sun, 16 Dec 2007 16:31:42 +0000 (11:31 -0500)]
whitespace: fix config.txt description of indent-with-non-tab

Fix garbled description.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agowhitespace: more accurate initial-indent highlighting
J. Bruce Fields [Sun, 16 Dec 2007 16:31:41 +0000 (11:31 -0500)]
whitespace: more accurate initial-indent highlighting

Instead of highlighting the entire initial indent, highlight only the
problematic spaces.

In the case of an indent like ' \t \t' there may be multiple problematic
ranges, so it's easiest to emit the highlighting as we go instead of
trying rember disjoint ranges and do it all at the end.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agowhitespace: fix initial-indent checking
J. Bruce Fields [Sun, 16 Dec 2007 16:31:40 +0000 (11:31 -0500)]
whitespace: fix initial-indent checking

After this patch, "written" counts the number of bytes up to and
including the most recently seen tab.  This allows us to detect (and
count) spaces by comparing to "i".

This allows catching initial indents like '\t        ' (a tab followed
by 8 spaces), while previously indent-with-non-tab caught only indents
that consisted entirely of spaces.

This also allows fixing an indent-with-non-tab regression, so we can
again detect indents like '\t \t'.

Also update tests to catch these cases.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agowhitespace: minor cleanup
J. Bruce Fields [Sun, 16 Dec 2007 16:31:39 +0000 (11:31 -0500)]
whitespace: minor cleanup

The variable leading_space is initially used to represent the index of
the last space seen before a non-space.  Then later it represents the
index of the first non-indent character.

It will prove simpler to replace it by a variable representing a number
of bytes.  Eventually it will represent the number of bytes written so
far (in the stream != NULL case).

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agowhitespace: reorganize initial-indent check
J. Bruce Fields [Sun, 16 Dec 2007 16:31:38 +0000 (11:31 -0500)]
whitespace: reorganize initial-indent check

Reorganize to emphasize the most complicated part of the code (the tab
case).

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agowhitespace: fix off-by-one error in non-space-in-indent checking
J. Bruce Fields [Sun, 16 Dec 2007 16:31:37 +0000 (11:31 -0500)]
whitespace: fix off-by-one error in non-space-in-indent checking

If there were no tabs, and the last space was at position 7, then
positions 0..7 had spaces, so there were 8 spaces.

Update test to check exactly this case.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorename git-browse--help to git-help--browse
Jeff King [Sun, 16 Dec 2007 07:21:04 +0000 (02:21 -0500)]
rename git-browse--help to git-help--browse

The convention for helper scripts has been
git-$TOOL--$HELPER. Since this is a "browse" helper for the
"help" tool, git-help--browse is a more sensible name.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix a memory leak
李鸿 [Sun, 16 Dec 2007 04:53:26 +0000 (12:53 +0800)]
Fix a memory leak

Signed-off-by: Li Hong <leehong@pku.edu.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Make config_to_multi return [] instead of [undef]
Petr Baudis [Sat, 8 Dec 2007 11:30:59 +0000 (12:30 +0100)]
gitweb: Make config_to_multi return [] instead of [undef]

This is important for the list of clone urls, where if there are
no per-repository clone URL configured, the default base URLs
are never used for URL construction without this patch.

Add tests for different ways of setting project URLs, just in case.
Note that those tests in current form wouldn't detect breakage fixed
by this patch, as it only checks for errors and not for expected
output.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Teach "a=blob" action to be more lenient about blob/file mime type
Jakub Narebski [Sat, 15 Dec 2007 14:41:49 +0000 (15:41 +0100)]
gitweb: Teach "a=blob" action to be more lenient about blob/file mime type

Since 930cf7dd7cc6b87d173f182230763e1f1913d319 'blob' action knows the
file type; if the file type is not "text/*" or one of common network
image formats/mimetypes (gif, png, jpeg) then the action "blob"
defaulted to "blob_plain".  This caused the problem if mimetypes file
was not well suited for web, for example returning "application/x-sh"
for "*.sh" shell scripts, instead of "text/plain" (or other "text/*").

Now "blob" action defaults to "blob_plain" ('raw' view) only if file
is of type which is neither "text/*" nor "image/{gif,png,jpeg}"
AND it is binary file.  Otherwise it assumes that it can be displayed
either in <img> tag ("image/*" mimetype), or can be displayed line by
line (otherwise).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: disambiguate heads and tags withs the same name
Jakub Narebski [Sat, 15 Dec 2007 14:40:28 +0000 (15:40 +0100)]
gitweb: disambiguate heads and tags withs the same name

Avoid wrong disambiguation that would link logs/trees of tags and
heads which share the same name to the same page, leading to
a disambiguation that would prefer the tag, thus making it impossible
to access the corresponding head log and tree without hacking the url
by hand.

It does it by using full refname (with 'refs/heads/' or 'refs/tags/'
prefix) instead of shortened one in the URLs in 'heads' and 'tags'
tables.  This makes URLs (and refs) provided by gitweb unambiguous.

Signed-off-by: Guillaume Seguin <guillaume@segu.in>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoteach bash completion to treat commands with "--" as a helper
Jeff King [Sat, 15 Dec 2007 11:11:54 +0000 (06:11 -0500)]
teach bash completion to treat commands with "--" as a helper

There is a convention that commands containing a double-dash
are implementation details and not to be used by mortals. We
should automatically remove them from the completion
suggestions as such.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotrim_common_tail: brown paper bag fix.
Jeff King [Sun, 16 Dec 2007 07:06:14 +0000 (02:06 -0500)]
trim_common_tail: brown paper bag fix.

The recovered context lines were not LF terminated due to off-by-one
error, which also caused the outer loop to count the number of recovered
lines to terminate after running only once.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUpdate draft release notes for 1.5.4
Junio C Hamano [Sat, 15 Dec 2007 06:30:38 +0000 (22:30 -0800)]
Update draft release notes for 1.5.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoStart preparing the API documents.
Junio C Hamano [Sun, 25 Nov 2007 07:48:04 +0000 (23:48 -0800)]
Start preparing the API documents.

Most of them are still stubs, but the procedure to build the HTML
documentation, maintaining the index and installing the end product are
there.

I placed names of people who are likely to know the most about the topic
in the stub files, so that volunteers will know whom to ask questions as
needed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRetire git-runstatus for real.
Junio C Hamano [Sat, 15 Dec 2007 06:08:25 +0000 (22:08 -0800)]
Retire git-runstatus for real.

The command was removed from the builtin command list and there was no
way to invoke it, but the code was still there.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRename git-browse-help helper to git-browse--help
Junio C Hamano [Sat, 15 Dec 2007 06:02:57 +0000 (22:02 -0800)]
Rename git-browse-help helper to git-browse--help

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-help: add "help.format" config variable.
Christian Couder [Sat, 15 Dec 2007 04:57:28 +0000 (05:57 +0100)]
git-help: add "help.format" config variable.

This config variable makes it possible to choose the default format
used to display help. This format will be used only if no option
like -a|--all|-i|--info|-m|--man|-w|--web is passed to "git-help".

The following values are possible for this variable:

- "man"  --> "man" program is used
- "info" --> "info" program is used
- "web"  --> "git-browse-help" is used

By default we still show help using "man".

This patch also adds -m|--man command line option to use "man"
to allow overriding the "help.format" configuration variable.

Note that this patch also revert some recent changes in
"git-browse-help" because they prevented to look for config
variables in the global configuration file.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'wc/diff'
Junio C Hamano [Sat, 15 Dec 2007 05:42:53 +0000 (21:42 -0800)]
Merge branch 'wc/diff'

* wc/diff:
  Test interaction between diff --check and --exit-code
  Use shorter error messages for whitespace problems
  Add tests for "git diff --check" with core.whitespace options
  Make "diff --check" output match "git apply"
  Unify whitespace checking
  diff --check: minor fixups
  "diff --check" should affect exit status

13 years agoMove fetch_ref from http-push.c and http-walker.c to http.c
Mike Hommey [Mon, 10 Dec 2007 23:08:25 +0000 (00:08 +0100)]
Move fetch_ref from http-push.c and http-walker.c to http.c

Make the necessary changes to be ok with their difference, and rename the
function http_fetch_ref.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix various memory leaks in http-push.c and http-walker.c
Mike Hommey [Mon, 10 Dec 2007 21:36:11 +0000 (22:36 +0100)]
Fix various memory leaks in http-push.c and http-walker.c

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUse strbuf in http code
Mike Hommey [Sun, 9 Dec 2007 19:30:59 +0000 (20:30 +0100)]
Use strbuf in http code

Also, replace whitespaces with tabs in some places

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoAvoid redundant declaration of missing_target()
Mike Hommey [Mon, 10 Dec 2007 21:36:09 +0000 (22:36 +0100)]
Avoid redundant declaration of missing_target()

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRemove a CURLOPT_HTTPHEADER (un)setting
Mike Hommey [Mon, 10 Dec 2007 21:36:08 +0000 (22:36 +0100)]
Remove a CURLOPT_HTTPHEADER (un)setting

Setting CURLOPT_HTTPHEADER doesn't add HTTP headers, but replaces whatever
set of headers was configured before, so setting to NULL doesn't have any
magic meaning, and is pretty much useless when setting to another list
right after.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRemove the default_headers variable from http-push.c
Mike Hommey [Mon, 10 Dec 2007 21:36:07 +0000 (22:36 +0100)]
Remove the default_headers variable from http-push.c

It appears that despite being initialized, it was never used.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix random sha1 in error message in http-fetch and http-push
Mike Hommey [Fri, 14 Dec 2007 21:18:01 +0000 (22:18 +0100)]
Fix random sha1 in error message in http-fetch and http-push

When a downloaded ref doesn't contain a sha1, the error message displays
a random sha1 because of uninitialized memory. This happens when cloning
a repository that is already a clone of another one, in which case
refs/remotes/origin/HEAD is a symref.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix some more memory leaks in http-push.c
Mike Hommey [Fri, 14 Dec 2007 21:18:00 +0000 (22:18 +0100)]
Fix some more memory leaks in http-push.c

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoTest interaction between diff --check and --exit-code
Wincent Colaiuta [Fri, 14 Dec 2007 11:23:44 +0000 (12:23 +0100)]
Test interaction between diff --check and --exit-code

Make sure that it works as advertised in the man page.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUse shorter error messages for whitespace problems
Wincent Colaiuta [Fri, 14 Dec 2007 11:23:43 +0000 (12:23 +0100)]
Use shorter error messages for whitespace problems

The initial version of the whitespace_error_string() function took the
messages from builtin-apply.c rather than the shorter messages from
diff.c.

This commit addresses Junio's concern that these messages might be too
long (now that we can emit multiple warnings per line).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUse a strbuf for building up section header and key/value pair strings.
Kristian Høgsberg [Fri, 14 Dec 2007 20:59:58 +0000 (15:59 -0500)]
Use a strbuf for building up section header and key/value pair strings.

Avoids horrible 1-byte write(2) calls and cleans up the logic a bit.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofast-import: fix unalinged allocation and access
David S. Miller [Sat, 15 Dec 2007 04:39:16 +0000 (20:39 -0800)]
fast-import: fix unalinged allocation and access

The specialized pool allocator fast-import uses aligned objects on the
size of a pointer, which was not sufficient at least on Sparc.  Instead,
make the alignment for objects of type unitmax_t.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoremote: Fix bogus make_branch() call in configuration reader.
Junio C Hamano [Sat, 15 Dec 2007 04:34:56 +0000 (20:34 -0800)]
remote: Fix bogus make_branch() call in configuration reader.

The configuration reader to enumerate branches that have configuration
data were not careful enough and failed to skip "branch.<variable>"
entries (e.g. branch.autosetupmerge).  This resulted in bogus attempt to
allocate huge memory.

Noticed by David Miller.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocommit: allow --amend to reuse message from another commit
Junio C Hamano [Fri, 14 Dec 2007 19:57:22 +0000 (11:57 -0800)]
commit: allow --amend to reuse message from another commit

After tentatively applying a patch from a contributor, you can get a
replacement patch with corrected code and unusable commit log message.
In such a case, this sequence ought to give you an editor based on the
message in the earlier commit, to let you describe an incremental
improvement:

    git reset --hard HEAD^ ;# discard the earlier one
    git am <corrected-patch
    git commit --amend -c HEAD@{1}

Unfortunately, --amend insisted reusing the message from the commit
being amended, ignoring the -c option.  This corrects it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-svn: handle our top-level path being deleted and later re-added
Eric Wong [Fri, 14 Dec 2007 16:39:09 +0000 (08:39 -0800)]
git-svn: handle our top-level path being deleted and later re-added

Previously, git-svn would ignore cases where the path we're
tracking is removed from the repository.  This was to prevent
heads with follow-parent from ending up with a tree full of
empty revisions (and thus breaking rename detection).

The previous behavior is fine until the path we're tracking
is re-added later on, leading to the old files being merged
in with the new files in the directory (because the old
files were never marked as deleted)

We will now only remove all the old files locally that were
deleted remotely iff we detect the directory we're in is being
created from scratch.

Thanks for Marcus D. Hanwell for the bug report and
Peter Baumann for the analysis.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocvsexportcommit: fix massive commits
Jeff King [Fri, 14 Dec 2007 09:15:47 +0000 (04:15 -0500)]
cvsexportcommit: fix massive commits

Because we feed the changed filenames to CVS on the command
line, it was possible for massive commits to overflow the
system exec limits. Instead, we now do an xargs-like split
of the arguments.

This means that we lose some of the atomicity of calling CVS
in one shot. Since CVS commits are not atomic, but the CVS
protocol is, the possible effects of this are not clear;
however, since CVS doesn't provide a different interface,
this is our only option for large commits (short of writing
a CVS client library).

The argument size limit is arbitrarily set to 64kB. This
should be high enough to trigger only in rare cases where it
is necessary, so normal-sized commits are not affected by
the atomicity change.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: describe pack idx v2
linux@horizon.com [Fri, 14 Dec 2007 11:28:14 +0000 (06:28 -0500)]
Documentation: describe pack idx v2

Lifted from the log message of c553ca25bd60dc9fd50b8bc7bd329601b81cee66
(pack-objects: learn about pack index version 2).

Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoxdiff tail trimming: use correct type.
Junio C Hamano [Fri, 14 Dec 2007 20:00:42 +0000 (12:00 -0800)]
xdiff tail trimming: use correct type.

Inside xdiff library, the number of context lines is represented in
long, not int.

Noticed by Peter Baumann.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoAdd tests for "git diff --check" with core.whitespace options
Wincent Colaiuta [Thu, 13 Dec 2007 13:32:31 +0000 (14:32 +0100)]
Add tests for "git diff --check" with core.whitespace options

Make sure that "git diff --check" does the right thing when the
core.whitespace options are set.

While we are at it, correct many uses of test_expect_failure that
ran sequence of commands.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMake "diff --check" output match "git apply"
Wincent Colaiuta [Thu, 13 Dec 2007 13:32:30 +0000 (14:32 +0100)]
Make "diff --check" output match "git apply"

For consistency, make the two tools report whitespace errors in the
same way (the output of "diff --check" has been tweaked to match
that of "git apply").

Note that although the textual content is basically the same only
"git diff --check" provides a colorized version of the problematic
lines; making "git apply" do colorization will require more extensive
changes (figuring out the diff colorization preferences of the user)
and so that will be a subject for another commit.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUnify whitespace checking
Wincent Colaiuta [Thu, 13 Dec 2007 13:32:29 +0000 (14:32 +0100)]
Unify whitespace checking

This commit unifies three separate places where whitespace checking was
performed:

 - the whitespace checking previously done in builtin-apply.c is
extracted into a function in ws.c

 - the equivalent logic in "git diff" is removed

 - the emit_line_with_ws() function is also removed because that also
rechecks the whitespace, and its functionality is rolled into ws.c

The new function is called check_and_emit_line() and it does two things:
checks a line for whitespace errors and optionally emits it. The checking
is based on lines of content rather than patch lines (in other words, the
caller must strip the leading "+" or "-"); this was suggested by Junio on
the mailing list to allow for a future extension to "git show" to display
whitespace errors in blobs.

At the same time we teach it to report all classes of whitespace errors
found for a given line rather than reporting only the first found error.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff --check: minor fixups
Junio C Hamano [Fri, 14 Dec 2007 07:40:27 +0000 (23:40 -0800)]
diff --check: minor fixups

There is no reason --exit-code and --check-diff must be mutually
exclusive, so assign different bits to different results and allow them
to be returned from the command.  Introduce diff_result_code() to factor
out the common code to decide final status code based on diffopt
settings and use it everywhere.

Update tests to match the above fix.

Turning pager off when "diff --check" is used is a regression.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years ago"diff --check" should affect exit status
Wincent Colaiuta [Thu, 13 Dec 2007 20:24:52 +0000 (21:24 +0100)]
"diff --check" should affect exit status

"git diff" has a --check option that can be used to check for whitespace
problems but it only reported by printing warnings to the
console.

Now when the --check option is used we give a non-zero exit status,
making "git diff --check" nicer to use in scripts and hooks.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoxdi_diff: trim common trailing lines
Junio C Hamano [Thu, 13 Dec 2007 22:24:18 +0000 (14:24 -0800)]
xdi_diff: trim common trailing lines

This implements earlier Linus's optimization to trim common lines at the
end before passing them down to low level xdiff interface for all of our
xdiff users.

We could later enhance this to also trim common leading lines, but that
would need tweaking the output function to add the number of lines
trimmed at the beginning to line numbers that appear in the hunk
headers.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoxdl_diff: identify call sites.
Junio C Hamano [Thu, 13 Dec 2007 21:25:07 +0000 (13:25 -0800)]
xdl_diff: identify call sites.

This inserts a new function xdi_diff() that currently does not
do anything other than calling the underlying xdl_diff() to the
callchain of current callers of xdl_diff() function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoprovide advance warning of some future pack default changes
Nicolas Pitre [Fri, 14 Dec 2007 03:32:36 +0000 (22:32 -0500)]
provide advance warning of some future pack default changes

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-svn: unlink internal index files after operations
Eric Wong [Thu, 13 Dec 2007 16:27:34 +0000 (08:27 -0800)]
git-svn: unlink internal index files after operations

Being git, we can generate these very quickly on the fly as
needed, so there's no point in wasting space for these things
for large projects.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-svn: expand handling of From: and Signed-off-by:
Andy Whitcroft [Thu, 13 Dec 2007 06:58:15 +0000 (06:58 +0000)]
git-svn: expand handling of From: and Signed-off-by:

The current parsing for From: and Signed-off-by: lines handles fully
specified names:

From: Full Name <email@address>

Expand this to include the raw email addresses and straight "names":

From: email@address       -> email <email@address>
From: Full Name           -> Full Name <unknown>

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix spelling mistakes in user manual
Shawn Bohrer [Thu, 13 Dec 2007 04:36:21 +0000 (22:36 -0600)]
Fix spelling mistakes in user manual

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Acked-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-commit: squelch needless message during an empty merge
Junio C Hamano [Thu, 13 Dec 2007 03:09:16 +0000 (19:09 -0800)]
git-commit: squelch needless message during an empty merge

When recording a merge that conflicted and ends up in no changes after
manual resolution, commit callchain looked like this:

cmd_commit() ->
            prepare_log_message() ->
                run_status() ->
    wt_status_print()

This invocation of run_status() is asked to find out if there is a
committable change, but it unconditionally gave instructions such as
"use git-add" at the same time.  When in merge, we do allow an empty
change to be recorded, so after showing this message the code still went
ahead and made a commit.

This introduces "nowarn" parameter to run_status() to avoid these
useless messages.  If we are not allowed to create an empty commit, we
already call run_status() again in the original codepath, and the
message will be shown from that call anyway.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGIT 1.5.4-rc0 v1.5.4-rc0
Junio C Hamano [Thu, 13 Dec 2007 01:48:21 +0000 (17:48 -0800)]
GIT 1.5.4-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'cc/help'
Junio C Hamano [Thu, 13 Dec 2007 01:46:16 +0000 (17:46 -0800)]
Merge branch 'cc/help'

* cc/help:
  RPM spec: Adjust htmldir
  git-help -w: do not require to be in git repository
  git.spec.in: remove python_path
  Documentation: rename git.texi to user-manual.texi
  Add git-browse-help to .gitignore
  git-help -i: show info documentation from matching version of git
  git-help -i: invoke info with document and node name
  Documentation: add gitman.info target
  Documentation: describe -w/--web option to "git-help".
  Use {web,instaweb,help}.browser config options.
  git-help: add -w|--web option to display html man page in a browser.
  Documentation: describe -i/--info option to "git-help"
  git-help: add -i|--info option to display info page.

13 years agoRPM spec: Adjust htmldir
Junio C Hamano [Wed, 12 Dec 2007 22:00:24 +0000 (14:00 -0800)]
RPM spec: Adjust htmldir

git help -w needs to know the right location of installed pages.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-help -w: do not require to be in git repository
Junio C Hamano [Thu, 13 Dec 2007 01:34:30 +0000 (17:34 -0800)]
git-help -w: do not require to be in git repository

The users used to be able to say "git help cat-file" from anywhere, but
the browse-help script insisted to be in a git repository, which caused
"git help -w cat-file" to barf outside.  Correct it.

While at it, remove leftover debugging "echo".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/shortlog-e'
Junio C Hamano [Thu, 13 Dec 2007 01:07:03 +0000 (17:07 -0800)]
Merge branch 'jc/shortlog-e'

* jc/shortlog-e:
  shortlog: default to HEAD when the standard input is a tty
  Invert numbers and names in the git-shortlog summary mode.
  shortlog: document -e option
  git-shortlog -e: show e-mail address as well

13 years agoMerge branch 'ew/svn-rev-db'
Junio C Hamano [Thu, 13 Dec 2007 00:53:06 +0000 (16:53 -0800)]
Merge branch 'ew/svn-rev-db'

* ew/svn-rev-db:
  git-svn: reinstate old rev_db optimization in new rev_map
  git-svn: replace .rev_db with a more space-efficient .rev_map format

13 years agoMerge branch 'jc/merge-recursive-gitlink'
Junio C Hamano [Thu, 13 Dec 2007 00:52:59 +0000 (16:52 -0800)]
Merge branch 'jc/merge-recursive-gitlink'

* jc/merge-recursive-gitlink:
  Support a merge with conflicting gitlink change

13 years agoMerge branch 'jk/svn-color'
Junio C Hamano [Thu, 13 Dec 2007 00:52:51 +0000 (16:52 -0800)]
Merge branch 'jk/svn-color'

* jk/svn-color:
  git-svn: get color config from --get-colorbool
  Support GIT_PAGER_IN_USE environment variable

13 years agogit.spec.in: remove python_path
Junio C Hamano [Wed, 12 Dec 2007 21:42:12 +0000 (13:42 -0800)]
git.spec.in: remove python_path

We do not depend on python nor customize scripts for it anymore.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: rename git.texi to user-manual.texi
Junio C Hamano [Wed, 12 Dec 2007 21:31:02 +0000 (13:31 -0800)]
Documentation: rename git.texi to user-manual.texi

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodisable t9119 for now.
Junio C Hamano [Wed, 12 Dec 2007 19:53:29 +0000 (11:53 -0800)]
disable t9119 for now.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix "diff --check" whitespace detection
Wincent Colaiuta [Wed, 12 Dec 2007 16:22:59 +0000 (17:22 +0100)]
Fix "diff --check" whitespace detection

"diff --check" would only detect spaces before tabs if a tab was the
last character in the leading indent. Fix that and add a test case to
make sure the bug doesn't regress in the future.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-diff --numstat -z: make it machine readable
Junio C Hamano [Wed, 12 Dec 2007 07:46:30 +0000 (23:46 -0800)]
git-diff --numstat -z: make it machine readable

The "-z" format is all about machine parsability, but showing renamed
paths as "common/{a => b}/suffix" makes it impossible.  The scripts would
never have successfully parsed "--numstat -z -M" in the old format.

This fixes the output format in a (hopefully minimally) backward
incompatible way.

 * The output without -z is not changed.  This has given a good way for
   humans to view added and deleted lines separately, and showing the
   path in combined, shorter way would preserve readability.

 * The output with -z is unchanged for paths that do not involve renames.
   Existing scripts that do not pass -M/-C are not affected at all.

 * The output with -z for a renamed path is shown in a format that can
   easily be distinguished from an unrenamed path.

This is based on Jakub Narebski's patch.  Bugs and documentation typos
are mine.

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