Code

git.git
16 years agoDon't access line[-1] for a zero-length "line" from fgets.
Jim Meyering [Fri, 4 Jan 2008 17:37:41 +0000 (18:37 +0100)]
Don't access line[-1] for a zero-length "line" from fgets.

A NUL byte at beginning of file, or just after a newline
would provoke an invalid buf[-1] access in a few places.

* builtin-grep.c (cmd_grep): Don't access buf[-1].
* builtin-pack-objects.c (get_object_list): Likewise.
* builtin-rev-list.c (read_revisions_from_stdin): Likewise.
* bundle.c (read_bundle_header): Likewise.
* server-info.c (read_pack_info_file): Likewise.
* transport.c (insert_packed_refs): Likewise.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-clean: make "Would remove ..." path relative to cwd again
Junio C Hamano [Fri, 4 Jan 2008 03:04:37 +0000 (19:04 -0800)]
git-clean: make "Would remove ..." path relative to cwd again

The rewrite changed the output to use the path relative to the
top of the work tree without a good reason.  This fixes it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix grammar nits in documentation and in code comments.
Jim Meyering [Thu, 3 Jan 2008 14:18:07 +0000 (15:18 +0100)]
Fix grammar nits in documentation and in code comments.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUninline prefixcmp()
Junio C Hamano [Thu, 3 Jan 2008 09:23:12 +0000 (01:23 -0800)]
Uninline prefixcmp()

Now the routine is an open-coded loop that avoids an extra
strlen() in the previous implementation, it got a bit too big to
be inlined.  Uninlining it makes code footprint smaller but the
result still retains the avoidance of strlen() cost.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUpdate callers of check_ref_format()
Junio C Hamano [Wed, 2 Jan 2008 19:14:40 +0000 (11:14 -0800)]
Update callers of check_ref_format()

This updates send-pack and fast-import to use symbolic constants
for checking the return values from check_ref_format(), and also
futureproof the logic in lock_any_ref_for_update() to explicitly
name the case that is usually considered an error but is Ok for
this particular use.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn: unlink index files that were globbed, too
Eric Wong [Wed, 2 Jan 2008 18:10:03 +0000 (10:10 -0800)]
git-svn: unlink index files that were globbed, too

commit 3157dd9e89a71e80673d0bc21b5c0630f3b1fe68 (git-svn: unlink
internal index files after operations) introduced unlinking
index files after fetching.  However, this missed indices for
refs that were created by globbing branches and tags.  This will
track all refs we ever touch during a fetch and unlink them at
exit time.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn: allow dcommit --no-rebase to commit multiple, dependent changes
Eric Wong [Wed, 2 Jan 2008 18:09:49 +0000 (10:09 -0800)]
git-svn: allow dcommit --no-rebase to commit multiple, dependent changes

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoreceive-pack: check object type of sha1 before using them as commits
Martin Koegler [Wed, 2 Jan 2008 07:39:21 +0000 (08:39 +0100)]
receive-pack: check object type of sha1 before using them as commits

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoOptimize prefixcmp()
Johannes Schindelin [Sat, 29 Dec 2007 19:22:14 +0000 (20:22 +0100)]
Optimize prefixcmp()

Certain codepaths (notably "git log --pretty=format...") use
prefixcmp() extensively, with very short prefixes.  In those cases,
calling strlen() is a wasteful operation, so avoid it.

Initial patch by Marco Costalba.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agolock_any_ref_for_update(): reject wildcard return from check_ref_format
Junio C Hamano [Wed, 2 Jan 2008 06:33:20 +0000 (22:33 -0800)]
lock_any_ref_for_update(): reject wildcard return from check_ref_format

Recent check_ref_format() returns -3 as well as -1 (general
error) and -2 (less than two levels).  The caller was explicitly
checking for -1, to allow "HEAD" but still needed to disallow
bogus refs.

This introduces symbolic constants for the return values from
check_ref_format() to make them read better and more
meaningful.  Normal ref creation codepath can still treat
non-zero return values as errors.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-reset: refuse to do hard reset in a bare repository
Jeff King [Mon, 31 Dec 2007 07:13:52 +0000 (02:13 -0500)]
git-reset: refuse to do hard reset in a bare repository

