Code

git.git
15 years agoMerge branch 'js/rsync-local'
Junio C Hamano [Wed, 18 Mar 2009 01:58:13 +0000 (18:58 -0700)]
Merge branch 'js/rsync-local'

* js/rsync-local:
  rsync transport: allow local paths, and fix tests

15 years agoMerge branch 'rs/color-grep'
Junio C Hamano [Wed, 18 Mar 2009 01:58:02 +0000 (18:58 -0700)]
Merge branch 'rs/color-grep'

* rs/color-grep:
  grep: prefer builtin over external one when coloring results
  grep: cast printf %.*s "precision" argument explicitly to int
  grep: add support for coloring with external greps
  grep: color patterns in output
  grep: add pmatch and eflags arguments to match_one_pattern()
  grep: remove grep_opt argument from match_expr_eval()
  grep: micro-optimize hit collection for AND nodes

15 years agoMerge branch 'js/remote-improvements'
Junio C Hamano [Wed, 18 Mar 2009 01:55:06 +0000 (18:55 -0700)]
Merge branch 'js/remote-improvements'

* js/remote-improvements: (23 commits)
  builtin-remote.c: no "commented out" code, please
  builtin-remote: new show output style for push refspecs
  builtin-remote: new show output style
  remote: make guess_remote_head() use exact HEAD lookup if it is available
  builtin-remote: add set-head subcommand
  builtin-remote: teach show to display remote HEAD
  builtin-remote: fix two inconsistencies in the output of "show <remote>"
  builtin-remote: make get_remote_ref_states() always populate states.tracked
  builtin-remote: rename variables and eliminate redundant function call
  builtin-remote: remove unused code in get_ref_states
  builtin-remote: refactor duplicated cleanup code
  string-list: new for_each_string_list() function
  remote: make match_refs() not short-circuit
  remote: make match_refs() copy src ref before assigning to peer_ref
  remote: let guess_remote_head() optionally return all matches
  remote: make copy_ref() perform a deep copy
  remote: simplify guess_remote_head()
  move locate_head() to remote.c
  move duplicated ref_newer() to remote.c
  move duplicated get_local_heads() to remote.c
  ...

Conflicts:
builtin-clone.c

15 years agoMerge branch 'tr/maint-1.6.0-send-email-irt'
Junio C Hamano [Wed, 18 Mar 2009 01:54:46 +0000 (18:54 -0700)]
Merge branch 'tr/maint-1.6.0-send-email-irt'

* tr/maint-1.6.0-send-email-irt:
  send-email: test --no-thread --in-reply-to combination
  send-email: respect in-reply-to regardless of threading

Conflicts:
t/t9001-send-email.sh

15 years agoMerge branch 'kb/checkout-optim'
Junio C Hamano [Wed, 18 Mar 2009 01:54:31 +0000 (18:54 -0700)]
Merge branch 'kb/checkout-optim'

* kb/checkout-optim:
  Revert "lstat_cache(): print a warning if doing ping-pong between cache types"
  checkout bugfix: use stat.mtime instead of stat.ctime in two places
  Makefile: Set compiler switch for USE_NSEC
  Create USE_ST_TIMESPEC and turn it on for Darwin
  Not all systems use st_[cm]tim field for ns resolution file timestamp
  Record ns-timestamps if possible, but do not use it without USE_NSEC
  write_index(): update index_state->timestamp after flushing to disk
  verify_uptodate(): add ce_uptodate(ce) test
  make USE_NSEC work as expected
  fix compile error when USE_NSEC is defined
  check_updates(): effective removal of cache entries marked CE_REMOVE
  lstat_cache(): print a warning if doing ping-pong between cache types
  show_patch_diff(): remove a call to fstat()
  write_entry(): use fstat() instead of lstat() when file is open
  write_entry(): cleanup of some duplicated code
  create_directories(): remove some memcpy() and strchr() calls
  unlink_entry(): introduce schedule_dir_for_removal()
  lstat_cache(): swap func(length, string) into func(string, length)
  lstat_cache(): generalise longest_match_lstat_cache()
  lstat_cache(): small cleanup and optimisation

15 years agogrep: prefer builtin over external one when coloring results
Nguyễn Thái Ngọc Duy [Mon, 16 Mar 2009 02:20:04 +0000 (13:20 +1100)]
grep: prefer builtin over external one when coloring results

As far as I know, not all grep programs support coloring, so we should
rely on builtin grep. If you want external grep, set
color.grep.external to empty string.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoconfig.txt: Describe special 'none' handling in core.gitProxy.
Emil Sit [Tue, 17 Mar 2009 17:31:42 +0000 (13:31 -0400)]
config.txt: Describe special 'none' handling in core.gitProxy.

Signed-off-by: Emil Sit <sit@emilsit.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agols-files: require worktree when --deleted is given
Jeff King [Tue, 17 Mar 2009 09:03:19 +0000 (05:03 -0400)]
ls-files: require worktree when --deleted is given

The code will end up calling lstat() to check whether the
file still exists; obviously this doesn't work if we're not
in the worktree.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-branch.txt: document -f correctly
Michael J Gruber [Tue, 17 Mar 2009 14:06:20 +0000 (15:06 +0100)]
git-branch.txt: document -f correctly

'git branch -f a b' resets a to b when a exists, rather then deleting a.
Say so in the documentation.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agopickaxe: count regex matches only once
René Scharfe [Mon, 16 Mar 2009 18:38:42 +0000 (19:38 +0100)]
pickaxe: count regex matches only once