It makes no sense since there is no working tree. A soft
reset should be fine, though.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoconfig: handle lack of newline at end of file better
Jeff King [Tue, 1 Jan 2008 06:17:34 +0000 (01:17 -0500)]
config: handle lack of newline at end of file better

The config parsing routines use the static global
'config_file' to store the FILE* pointing to the current
config file being parsed. The function get_next_char()
automatically converts an EOF on this file to a newline for
the convenience of its callers, and it sets config_file to
NULL to indicate that EOF was reached.

This throws away useful information, though, since some
routines want to call ftell on 'config_file' to find out
exactly _where_ the routine ended. In the case of a key
ending at EOF boundary, we ended up segfaulting in some
cases (changing that key or adding another key in its
section), or failing to provide the necessary newline
(adding a new section).

This patch adds a new flag to indicate EOF and uses that
instead of setting config_file to NULL. It also makes sure
to add newlines where necessary for truncated input. All
three included tests fail without the patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint' of git://linux-nfs.org/~bfields/git
Junio C Hamano [Mon, 31 Dec 2007 17:23:55 +0000 (09:23 -0800)]
Merge branch 'maint' of git://linux-nfs.org/~bfields/git

* 'maint' of git://linux-nfs.org/~bfields/git:
  Documentation/user-manual.txt: fix typo
  Documentation: fix remote.<name>.skipDefaultUpdate description

16 years agoDocumentation/user-manual.txt: fix typo
Gustaf Hendeby [Mon, 31 Dec 2007 13:31:35 +0000 (14:31 +0100)]
Documentation/user-manual.txt: fix typo

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agoDocumentation: fix remote.<name>.skipDefaultUpdate description
J. Bruce Fields [Sat, 22 Dec 2007 00:57:16 +0000 (19:57 -0500)]
Documentation: fix remote.<name>.skipDefaultUpdate description

Fix the subcommand name.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agogit-rebase -i: clean-up error check codepath.
Junio C Hamano [Sun, 30 Dec 2007 20:51:42 +0000 (12:51 -0800)]
git-rebase -i: clean-up error check codepath.

After replaying a single change, the code performed a number of checks,
but some of them were for sanity checking, failures from which should
make the command abort, and others were checks to see if it should make
a new commit object.  Stringing them together with "&&" was wrong.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-rebase -i behaves better on commits with incomplete messages
Junio C Hamano [Sun, 30 Dec 2007 20:37:59 +0000 (12:37 -0800)]
git-rebase -i behaves better on commits with incomplete messages

The commit message template when squashing multiple commits is
prepared by concatenating the messages of existing commits
together.  If the messages from some of them end with incomplete
lines, this would result in a suboptimal message template.  Make
sure that we add a terminating LF after each commit message.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix double-free() in http-push.c:remote_exists()
Grégoire Barbier [Sun, 30 Dec 2007 17:15:51 +0000 (18:15 +0100)]
Fix double-free() in http-push.c:remote_exists()

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years ago"git pull --tags": error out with a better message.
Junio C Hamano [Fri, 28 Dec 2007 21:58:43 +0000 (13:58 -0800)]
"git pull --tags": error out with a better message.

When "git pull --tags" is run without any other arguments, the
standard error message "You told me to fetch and merge stuff but
there is nothing to merge!  You might want to fix your config"
is given.

While the error may be technically correct, fixing the config
would not help, as "git pull --tags" itself tells "git fetch"
not to use the configured refspecs.

This commit makes "git pull --tags" to issue a different error
message to avoid confusion.  This is merely an interim solution.

In the longer term, it would be a better approach to change the
semantics of --tags option to make "git fetch" and "git pull"
to:

 (1) behave as if no --tags was given (so an explicit refspec on
     the command line overrides configured ones, or no explicit
     refspecs on the command line takes configured ones); but

 (2) no auto-following of tags is made even when using
     configured refspecs; and

 (3) fetch all tags as not-for-merge entries".