When --pickaxe-regex is used, forward past the end of matches instead of
advancing to the byte after their start.  This way matches count only
once, even if the regular expression matches their tail -- like in the
fixed-string fork of the code.

E.g.: /.*/ used to count the number of bytes instead of the number of
lines.  /aa/ resulted in a count of two in "aaa" instead of one.

Also document the fact that regexec() needs a NUL-terminated string as
its second argument by adding an assert().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-send-email.txt: describe --compose better
Stephen Boyd [Mon, 16 Mar 2009 07:44:57 +0000 (00:44 -0700)]
git-send-email.txt: describe --compose better

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoTests: use test_cmp instead of diff where possible
Miklos Vajna [Mon, 16 Mar 2009 20:18:42 +0000 (21:18 +0100)]
Tests: use test_cmp instead of diff where possible

Several old tests were written before test_cmp was introduced, convert
these to test_cmp.

If were are at it, fix the order of the arguments where necessary to
make expected come first, so the command shows how the test result
deviates from the correct output.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: remove extra quoting/emphasis around literal texts
Chris Johnsen [Sun, 15 Mar 2009 11:30:52 +0000 (06:30 -0500)]
Documentation: remove extra quoting/emphasis around literal texts

If literal text (asciidoc `...`) can be rendered in a differently from
normal text for each output format (man, HTML), then we do not need
extra quotes or other wrapping around inline literal text segments.

config.txt

  Change '`...`' to `...`. In asciidoc, the single quotes provide
  emphasis, literal text should be distintive enough.

  Change "`...`" to `...`. These double quotes do not work if present
  in the described config value, so drop them.

git-checkout.txt

  Change "`...`" to `...` or `"..."`. All instances are command line
  argument examples. One "`-`" becomes `-`. Two others are involve
  curly braces, so move the double quotes inside the literal region to
  indicate that they might need to be quoted on the command line of
  certain shells (tcsh).

git-merge.txt

  Change "`...`" to `...`. All instances are used to describe merge
  conflict markers. The quotes should are not important.

git-rev-parse.txt

  Change "`...`" to `...`. All instances are around command line
  arguments where no in-shell quoting should be necessary.

gitcli.txt

  Change `"..."` to `...`. All instances are around command line
  examples or single command arguments. They do not semanticly belong
  inside the literal text, and they are not needed outside it.

glossary-content.txt
user-manual.txt

  Change "`...`" to `...`. All instances were around command lines.

Signed-off-by: Chris Johnsen <chris_johnsen@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-push.txt: describe how to default to pushing only current branch
Chris Johnsen [Sun, 15 Mar 2009 02:32:01 +0000 (21:32 -0500)]
git-push.txt: describe how to default to pushing only current branch

Signed-off-by: Chris Johnsen <chris_johnsen@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodisable post-checkout test on Cygwin
Alex Riesen [Tue, 17 Mar 2009 16:22:53 +0000 (17:22 +0100)]
disable post-checkout test on Cygwin

It is broken because of the tricks we have to play with
lstat to get the bearable perfomance out of the call.
Sadly, it disables access to Cygwin's executable attribute,
which Windows filesystems do not have at all.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRevert "lstat_cache(): print a warning if doing ping-pong between cache types"
Kjetil Barvik [Tue, 17 Mar 2009 18:20:29 +0000 (19:20 +0100)]
Revert "lstat_cache(): print a warning if doing ping-pong between cache types"

This reverts commit 7734f04873cfaddd0b148074a633f1f824fd961f.

I guess that the reverted commit, 7734f048, has been in test long
enough, and should now be reverted.  I have not received any info
regarding any debug output of the reverted commit, so lets hope that
the lstat_cache() function do not cause any ping-pong.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMinGW: a hardlink implementation
Petr Kodl [Sat, 24 Jan 2009 14:04:39 +0000 (15:04 +0100)]
MinGW: a hardlink implementation

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMinGW: a helper function that translates Win32 API error codes
Petr Kodl [Sat, 24 Jan 2009 14:04:39 +0000 (15:04 +0100)]
MinGW: a helper function that translates Win32 API error codes

This function translates many possible Win32 error codes to suitable
errno numbers.  We will use it in our wrapper functions that need to call
into Win32.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix various dead stores found by the clang static analyzer
Benjamin Kramer [Sun, 15 Mar 2009 21:01:20 +0000 (22:01 +0100)]
Fix various dead stores found by the clang static analyzer

http-push.c::finish_request():
  request is initialized by the for loop

index-pack.c::free_base_data():
  b is initialized by the for loop

merge-recursive.c::process_renames():
  move compare to narrower scope, and remove unused assignments to it
  remove unused variable renames2

xdiff/xdiffi.c::xdl_recs_cmp():
  remove unused variable ec

xdiff/xemit.c::xdl_emit_diff():
  xche is always overwritten

Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSync with GIT 1.6.2.1
Junio C Hamano [Sun, 15 Mar 2009 20:10:10 +0000 (13:10 -0700)]
Sync with GIT 1.6.2.1

15 years agoGIT 1.6.2.1 v1.6.2.1
Junio C Hamano [Sun, 15 Mar 2009 20:03:19 +0000 (13:03 -0700)]
GIT 1.6.2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocheckout bugfix: use stat.mtime instead of stat.ctime in two places
Kjetil Barvik [Sun, 15 Mar 2009 11:38:55 +0000 (12:38 +0100)]
checkout bugfix: use stat.mtime instead of stat.ctime in two places

Commit e1afca4fd "write_index(): update index_state->timestamp after
flushing to disk" on 2009-02-23 used stat.ctime to record the
timestamp of the index-file.  This is wrong, so fix this and use the
correct stat.mtime timestamp instead.

Commit 110c46a909 "Not all systems use st_[cm]tim field for ns
resolution file timestamp" on 2009-03-08, has a similar bug for the
builtin-fetch-pack.c file.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotest-lib: write test results to test-results/<basename>-<pid>
Johannes Schindelin [Fri, 13 Mar 2009 16:26:36 +0000 (17:26 +0100)]
test-lib: write test results to test-results/<basename>-<pid>

The earlier code meant to attempt to strip everything except the test
number, but only stripped the part starting with the last dash.

However, there is no reason why we should not use the whole basename.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRemove unused assignments
Benjamin Kramer [Fri, 13 Mar 2009 12:51:33 +0000 (13:51 +0100)]
Remove unused assignments

These variables were always overwritten or the assigned
value was unused:

  builtin-diff-tree.c::cmd_diff_tree(): nr_sha1
  builtin-for-each-ref.c::opt_parse_sort(): sort_tail
  builtin-mailinfo.c::decode_header_bq(): in
  builtin-shortlog.c::insert_one_record(): len
  connect.c::git_connect(): path
  imap-send.c::v_issue_imap_cmd(): n
  pretty.c::pp_user_info(): filler
  remote::parse_refspec_internal(): llen

Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotest-suite: Make test script numbers unique
Johannes Sixt [Fri, 13 Mar 2009 12:23:26 +0000 (13:23 +0100)]
test-suite: Make test script numbers unique

In order to selectively skip tests, the environment variable GIT_SKIP_TESTS
can be set like this:

  $ GIT_SKIP_TESTS='t1301 t4150.18' make test

That is, its value can contain only the test script numbers, but not the
full script name. Therefore, it is important that the test scripts are
uniquely numbered. This makes it so.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Fri, 13 Mar 2009 06:39:28 +0000 (23:39 -0700)]
Merge branch 'maint'

* maint:

15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Fri, 13 Mar 2009 06:37:16 +0000 (23:37 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 06:36:57 +0000 (23:36 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  bisect: fix another instance of eval'ed string
  bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped
  Support "\" in non-wildcard exclusion entries

Conflicts:
git-bisect.sh

15 years agoMerge branch 'en/maint-1.6.1-hash-object' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 06:11:23 +0000 (23:11 -0700)]
Merge branch 'en/maint-1.6.1-hash-object' into maint-1.6.1

* en/maint-1.6.1-hash-object:
  Ensure proper setup of git_dir for git-hash-object

15 years agoMerge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.0
Junio C Hamano [Fri, 13 Mar 2009 04:48:43 +0000 (21:48 -0700)]
Merge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.0

* ks/maint-1.6.0-mailinfo-folded:
  mailinfo: tests for RFC2047 examples
  mailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'
  mailinfo: 'From:' header should be unfold as well
  mailinfo: correctly handle multiline 'Subject:' header

15 years agoMerge branch 'cc/maint-1.6.0-bisect-fix' into maint-1.6.0
Junio C Hamano [Fri, 13 Mar 2009 04:48:26 +0000 (21:48 -0700)]
Merge branch 'cc/maint-1.6.0-bisect-fix' into maint-1.6.0

* cc/maint-1.6.0-bisect-fix:
  bisect: fix another instance of eval'ed string
  bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped

15 years agoMerge branch 'fg/maint-1.6.0-exclude-bq' into maint-1.6.0
Junio C Hamano [Fri, 13 Mar 2009 04:48:07 +0000 (21:48 -0700)]
Merge branch 'fg/maint-1.6.0-exclude-bq' into maint-1.6.0

* fg/maint-1.6.0-exclude-bq:
  Support "\" in non-wildcard exclusion entries

15 years agoMerge branch 'js/maint-1.6.1-filter-branch-submodule' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:46:50 +0000 (21:46 -0700)]
Merge branch 'js/maint-1.6.1-filter-branch-submodule' into maint-1.6.1

* js/maint-1.6.1-filter-branch-submodule:
  filter-branch: do not consider diverging submodules a 'dirty worktree'

15 years agoMerge branch 'gt/maint-1.6.1-utf8-width' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:46:35 +0000 (21:46 -0700)]
Merge branch 'gt/maint-1.6.1-utf8-width' into maint-1.6.1

* gt/maint-1.6.1-utf8-width:
  builtin-blame.c: Use utf8_strwidth for author's names
  utf8: add utf8_strwidth()

15 years agoMerge branch 'js/maint-1.6.1-remote-remove-mirror' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:56 +0000 (21:45 -0700)]
Merge branch 'js/maint-1.6.1-remote-remove-mirror' into maint-1.6.1

* js/maint-1.6.1-remote-remove-mirror:
  builtin-remote: make rm operation safer in mirrored repository
  builtin-remote: make rm() use properly named variable to hold return value

15 years agoMerge branch 'ek/maint-1.6.1-filter-branch-bare' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:21 +0000 (21:45 -0700)]
Merge branch 'ek/maint-1.6.1-filter-branch-bare' into maint-1.6.1

* ek/maint-1.6.1-filter-branch-bare:
  filter-branch: Fix fatal error on bare repositories

15 years agoMerge branch 'jc/maint-1.6.1-add-u-remove-conflicted' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:14 +0000 (21:45 -0700)]
Merge branch 'jc/maint-1.6.1-add-u-remove-conflicted' into maint-1.6.1