Then we would not need to have this separate error message, as
the ordinary merge will happen even with the --tags option.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-sh-setup: document git_editor() and get_author_ident_from_commit()
Miklos Vajna [Fri, 28 Dec 2007 22:25:39 +0000 (23:25 +0100)]
git-sh-setup: document git_editor() and get_author_ident_from_commit()

These 2 functions were missing from the manpage.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-submodule.txt: typofix
Junio C Hamano [Fri, 28 Dec 2007 07:29:53 +0000 (23:29 -0800)]
Documentation/git-submodule.txt: typofix

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoGIT 1.5.4-rc2 v1.5.4-rc2
Junio C Hamano [Thu, 27 Dec 2007 02:16:52 +0000 (18:16 -0800)]
GIT 1.5.4-rc2

Although everybody was quiet during the Christmas holiday, it's been
a week since -rc1, so here is -rc2.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'rs/pretty-safety'
Junio C Hamano [Thu, 27 Dec 2007 01:52:40 +0000 (17:52 -0800)]
Merge branch 'rs/pretty-safety'

* rs/pretty-safety:
  Make "--pretty=format" parser a bit more careful.

16 years agoMake "--pretty=format" parser a bit more careful.
René Scharfe [Thu, 20 Dec 2007 12:20:15 +0000 (13:20 +0100)]
Make "--pretty=format" parser a bit more careful.

When a commit message that does not have a terminating LF is
read in and the memory that was allocated to read it happens to
have a LF immediately after that, the code was not careful and
went past the terminating NUL.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocontrib: resurrect scripted git-revert.
Junio C Hamano [Thu, 27 Dec 2007 01:38:00 +0000 (17:38 -0800)]
contrib: resurrect scripted git-revert.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'ar/commit-cleanup'
Junio C Hamano [Thu, 27 Dec 2007 01:35:38 +0000 (17:35 -0800)]
Merge branch 'ar/commit-cleanup'

* ar/commit-cleanup:
  Allow selection of different cleanup modes for commit messages
  builtin-commit: avoid double-negation in the code.
  builtin-commit: fix amending of the initial commit
  t7005: do not exit inside test.

16 years agoFix rewrite_diff() name quoting.
Junio C Hamano [Thu, 27 Dec 2007 01:13:36 +0000 (17:13 -0800)]
Fix rewrite_diff() name quoting.

This moves the logic to quote two paths (prefix + path) in
C-style introduced in the previous commit from the
dump_quoted_path() in combine-diff.c to quote.c, and uses it to
fix rewrite_diff() that never C-quoted the pathnames correctly.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocombine-diff: Fix path quoting
Junio C Hamano [Thu, 27 Dec 2007 00:51:19 +0000 (16:51 -0800)]
combine-diff: Fix path quoting

Earlier when showing combined diff, the filenames on the ---/+++
header lines were quoted incorrectly.  a/ (or b/) prefix was
output literally and then the path was output, with c-quoting.

This fixes the quoting logic, and while at it, adjusts the code
to use the customizable prefix (a_prefix and b_prefix)
introduced recently.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix documentation of --first-parent in git-log and copy it to git-rev-list
Junio C Hamano [Thu, 27 Dec 2007 00:04:05 +0000 (16:04 -0800)]
Fix documentation of --first-parent in git-log and copy it to git-rev-list

Credit goes to Avi Kivity for noticing the lack of description in
rev-list manual page.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix "git log --diff-filter" bug
Arjen Laarhoven [Tue, 25 Dec 2007 11:06:47 +0000 (12:06 +0100)]
Fix "git log --diff-filter" bug