* jc/maint-1.6.1-add-u-remove-conflicted:
  add -u: do not fail to resolve a path as deleted

15 years agoMerge branch 'js/maint-1.6.1-rebase-i-submodule' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:02 +0000 (21:45 -0700)]
Merge branch 'js/maint-1.6.1-rebase-i-submodule' into maint-1.6.1

* js/maint-1.6.1-rebase-i-submodule:
  Fix submodule squashing into unrelated commit
  rebase -i squashes submodule changes into unrelated commit

15 years agoMerge branch 'jc/maint-1.6.1-allow-uninteresting-missing' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:44:48 +0000 (21:44 -0700)]
Merge branch 'jc/maint-1.6.1-allow-uninteresting-missing' into maint-1.6.1

* jc/maint-1.6.1-allow-uninteresting-missing:
  revision traversal: allow UNINTERESTING objects to be missing

15 years agoMerge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:44:00 +0000 (21:44 -0700)]
Merge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.1

* ks/maint-1.6.0-mailinfo-folded:
  mailinfo: tests for RFC2047 examples
  mailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'
  mailinfo: 'From:' header should be unfold as well
  mailinfo: correctly handle multiline 'Subject:' header

15 years agoMerge branch 'jk/maint-1.6.1-cleanup-after-exec-failure' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:43:38 +0000 (21:43 -0700)]
Merge branch 'jk/maint-1.6.1-cleanup-after-exec-failure' into maint-1.6.1

* jk/maint-1.6.1-cleanup-after-exec-failure:
  git: use run_command() to execute dashed externals
  run_command(): help callers distinguish errors
  run_command(): handle missing command errors more gracefully
  git: s/run_command/run_builtin/

15 years agoMerge branch 'jc/maint-1.6.0-split-diff-metainfo' into maint-1.6.0
Junio C Hamano [Fri, 13 Mar 2009 03:01:28 +0000 (20:01 -0700)]
Merge branch 'jc/maint-1.6.0-split-diff-metainfo' into maint-1.6.0

* jc/maint-1.6.0-split-diff-metainfo:
  diff.c: output correct index lines for a split diff

15 years agoDocumentation: filter-branch: show --ignore-unmatch in main index-filter example
Thomas Rast [Wed, 11 Mar 2009 23:00:56 +0000 (00:00 +0100)]
Documentation: filter-branch: show --ignore-unmatch in main index-filter example

Rearrange the example usage of

  git filter-branch --index-filter 'git rm --cached ...'

so that --ignore-unmatch is in the main example block.  People keep
stumbling over the (lack of this) option to the point where it is a
FAQ, so we would want to expose the most common usage where it stands
out.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocontrib/difftool: use a separate config namespace for difftool commands
David Aguilar [Mon, 9 Mar 2009 09:12:36 +0000 (02:12 -0700)]
contrib/difftool: use a separate config namespace for difftool commands

Some users have different mergetool and difftool settings, so teach
difftool to read config vars from the difftool.* namespace.  This allows
having distinct configurations for the diff and merge scenarios.

We don't want to force existing users to set new values for no reason
so difftool falls back to existing mergetool config variables when the
difftool equivalents are not defined.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate release notes to 1.6.3
Junio C Hamano [Thu, 12 Mar 2009 04:47:02 +0000 (21:47 -0700)]
Update release notes to 1.6.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosend-email: test --no-thread --in-reply-to combination
Thomas Rast [Wed, 11 Mar 2009 22:40:13 +0000 (23:40 +0100)]
send-email: test --no-thread --in-reply-to combination

3e0c4ff (send-email: respect in-reply-to regardless of threading,
2009-03-01) fixed the handling of the In-Reply-To header when both
--no-thread and --in-reply-to are in effect.  Add a test for it.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Wed, 11 Mar 2009 21:37:26 +0000 (14:37 -0700)]
Merge branch 'maint'

* maint:
  Update draft release notes for 1.6.2.1

15 years agoUpdate draft release notes for 1.6.2.1
Junio C Hamano [Wed, 11 Mar 2009 21:37:15 +0000 (14:37 -0700)]
Update draft release notes for 1.6.2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'js/maint-send-email' into maint
Junio C Hamano [Wed, 11 Mar 2009 21:01:24 +0000 (14:01 -0700)]
Merge branch 'js/maint-send-email' into maint

* js/maint-send-email:
  send-email: don't create temporary compose file until it is needed
  send-email: --suppress-cc improvements
  send-email: handle multiple Cc addresses when reading mbox message
  send-email: allow send-email to run outside a repo

15 years agoMerge branch 'jk/sane-relative-time' into maint
Junio C Hamano [Wed, 11 Mar 2009 20:59:38 +0000 (13:59 -0700)]
Merge branch 'jk/sane-relative-time' into maint

* jk/sane-relative-time:
  never fallback relative times to absolute

15 years agoMerge branch 'jc/maint-add-p-unquote' into maint
Junio C Hamano [Wed, 11 Mar 2009 20:55:49 +0000 (13:55 -0700)]
Merge branch 'jc/maint-add-p-unquote' into maint

* jc/maint-add-p-unquote:
  git-add -i/-p: learn to unwrap C-quoted paths

15 years agoMerge branch 'fg/maint-exclude-bq' into maint
Junio C Hamano [Wed, 11 Mar 2009 20:53:53 +0000 (13:53 -0700)]
Merge branch 'fg/maint-exclude-bq' into maint

* fg/maint-exclude-bq:
  Support "\" in non-wildcard exclusion entries

15 years agoMerge branch 'en/maint-hash-object' into maint
Junio C Hamano [Wed, 11 Mar 2009 20:51:59 +0000 (13:51 -0700)]
Merge branch 'en/maint-hash-object' into maint

* en/maint-hash-object:
  Ensure proper setup of git_dir for git-hash-object

Conflicts:
hash-object.c

15 years agoMerge branch 'mg/maint-submodule-normalize-path'
Junio C Hamano [Wed, 11 Mar 2009 20:50:29 +0000 (13:50 -0700)]
Merge branch 'mg/maint-submodule-normalize-path'

* mg/maint-submodule-normalize-path:
  git submodule: Fix adding of submodules at paths with ./, .. and //
  git submodule: Add test cases for git submodule add

15 years agoMerge branch 'jc/maint-1.6.0-keep-pack'
Junio C Hamano [Wed, 11 Mar 2009 20:49:56 +0000 (13:49 -0700)]
Merge branch 'jc/maint-1.6.0-keep-pack'

* jc/maint-1.6.0-keep-pack:
  is_kept_pack(): final clean-up
  Simplify is_kept_pack()
  Consolidate ignore_packed logic more
  has_sha1_kept_pack(): take "struct rev_info"
  has_sha1_pack(): refactor "pretend these packs do not exist" interface
  git-repack: resist stray environment variable

15 years agoMerge branch 'rs/memmem'
Junio C Hamano [Wed, 11 Mar 2009 20:49:42 +0000 (13:49 -0700)]
Merge branch 'rs/memmem'

* rs/memmem:
  optimize compat/ memmem()
  diffcore-pickaxe: use memmem()

15 years agoMerge branch 'tv/rebase-stat'
Junio C Hamano [Wed, 11 Mar 2009 20:49:11 +0000 (13:49 -0700)]
Merge branch 'tv/rebase-stat'

* tv/rebase-stat:
  git-pull: Allow --stat and --no-stat to be used with --rebase
  git-rebase: Add --stat and --no-stat for producing diffstat on rebase

15 years agoMerge branch 'jk/clone-post-checkout'
Junio C Hamano [Wed, 11 Mar 2009 20:48:31 +0000 (13:48 -0700)]
Merge branch 'jk/clone-post-checkout'

* jk/clone-post-checkout:
  clone: run post-checkout hook when checking out

15 years agoMerge branch 'tr/format-patch-thread'
Junio C Hamano [Wed, 11 Mar 2009 20:48:07 +0000 (13:48 -0700)]
Merge branch 'tr/format-patch-thread'

* tr/format-patch-thread:
  format-patch: support deep threading
  format-patch: thread as reply to cover letter even with in-reply-to
  format-patch: track several references
  format-patch: threading test reactivation

Conflicts:
builtin-log.c

15 years agoMerge branch 'el/blame-date'
Junio C Hamano [Wed, 11 Mar 2009 20:47:12 +0000 (13:47 -0700)]
Merge branch 'el/blame-date'

* el/blame-date:
  Make git blame's date output format configurable, like git log

15 years agoMerge branch 'tr/gcov'
Junio C Hamano [Wed, 11 Mar 2009 20:47:01 +0000 (13:47 -0700)]
Merge branch 'tr/gcov'

* tr/gcov:
  Test git-patch-id
  Test rev-list --parents/--children
  Test log --decorate
  Test fsck a bit harder
  Test log --graph
  Test diff --dirstat functionality
  Test that diff can read from stdin
  Support coverage testing with GCC/gcov

15 years agotest: do not LoadModule log_config_module unconditionally
Johannes Schindelin [Wed, 11 Mar 2009 11:47:06 +0000 (12:47 +0100)]
test: do not LoadModule log_config_module unconditionally

LoadModule directive for log_config_module will not work if the module is
built-in.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorsync transport: allow local paths, and fix tests
Johannes Schindelin [Mon, 9 Mar 2009 18:44:55 +0000 (19:44 +0100)]
rsync transport: allow local paths, and fix tests

Earlier, the rsync tests were disabled by default, as they needed a
running rsyncd daemon.  This was only due to the limitation that our
rsync transport only allowed full URLs of the form

rsync://<host>/<path>

Relaxing the URLs to allow

rsync:<path>

permitted the change in the tests to run whenever rsync is available,
without requiring a fully configured and running rsyncd.

While at it, the tests were fixed so that they run in directories with a
space in their name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-instaweb: fix lighttpd configuration on cygwin
Ramsay Jones [Mon, 9 Mar 2009 18:31:55 +0000 (18:31 +0000)]
git-instaweb: fix lighttpd configuration on cygwin

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Tested-by: Pascal Obry <pascal@obry.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoInclude log_config module in apache.conf
Daniel Barkalow [Wed, 11 Mar 2009 03:23:45 +0000 (23:23 -0400)]
Include log_config module in apache.conf

The log_config module is needed for at least some versions of apache to
support the LogFormat directive.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoTypo and language fixes for git-checkout.txt
Michael J Gruber [Tue, 10 Mar 2009 15:06:30 +0000 (16:06 +0100)]
Typo and language fixes for git-checkout.txt

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoconnect.c: remove a few globals by using git_config callback data
Erik Faye-Lund [Wed, 11 Mar 2009 02:38:12 +0000 (02:38 +0000)]
connect.c: remove a few globals by using git_config callback data