In commit b7bb760d5ed4881422673d32f869d140221d3564 (Fix revision
log diff setup, avoid unnecessary diff generation) an optimization was
made to avoid unnecessary diff generation.  This was partly fixed in
99516e35d096f41e7133cacde8fbed8ee9a3ecd0 (Fix embarrassing "git log
--follow" bug).  The '--diff-filter' option also needs the diff machinery
in action.

Signed-off-by: Arjen Laarhoven <arjen@yaph.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoImprove error messages when int/long cannot be parsed from config
Shawn O. Pearce [Tue, 25 Dec 2007 07:18:05 +0000 (02:18 -0500)]
Improve error messages when int/long cannot be parsed from config

If a config file has become mildly corrupted due to a missing LF
we may discover some other option joined up against the end of a
numeric value.  For example:

[section]
number = 1auto

where the "auto" flag was meant to occur on the next line, below
"number", but the missing LF has caused it to no longer be its
own option.  Instead the word "auto" is parsed as a 'unit factor'
for the value of "number".

Before this change we got the confusing error message:

  fatal: unknown unit: 'auto'

which told us nothing about where the problem appeared.  Now we get:

  fatal: bad config value for 'aninvalid.unit'

which at least points the user in the right direction of where to
search for the incorrectly formatted configuration file.

Noticed by erikh on #git, which received the original error from
a simple `git checkout -b` due to a midly corrupted config.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocvsimport: die on cvsps errors
Jeff King [Mon, 24 Dec 2007 03:08:19 +0000 (22:08 -0500)]
cvsimport: die on cvsps errors

We were not previously checking the exit status of cvsps at
all. If it exited before producing any useful output, we
ended up with an empty import, which caused a spew of
confusing error messages from other parts of git:

$ git-cvsimport foo
Initialized empty Git repository in ...
some error from cvsps
fatal: refs/heads/origin: not a valid SHA1
fatal: master: not a valid SHA1
warning: You appear to be on a branch yet to be born.
warning: Forcing checkout of HEAD.
fatal: just how do you expect me to merge 0 trees?
checkout failed: 256

Now we get:

$ git-cvsimport foo
Initialized empty Git repository in ...
some error from cvsps
git-cvsimport: fatal: cvsps reported error

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoshortlog manpage documentation: work around asciidoc markup issues
Gustaf Hendeby [Sun, 23 Dec 2007 18:37:01 +0000 (10:37 -0800)]
shortlog manpage documentation: work around asciidoc markup issues

We wanted to have a list in which one (and the sole, as it happen to
be) item in it is ".mailmap", but do not seem to be able to convince
AsciiDoc to format it correctly for manpages.  Reformat it into a
paragraph that describes the said file to work around the issue.

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: describe 'union' low-level merge driver
Junio C Hamano [Sun, 23 Dec 2007 07:14:59 +0000 (23:14 -0800)]
Documentation: describe 'union' low-level merge driver

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow selection of different cleanup modes for commit messages
Alex Riesen [Sat, 22 Dec 2007 18:46:24 +0000 (19:46 +0100)]
Allow selection of different cleanup modes for commit messages

Although we traditionally stripped away excess blank lines, trailing
whitespaces and lines that begin with "#" from the commit log message,
sometimes the message just has to be the way user wants it.

For instance, a commit message template can contain lines that begin with
"#", the message must be kept as close to its original source as possible
if you are converting from a foreign SCM, or maybe the message has a shell
script including its comments for future reference.

The cleanup modes are default, verbatim, whitespace and strip. The
default mode depends on if the message is being edited and will either
strip whitespace and comments (if editor active) or just strip the
whitespace (for where the message is given explicitely).

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-commit: avoid double-negation in the code.
Junio C Hamano [Sun, 23 Dec 2007 03:25:37 +0000 (19:25 -0800)]
builtin-commit: avoid double-negation in the code.

The flag no_edit meant "we have got final message from the user
and will not editing it any further", but there were quite a few
places that needed to check !no_edit.  Rename the variable to
use_editor and reverse the logic everywhere.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-commit: fix amending of the initial commit
Junio C Hamano [Sun, 23 Dec 2007 03:22:29 +0000 (19:22 -0800)]
builtin-commit: fix amending of the initial commit

When amending initial commit without editor, the command
incorrectly barfed because the check to see if there is anything
to commit referenced the non-existent HEAD^1.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot7005: do not exit inside test.
Junio C Hamano [Sun, 23 Dec 2007 03:14:33 +0000 (19:14 -0800)]
t7005: do not exit inside test.

The way to signal failure is to leave non-zero in $?, not abort
the entire test.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDon't dereference NULL upon lookup failure.
Jim Meyering [Fri, 21 Dec 2007 10:56:32 +0000 (11:56 +0100)]
Don't dereference NULL upon lookup failure.

Instead, signal the error just like the case we do upon encountering
an object with an unknown type.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoEmit helpful status for accidental "git stash" save
Wincent Colaiuta [Sat, 22 Dec 2007 17:31:25 +0000 (18:31 +0100)]
Emit helpful status for accidental "git stash" save

If the user types "git stash" mistakenly thinking that this will list
their stashes he/she may be surprised to see that it actually saved
a new stash and reset their working tree and index.

In the worst case they might not know how to recover the state. So
help them by telling them exactly what was saved and also how to
restore it immediately.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoparse-options: Add a gitcli(5) man page.
Pierre Habouzit [Thu, 13 Dec 2007 10:20:01 +0000 (11:20 +0100)]
parse-options: Add a gitcli(5) man page.

This page should hold every information about the git ways to parse command
lines, and best practices to be used for scripting.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
16 years agoForce the sticked form for options with optional arguments.
Pierre Habouzit [Fri, 21 Dec 2007 10:41:41 +0000 (11:41 +0100)]
Force the sticked form for options with optional arguments.

This forbids "git tag -n <number> -l" we allowed earlier, so
adjust t7004 while at it.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
16 years agoFix $EDITOR regression introduced by rewrite in C.
Junio C Hamano [Sat, 22 Dec 2007 17:45:10 +0000 (09:45 -0800)]
Fix $EDITOR regression introduced by rewrite in C.

When git-tag and git-commit launches the editor, they used to
honor EDITOR="editor -options args..." but recent rewrite in C
insisted on $EDITOR to be the path to the editor executable.

This restores the older behaviour.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoSmall comment fix for git-cvsimport.
Stefan Sperling [Fri, 21 Dec 2007 15:57:26 +0000 (16:57 +0100)]
Small comment fix for git-cvsimport.

Signed-off-by: Stefan Sperling <stsp@stsp.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake git send-email accept $EDITOR with arguments
Gustaf Hendeby [Sat, 22 Dec 2007 00:40:52 +0000 (01:40 +0100)]
Make git send-email accept $EDITOR with arguments

Currently git send-email does not accept $EDITOR with arguments, eg,
emacs -nw, when starting an editor to produce a cover letter.  This
patch changes this by letting the shell handle the option parsing.

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-tag: fix -l switch handling regression.
Pierre Habouzit [Fri, 21 Dec 2007 10:50:58 +0000 (11:50 +0100)]
git-tag: fix -l switch handling regression.

The command itself takes an optional <pattern> argument that
limits the shown tags to the ones that match when in listing
mode that is triggered with '-l' option.  The <pattern> is not
an optional option-argument to '-l'.

With this fix, "git tag -l -n 4 v0.99" works as expected.

It also removes a few bogus tests in t7004.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: ls-files -v is about "assume unchanged".
Junio C Hamano [Fri, 21 Dec 2007 21:50:58 +0000 (13:50 -0800)]
Documentation: ls-files -v is about "assume unchanged".

And refer the reader to update-index documentation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRe(-re)*fix trim_common_tail()
Linus Torvalds [Fri, 21 Dec 2007 04:22:46 +0000 (20:22 -0800)]
Re(-re)*fix trim_common_tail()

The tar-ball and the git archive itself is fine, but yes, the diff from
2.6.23 to 2.6.24-rc6 is bad. It's the "trim_common_tail()" optimization
that has caused way too much pain.

Very interesting breakage. The patch was actually "correct" in a (rather
limited) technical sense, but the context at the end was missing because
while the trim_common_tail() code made sure to keep enough common context
to allow a valid diff to be generated, the diff machinery itself could
decide that it could generate the diff differently than the "obvious"
solution.

Thee sad fact is that the git optimization (which is very important for
"git blame", which needs no context), is only really valid for that one
case where we really don't need any context.

[jc: since this is shared with "git diff -U0" codepath, context recovery
to the end of line needs to be done even for zero context case.]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitweb: fix whitespace in config_to_multi (indent with tab)
Jakub Narebski [Thu, 20 Dec 2007 09:48:09 +0000 (10:48 +0100)]
gitweb: fix whitespace in config_to_multi (indent with tab)

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoeveryday: replace 'prune' and 'repack' with 'gc'
Miklos Vajna [Thu, 20 Dec 2007 14:05:45 +0000 (15:05 +0100)]
everyday: replace 'prune' and 'repack' with 'gc'

In everyday tasks, "repack -a -d -f" won't be used, so there
is not much point mentioning "repack".  By showing the --prune
option to "gc", we can do without mentioning "git prune", too.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRemove old generated files from .gitignore.
Charles Bailey [Thu, 20 Dec 2007 13:00:40 +0000 (13:00 +0000)]
Remove old generated files from .gitignore.

Some entries in .gitignore are obselete.  These should be cleaned up
just for the sake of general tidiness and so that any developers who
have a working tree that was moved forward without a clean know that
they have old stuff in their work tree.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoclean up 1.5.4 release notes
Jeff King [Thu, 20 Dec 2007 12:11:25 +0000 (07:11 -0500)]
clean up 1.5.4 release notes

Mostly typo and small grammatical fixes with one or two rewordings for
clarity.  But note the important fix for status.relativepaths.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMention git-shell's "cvs" substitution in the RelNotes
Johannes Schindelin [Thu, 20 Dec 2007 11:50:34 +0000 (12:50 +0100)]
Mention git-shell's "cvs" substitution in the RelNotes

git shell became much more powerful for existing CVS setups.
We should not hide from those people who only read release
notes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoshell-scripts usage(): consistently exit with non-zero
Junio C Hamano [Thu, 20 Dec 2007 20:58:06 +0000 (12:58 -0800)]
shell-scripts usage(): consistently exit with non-zero

Earlier conversion of shell scripts to parse-options made usage()
to run "git cmd -h" which in turn emit LONG_USAGE and exit with 0
status.  This is inconsistent with the scripts that do not use
parse-options, whose usage() died with the message, exiting with 1.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoReallow git-rebase --interactive --continue if commit is unnecessary
Shawn O. Pearce [Thu, 20 Dec 2007 07:12:12 +0000 (02:12 -0500)]
Reallow git-rebase --interactive --continue if commit is unnecessary

During git-rebase --interactive's --continue implementation we used
to silently restart the rebase if the user had made the commit
for us.  This is common if the user stops to edit a commit and
does so by amending it.  My recent change to watch git-commit's
exit status broke this behavior.

Thanks to Bernt Hansen for catching it in 1.5.4-rc1.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agofix git commit --amend -m "new message"
Junio C Hamano [Thu, 20 Dec 2007 03:23:03 +0000 (19:23 -0800)]
fix git commit --amend -m "new message"

The prepare_log_message() function serves two purposes:

 - Prepares the commit log message template, to be given to the end
   user;

 - Return true if there is something committable;

7168624c3530d8c7ee32f930f8fb2ba302b9801f (Do not generate full commit
log message if it is not going to be used) cheated to omit the former
when we know the log message template is not going to be used.  However,
its replacement logic to see if there is something committable was
botched.  When amending, it should compare the index with the parent of
the HEAD, not the current HEAD.  Otherwise you cannot run --amend to
fix only the message without changing the tree.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot4024: fix test script to use simpler sed pattern
Junio C Hamano [Thu, 20 Dec 2007 00:21:30 +0000 (16:21 -0800)]
t4024: fix test script to use simpler sed pattern

The earlier test stripped away expected number of 'z' but the output
would have been very hard to read once somebody broke the common tail
optimization.  Instead, count the number of 'z' and show it, to help
diagnosing the problem better in the future.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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

16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>