Since ef90d6d (Provide git_config with a callback-data parameter,
2008-05-14), git_config() takes a callback data pointer that can be
used to pass extra parameters to the parsing function.  The codepath
to parse configuration variables related to git proxy predates this
facility and used a pair of file scope static variables instead.

This patch removes the need for these global variables by passing the
name of the host we are trying to access as the callback data.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge git://git.bogomips.org/git-svn
Junio C Hamano [Tue, 10 Mar 2009 01:38:18 +0000 (18:38 -0700)]
Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
  git-svn: support intermediate paths when matching tags/branches

15 years agoparseopt: prevent KEEP_UNKNOWN and STOP_AT_NON_OPTION from being used together
René Scharfe [Mon, 9 Mar 2009 20:57:38 +0000 (21:57 +0100)]
parseopt: prevent KEEP_UNKNOWN and STOP_AT_NON_OPTION from being used together

As suggested by Junio, disallow the flags PARSE_OPT_KEEP_UNKNOWN and
PARSE_OPT_STOP_AT_NON_OPTION to be turned on at the same time, as a
value of an unknown option could be mistakenly classified as a
non-option, stopping the parser early.  E.g.:

git cmd --known --unknown value arg0 arg1

The parser should have stopped at "arg0", but it already stops at
"value".

This patch makes parse_options() die if the two flags are used in
combination.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoparseopt: document KEEP_ARGV0, KEEP_UNKNOWN, NO_INTERNAL_HELP
René Scharfe [Mon, 9 Mar 2009 20:26:56 +0000 (21:26 +0100)]
parseopt: document KEEP_ARGV0, KEEP_UNKNOWN, NO_INTERNAL_HELP

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: support intermediate paths when matching tags/branches
Michael Lai [Mon, 9 Mar 2009 18:45:47 +0000 (11:45 -0700)]
git-svn: support intermediate paths when matching tags/branches

For repositories laid out like the following:

[svn-remote "svn"]
      url = http://foo.com/svn/repos/bar
      fetch = myproject/trunk:refs/remotes/trunk
      branches = bar/myproject/branches/*:refs/remotes/*
      tags = bar/myproject/tags/*:refs/remotes/tags/*

The "bar" component above is considered the intermediate path
and was not handled correctly.

Signed-off-by: Michael Lai <myllai@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
15 years agogrep: cast printf %.*s "precision" argument explicitly to int
Junio C Hamano [Mon, 9 Mar 2009 01:22:44 +0000 (18:22 -0700)]
grep: cast printf %.*s "precision" argument explicitly to int

On some systems, regoff_t that is the type of rm_so/rm_eo members are
wider than int; %.*s precision specifier expects an int, so use an explicit
cast.

A breakage reported on Darwin by Brian Gernhardt should be fixed with
this patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: Set compiler switch for USE_NSEC
Brian Gernhardt [Sun, 8 Mar 2009 21:22:51 +0000 (17:22 -0400)]
Makefile: Set compiler switch for USE_NSEC

The comments indicated that setting a Makefile variable USE_NSEC would
enable the code for sub-second [cm]times.  However, the Makefile
variable was never turned into a compiler switch so the code was never
enabled.  This patch allows USE_NSEC to be noticed by the compiler.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoCreate USE_ST_TIMESPEC and turn it on for Darwin
Brian Gernhardt [Sun, 8 Mar 2009 20:04:28 +0000 (16:04 -0400)]
Create USE_ST_TIMESPEC and turn it on for Darwin

Not all OSes use st_ctim and st_mtim in their struct stat.  In
particular, it appears that OS X uses st_*timespec instead.  So add a
Makefile variable and #define called USE_ST_TIMESPEC to switch the
USE_NSEC defines to use st_*timespec.

This also turns it on by default for OS X (Darwin) machines.  Likely
this is a sane default for other BSD kernels as well, but I don't have
any to test that assumption on.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoNot all systems use st_[cm]tim field for ns resolution file timestamp
Junio C Hamano [Sun, 8 Mar 2009 20:51:33 +0000 (13:51 -0700)]
Not all systems use st_[cm]tim field for ns resolution file timestamp

Some codepaths do not still use the ST_[CM]TIME_NSEC() pair of macros
introduced by the previous commit but assumes all systems use st_mtim
and st_ctim fields in "struct stat" to record nanosecond resolution part
of the file timestamps.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoarchive: use parseopt for local-only options
René Scharfe [Sun, 8 Mar 2009 18:21:53 +0000 (19:21 +0100)]
archive: use parseopt for local-only options

Replace the hand-rolled parsers that find and remove --remote and --exec
by a parseopt parser that also handles --output.

All three options only have a meaning if no remote server is used or on
the local side.  They must be rejected by upload-archive and should not
be sent to the server by archive.

We can't use a single parser for both remote and local side because the
remote end possibly understands a different set of options than the
local side.  A local parser would then wrongly accuse options valid on
the other side as being incorrect.

This patch implements a very forgiving parser that understands only the
three options mentioned above.  All others are passed to the normal,
complete parser in archive.c (running either locally in archive, or
remotely in upload-archive).  This normal parser definition contains
dummy entries for the three options, in order for them to appear in the
help screen.

The parseopt parser allows multiple occurrences of --remote and --exec
unlike the previous one; the one specified last wins.  This looseness
is acceptable, I think.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoparseopt: make usage optional
René Scharfe [Sun, 8 Mar 2009 18:16:58 +0000 (19:16 +0100)]
parseopt: make usage optional

Allow usagestr to be NULL and don't display any help screen in
this case.  This is useful to implement incremental parsers.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoparseopt: add PARSE_OPT_NO_INTERNAL_HELP
René Scharfe [Sun, 8 Mar 2009 18:15:08 +0000 (19:15 +0100)]
parseopt: add PARSE_OPT_NO_INTERNAL_HELP

Add a parseopt flag, PARSE_OPT_NO_INTERNAL_HELP, that turns off internal
handling of -h, --help and --help-all.  This allows the implementation
of custom help option handlers or incremental parsers.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoparseopt: add PARSE_OPT_KEEP_UNKNOWN
René Scharfe [Sun, 8 Mar 2009 18:12:47 +0000 (19:12 +0100)]
parseopt: add PARSE_OPT_KEEP_UNKNOWN

Add a parseopt flag, PARSE_OPT_KEEP_UNKNOWN, that can be used to keep
unknown options in argv, similar to the existing KEEP flags.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote.c: no "commented out" code, please
Junio C Hamano [Sun, 8 Mar 2009 08:10:33 +0000 (00:10 -0800)]
builtin-remote.c: no "commented out" code, please

And especially do not use // comment.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Sun, 8 Mar 2009 06:34:13 +0000 (22:34 -0800)]
Merge branch 'maint'

* maint:
  builtin-revert.c: release index lock when cherry-picking an empty commit
  document config --bool-or-int
  t1300: use test_must_fail as appropriate
  cleanup: add isascii()
  Documentation: fix badly indented paragraphs in "--bisect-all" description

15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Sun, 8 Mar 2009 05:00:27 +0000 (21:00 -0800)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  builtin-revert.c: release index lock when cherry-picking an empty commit

15 years agohttp.c: use strbuf API in quote_ref_url
Tay Ray Chuan [Sat, 7 Mar 2009 16:47:21 +0000 (00:47 +0800)]
http.c: use strbuf API in quote_ref_url

In addition, ''quote_ref_url'' inserts a slash between the base URL and
remote ref path only if needed. Previously, this insertion wasn't
contingent on the lack of a separating slash.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMove local variables to narrower scopes
Benjamin Kramer [Sat, 7 Mar 2009 20:02:26 +0000 (21:02 +0100)]
Move local variables to narrower scopes

These weren't used outside and can be safely moved

Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRemove unused function scope local variables
Benjamin Kramer [Sat, 7 Mar 2009 20:02:10 +0000 (21:02 +0100)]
Remove unused function scope local variables

These variables were unused and can be removed safely:

  builtin-clone.c::cmd_clone(): use_local_hardlinks, use_separate_remote
  builtin-fetch-pack.c::find_common(): len
  builtin-remote.c::mv(): symref
  diff.c::show_stats():show_stats(): total
  diffcore-break.c::should_break(): base_size
  fast-import.c::validate_raw_date(): date, sign
  fsck.c::fsck_tree(): o_sha1, sha1
  xdiff-interface.c::parse_num(): read_some

Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMinGW: fix diff --no-index /dev/null ...
Johannes Schindelin [Sat, 7 Mar 2009 15:51:33 +0000 (16:51 +0100)]
MinGW: fix diff --no-index /dev/null ...

When launching "diff --no-index" with a parameter "/dev/null", the MSys
bash converts the "/dev/null" to a "nul", which usually makes sense.  But

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-p4: remove tabs from usermap file
Pete Wyckoff [Fri, 27 Feb 2009 18:53:59 +0000 (10:53 -0800)]
git-p4: remove tabs from usermap file

Some users have tabs in their names, oddly enough.  This
causes problems when loading the usercache from disk,
as split separates the fields on the wrong tabs.  When
fast-import's parse_ident() tries to parse the committer
field, it is unhappy about the unbalanced <..> angle brackets.

It is easy enough to convert the tabs to single spaces.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd an (optional, since expensive) test for >2gb clones
Johannes Schindelin [Fri, 6 Mar 2009 09:48:53 +0000 (10:48 +0100)]
Add an (optional, since expensive) test for >2gb clones

Define GIT_TEST_CLONE_2GB=t if you want the test not to be skipped.

The test works by constructing a repository larger than 2gb, and then
cloning it.

The repository is forced larger than 2gb by setting compression and
delta depth to zero, and then adding just enough unique objects of
a given size.

The objects consist of a running decimal number in ASCII, padded by
spaces.  Should that break in the future, e.g. when pack v4 becomes
default, there is a commented-out call to test-genrandom which can be
substituted, but that uses more cycles than the current method.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRecord ns-timestamps if possible, but do not use it without USE_NSEC
Kjetil Barvik [Wed, 4 Mar 2009 17:47:40 +0000 (18:47 +0100)]
Record ns-timestamps if possible, but do not use it without USE_NSEC

Traditionally, the lack of USE_NSEC meant "do not record nor use the
nanosecond resolution part of the file timestamps".  To avoid problems on
filesystems that lose the ns part when the metadata is flushed to the disk
and then later read back in, disabling USE_NSEC has been a good idea in
general.

If you are on a filesystem without such an issue, it does not hurt to read
and store them in the cached stat data in the index entries even if your
git is compiled without USE_NSEC.  The index left with such a version of
git can be read by git compiled with USE_NSEC and it can make use of the
nanosecond part to optimize the check to see if the path on the filesystem
hsa been modified since we last looked at.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: teach fetch, pull, and push to complete their options
Jay Soffian [Fri, 6 Mar 2009 04:39:33 +0000 (23:39 -0500)]
bash completion: teach fetch, pull, and push to complete their options

fetch, pull, and push didn't know their options. They do now. merge's
options are factored into a variable so they can be shared between
_git_merge and _git_pull

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: refactor --strategy completion
Jay Soffian [Fri, 6 Mar 2009 16:30:44 +0000 (11:30 -0500)]
bash completion: refactor --strategy completion

The code to complete --strategy was duplicated between _git_rebase and
_git_merge, and is about to gain a third caller (_git_pull). This patch
factors it into its own function.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: fix completion issues with fetch, pull, and push
Jay Soffian [Fri, 6 Mar 2009 04:39:31 +0000 (23:39 -0500)]
bash completion: fix completion issues with fetch, pull, and push

Sverre Rabbelier noticed a completion issue with push:

 $ git push ori<tab>
 git push origin

 $ git push -f ori<tab>
 git push -f origin/

Markus Heidelberg pointed out that the issue extends to fetch and pull.

The reason is that the current code naively assumes that if
COMP_CWORD=2, it should complete a remote name, otherwise it should
complete a refspec. This assumption fails if there are any --options.

This patch fixes that issue by instead scanning COMP_CWORDS to see if
the remote has been completed yet (we now assume the first non-dashed
argument is the remote). The new logic is factored into a function,
shared by fetch, pull, and push.

The new function also properly handles '.' as the remote.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoBrown paper bag fix for MinGW 64-bit stat
Johannes Schindelin [Sat, 7 Mar 2009 14:37:18 +0000 (15:37 +0100)]
Brown paper bag fix for MinGW 64-bit stat

When overriding the identifier "stat" so that "struct stat" will be
substituted with "struct _stati64" everywhere, I tried to fix the calls
to the _function_ stat(), too, but I forgot to change the earlier
attempt "stat64" to "_stati64" there.

So, the stat() calls were overridden by calls to _stati64() instead.

Unfortunately, there is a function _stati64() so that I missed that
calls to stat() were not actually overridden by calls to mingw_lstat(),
but t4200-rerere.sh showed the error.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-revert.c: release index lock when cherry-picking an empty commit
Chris Johnsen [Sat, 7 Mar 2009 09:30:51 +0000 (03:30 -0600)]
builtin-revert.c: release index lock when cherry-picking an empty commit

When a cherry-pick of an empty commit is done, release the lock
held on the index.

The fix is the same as was applied to similar code in 4271666046.

Signed-off-by: Chris Johnsen <chris_johnsen@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: add support for coloring with external greps
René Scharfe [Sat, 7 Mar 2009 12:34:46 +0000 (13:34 +0100)]
grep: add support for coloring with external greps

Add the config variable color.grep.external, which can be used to
switch on coloring of external greps.  To enable auto coloring with
GNU grep, one needs to set color.grep.external to --color=always to
defeat the pager started by git grep.  The value of the config
variable will be passed to the external grep only if it would
colorize internal grep's output, so automatic terminal detected
works.  The default is to not pass any option, because the external
grep command could be a program without color support.

Also set the environment variables GREP_COLOR and GREP_COLORS to
pass the configured color for matches to the external grep.  This
works with GNU grep; other variables could be added as needed.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: color patterns in output
René Scharfe [Sat, 7 Mar 2009 12:32:32 +0000 (13:32 +0100)]
grep: color patterns in output

Coloring matches makes them easier to spot in the output.

Add two options and two parameters: color.grep (to turn coloring on
or off), color.grep.match (to set the color of matches), --color
and --no-color (to turn coloring on or off, respectively).

The output of external greps is not changed.

This patch is based on earlier ones by Nguyễn Thái Ngọc Duy and
Thiago Alves.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: add pmatch and eflags arguments to match_one_pattern()
René Scharfe [Sat, 7 Mar 2009 12:30:27 +0000 (13:30 +0100)]
grep: add pmatch and eflags arguments to match_one_pattern()

Push pmatch and eflags to the callers of match_one_pattern(), which
allows them to specify regex execution flags and to get the location
of a match.

Since we only use the first element of the matches array and aren't
interested in submatches, no provision is made for callers to
provide a larger array.

eflags are ignored for fixed patterns, but that's OK, since they
only have a meaning in connection with regular expressions
containing ^ or $.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: remove grep_opt argument from match_expr_eval()
René Scharfe [Sat, 7 Mar 2009 12:28:40 +0000 (13:28 +0100)]
grep: remove grep_opt argument from match_expr_eval()

The only use of the struct grep_opt argument of match_expr_eval()
is to pass the option word_regexp to match_one_pattern().  By adding
a pattern flag for it we can reduce the number of function arguments
of these two functions, as a cleanup and preparation for adding more
in the next patch.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: micro-optimize hit collection for AND nodes
René Scharfe [Sat, 7 Mar 2009 12:27:15 +0000 (13:27 +0100)]
grep: micro-optimize hit collection for AND nodes

In addition to returning if an expression matches a line,
match_expr_eval() updates the expression's hit flag if the parameter
collect_hits is set.  It never sets collect_hits for children of AND
nodes, though, so their hit flag will never be updated.  Because of
that we can return early if the first child didn't match, no matter
if collect_hits is set or not.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodocument config --bool-or-int
Jeff King [Sat, 7 Mar 2009 17:14:06 +0000 (12:14 -0500)]
document config --bool-or-int

The documentation is just a pointer to the --bool and --int
options, but it makes sense to at least mention that it
exists.

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