gitweb.git
Reimplement async procedures using pthreadsJohannes Sixt Sat, 6 Mar 2010 15:40:42 +0000 (16:40 +0100)

Reimplement async procedures using pthreads

On Windows, async procedures have always been run in threads, and the
implementation used Windows specific APIs. Rewrite the code to use pthreads.

A new configuration option is introduced so that the threaded implementation
can also be used on POSIX systems. Since this option is intended only as
playground on POSIX, but is mandatory on Windows, the option is not
documented.

One detail is that on POSIX it is necessary to set FD_CLOEXEC on the pipe
handles. On Windows, this is not needed because pipe handles are not
inherited to child processes, and the new calls to set_cloexec() are
effectively no-ops.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Windows: more pthreads functionsJohannes Sixt Sat, 6 Mar 2010 15:40:41 +0000 (16:40 +0100)

Windows: more pthreads functions

This adds:

pthread_self
pthread_equal
pthread_exit
pthread_key_create
pthread_setspecific
pthread_getspecific

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix signature of fcntl() compatibility dummyJohannes Sixt Sat, 6 Mar 2010 15:40:40 +0000 (16:40 +0100)

Fix signature of fcntl() compatibility dummy

Obviously, this function was never called with two arguments in Windows
code sections, but this will be the case in a subsequent patch.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Make report() from usage.c public as vreportf() and... Johannes Sixt Sat, 6 Mar 2010 15:40:39 +0000 (16:40 +0100)

Make report() from usage.c public as vreportf() and use it.

There exist already a number of static functions named 'report', therefore,
the function name was changed.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Modernize t5530-upload-pack-error.Johannes Sixt Sat, 6 Mar 2010 15:40:38 +0000 (16:40 +0100)

Modernize t5530-upload-pack-error.

Some tests did not use test_must_fail.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Fri, 5 Mar 2010 06:39:54 +0000 (22:39 -0800)

Merge branch 'maint'

* maint:
Update draft release notes to 1.7.0.2
Remove extra '-' from git-am(1)

Update draft release notes to 1.7.0.2Junio C Hamano Fri, 5 Mar 2010 06:39:38 +0000 (22:39 -0800)

Update draft release notes to 1.7.0.2

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

Merge branch 'jn/gitweb-config-error-die' into maintJunio C Hamano Fri, 5 Mar 2010 06:27:12 +0000 (22:27 -0800)

Merge branch 'jn/gitweb-config-error-die' into maint

* jn/gitweb-config-error-die:
gitweb: Die if there are parsing errors in config file

Merge branch 'jn/maint-fix-pager' into maintJunio C Hamano Fri, 5 Mar 2010 06:27:04 +0000 (22:27 -0800)

Merge branch 'jn/maint-fix-pager' into maint

* jn/maint-fix-pager:
tests: Fix race condition in t7006-pager
t7006-pager: if stdout is not a terminal, make a new one
tests: Add tests for automatic use of pager
am: Fix launching of pager
git svn: Fix launching of pager
git.1: Clarify the behavior of the --paginate option
Make 'git var GIT_PAGER' always print the configured pager
Fix 'git var' usage synopsis

Merge branch 'tr/maint-cherry-pick-list' into maintJunio C Hamano Fri, 5 Mar 2010 06:26:44 +0000 (22:26 -0800)

Merge branch 'tr/maint-cherry-pick-list' into maint

* tr/maint-cherry-pick-list:
cherry_pick_list: quit early if one side is empty

Merge branch 'ld/maint-diff-quiet-w' into maintJunio C Hamano Fri, 5 Mar 2010 06:26:39 +0000 (22:26 -0800)

Merge branch 'ld/maint-diff-quiet-w' into maint

* ld/maint-diff-quiet-w:
git-diff: add a test for git diff --quiet -w
git diff --quiet -w: check and report the status

Merge branch 'rs/optim-text-wrap' into maintJunio C Hamano Fri, 5 Mar 2010 06:26:33 +0000 (22:26 -0800)

Merge branch 'rs/optim-text-wrap' into maint

* rs/optim-text-wrap:
utf8.c: speculatively assume utf-8 in strbuf_add_wrapped_text()
utf8.c: remove strbuf_write()
utf8.c: remove print_spaces()
utf8.c: remove print_wrapped_text()

Merge branch 'dp/read-not-mmap-small-loose-object'... Junio C Hamano Fri, 5 Mar 2010 06:26:17 +0000 (22:26 -0800)

Merge branch 'dp/read-not-mmap-small-loose-object' into maint

* dp/read-not-mmap-small-loose-object:
hash-object: don't use mmap() for small files

Merge branch 'np/compress-loose-object-memsave' into... Junio C Hamano Fri, 5 Mar 2010 06:26:05 +0000 (22:26 -0800)

Merge branch 'np/compress-loose-object-memsave' into maint

* np/compress-loose-object-memsave:
sha1_file: be paranoid when creating loose objects
sha1_file: don't malloc the whole compressed result when writing out objects

Merge branch 'jc/maint-status-preload' into maintJunio C Hamano Fri, 5 Mar 2010 06:25:45 +0000 (22:25 -0800)

Merge branch 'jc/maint-status-preload' into maint

* jc/maint-status-preload:
status: preload index to optimize lstat(2) calls

Merge branch 'gf/maint-sh-setup-nongit-ok' into maintJunio C Hamano Fri, 5 Mar 2010 06:25:37 +0000 (22:25 -0800)

Merge branch 'gf/maint-sh-setup-nongit-ok' into maint

* gf/maint-sh-setup-nongit-ok:
require_work_tree broken with NONGIT_OK

Merge branch 'cc/maint-bisect-paths' into maintJunio C Hamano Fri, 5 Mar 2010 06:25:23 +0000 (22:25 -0800)

Merge branch 'cc/maint-bisect-paths' into maint

* cc/maint-bisect-paths:
bisect: error out when passing bad path parameters

Merge branch 'maint-1.6.6' into maintJunio C Hamano Fri, 5 Mar 2010 06:24:25 +0000 (22:24 -0800)

Merge branch 'maint-1.6.6' into maint

* maint-1.6.6:
Remove extra '-' from git-am(1)

Merge branch 'maint-1.6.5' into maint-1.6.6Junio C Hamano Fri, 5 Mar 2010 06:24:19 +0000 (22:24 -0800)

Merge branch 'maint-1.6.5' into maint-1.6.6

* maint-1.6.5:
Remove extra '-' from git-am(1)

Remove extra '-' from git-am(1)Michal Sojka Thu, 4 Mar 2010 12:08:28 +0000 (13:08 +0100)

Remove extra '-' from git-am(1)

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t9119-git-svn-info.sh: test with svn 1.6.* as wellMichael J Gruber Wed, 3 Mar 2010 20:34:32 +0000 (21:34 +0100)

t9119-git-svn-info.sh: test with svn 1.6.* as well

All tests in t9119 were disabled for subversion versions other than
1.[45].*. Make the test script run with subversion 1.[456].*.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Eric Wong <normalperson@yhbt.net>

git-svn: req_svn when neededMichael J Gruber Wed, 3 Mar 2010 20:34:31 +0000 (21:34 +0100)

git-svn: req_svn when needed

The delayed loading of SVN missed a place where SVN::Core is used. Make
sure to load the package before trying to use it.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Eric Wong <normalperson@yhbt.net>

Merge branch 'maint'Junio C Hamano Wed, 3 Mar 2010 22:56:13 +0000 (14:56 -0800)

Merge branch 'maint'

* maint:
Start preparing for 1.7.0.2

Conflicts:
RelNotes

Merge branch 'jh/maint-submodule-status-in-void' (early... Junio C Hamano Wed, 3 Mar 2010 22:50:22 +0000 (14:50 -0800)

Merge branch 'jh/maint-submodule-status-in-void' (early part)

* 'jh/maint-submodule-status-in-void' (early part):
submodule summary: do not shift a non-existent positional variable

submodule summary: do not shift a non-existent position... Jeff King Wed, 3 Mar 2010 22:19:09 +0000 (14:19 -0800)

submodule summary: do not shift a non-existent positional variable

When "git submodule summary" is run without any argument, we default to
compare the state of index with the HEAD, but tried to shift out $1 that
does not exist (and worse yet, we didn't use it).

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

Start preparing for 1.7.0.2Junio C Hamano Wed, 3 Mar 2010 07:11:36 +0000 (23:11 -0800)

Start preparing for 1.7.0.2

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

Merge branch 'tc/maint-transport-ls-remote-with-void... Junio C Hamano Wed, 3 Mar 2010 06:55:22 +0000 (22:55 -0800)

Merge branch 'tc/maint-transport-ls-remote-with-void' into maint

* tc/maint-transport-ls-remote-with-void:
transport: add got_remote_refs flag

Merge branch 'hm/maint-imap-send-crlf' into maintJunio C Hamano Wed, 3 Mar 2010 06:55:03 +0000 (22:55 -0800)

Merge branch 'hm/maint-imap-send-crlf' into maint

* hm/maint-imap-send-crlf:
git-imap-send: Convert LF to CRLF before storing patch to draft box

Merge branch 'sp/maint-push-sideband' into maintJunio C Hamano Wed, 3 Mar 2010 06:54:50 +0000 (22:54 -0800)

Merge branch 'sp/maint-push-sideband' into maint

* sp/maint-push-sideband:
receive-pack: Send internal errors over side-band #2
t5401: Use a bare repository for the remote peer
receive-pack: Send hook output over side band #2
receive-pack: Wrap status reports inside side-band-64k
receive-pack: Refactor how capabilities are shown to the client
send-pack: demultiplex a sideband stream with status data
run-command: support custom fd-set in async
run-command: Allow stderr to be a caller supplied pipe

Conflicts:
builtin-receive-pack.c
run-command.c
t/t5401-update-hooks.sh

Merge branch 'jc/maint-fix-test-perm' into maintJunio C Hamano Wed, 3 Mar 2010 06:38:02 +0000 (22:38 -0800)

Merge branch 'jc/maint-fix-test-perm' into maint

* jc/maint-fix-test-perm:
lib-patch-mode.sh: Fix permission
t6000lib: Fix permission

Merge branch 'np/fast-import-idx-v2' into maintJunio C Hamano Wed, 3 Mar 2010 06:28:49 +0000 (22:28 -0800)

Merge branch 'np/fast-import-idx-v2' into maint

* np/fast-import-idx-v2:
fast-import: use the diff_delta() max_delta_size argument
fast-import: honor pack.indexversion and pack.packsizelimit config vars
fast-import: make default pack size unlimited
fast-import: use write_idx_file() instead of custom code
fast-import: use sha1write() for pack data
fast-import: start using struct pack_idx_entry

Merge branch 'maint'Junio C Hamano Tue, 2 Mar 2010 20:44:16 +0000 (12:44 -0800)

Merge branch 'maint'

* maint:
gitweb: Fix project-specific feature override behavior
gitweb multiple project roots documentation

Merge branch 'jn/maint-fix-pager'Junio C Hamano Tue, 2 Mar 2010 20:44:11 +0000 (12:44 -0800)

Merge branch 'jn/maint-fix-pager'

* jn/maint-fix-pager:
tests: Fix race condition in t7006-pager
t7006-pager: if stdout is not a terminal, make a new one
tests: Add tests for automatic use of pager
am: Fix launching of pager
git svn: Fix launching of pager
git.1: Clarify the behavior of the --paginate option
Make 'git var GIT_PAGER' always print the configured pager
Fix 'git var' usage synopsis

Merge branch 'ml/encode-header-refactor'Junio C Hamano Tue, 2 Mar 2010 20:44:11 +0000 (12:44 -0800)

Merge branch 'ml/encode-header-refactor'

* ml/encode-header-refactor:
move encode_in_pack_object_header() to a better place
refactor duplicated encode_header in pack-objects and fast-import

Merge branch 'jn/gitweb-config-error-die'Junio C Hamano Tue, 2 Mar 2010 20:44:11 +0000 (12:44 -0800)

Merge branch 'jn/gitweb-config-error-die'

* jn/gitweb-config-error-die:
gitweb: Die if there are parsing errors in config file

Merge branch 'jc/for-each-ref'Junio C Hamano Tue, 2 Mar 2010 20:44:10 +0000 (12:44 -0800)

Merge branch 'jc/for-each-ref'

* jc/for-each-ref:
for-each-ref --format='%(flag)'
for-each-ref --format='%(symref) %(symref:short)'
builtin-for-each-ref.c: check if we need to peel onion while parsing the format
builtin-for-each-ref.c: comment fixes

Merge branch 'ld/maint-diff-quiet-w'Junio C Hamano Tue, 2 Mar 2010 20:44:10 +0000 (12:44 -0800)

Merge branch 'ld/maint-diff-quiet-w'

* ld/maint-diff-quiet-w:
git-diff: add a test for git diff --quiet -w
git diff --quiet -w: check and report the status

Merge branch 'tr/maint-cherry-pick-list'Junio C Hamano Tue, 2 Mar 2010 20:44:10 +0000 (12:44 -0800)

Merge branch 'tr/maint-cherry-pick-list'

* tr/maint-cherry-pick-list:
cherry_pick_list: quit early if one side is empty

Merge branch 'rs/optim-text-wrap'Junio C Hamano Tue, 2 Mar 2010 20:44:10 +0000 (12:44 -0800)

Merge branch 'rs/optim-text-wrap'

* rs/optim-text-wrap:
utf8.c: speculatively assume utf-8 in strbuf_add_wrapped_text()
utf8.c: remove strbuf_write()
utf8.c: remove print_spaces()
utf8.c: remove print_wrapped_text()

Merge branch 'ml/send-pack-transport-refactor'Junio C Hamano Tue, 2 Mar 2010 20:44:09 +0000 (12:44 -0800)

Merge branch 'ml/send-pack-transport-refactor'

* ml/send-pack-transport-refactor:
refactor duplicated code in builtin-send-pack.c and transport.c

Merge branch 'ml/fill-mm-refactor'Junio C Hamano Tue, 2 Mar 2010 20:44:09 +0000 (12:44 -0800)

Merge branch 'ml/fill-mm-refactor'

* ml/fill-mm-refactor:
refactor duplicated fill_mm() in checkout and merge-recursive

Merge branch 'ml/connect-refactor'Junio C Hamano Tue, 2 Mar 2010 20:44:09 +0000 (12:44 -0800)

Merge branch 'ml/connect-refactor'

* ml/connect-refactor:
connect.c: move duplicated code to a new function 'get_host_and_port'

Merge branch 'np/compress-loose-object-memsave'Junio C Hamano Tue, 2 Mar 2010 20:44:09 +0000 (12:44 -0800)

Merge branch 'np/compress-loose-object-memsave'

* np/compress-loose-object-memsave:
sha1_file: be paranoid when creating loose objects
sha1_file: don't malloc the whole compressed result when writing out objects

Merge branch 'dp/read-not-mmap-small-loose-object'Junio C Hamano Tue, 2 Mar 2010 20:44:08 +0000 (12:44 -0800)

Merge branch 'dp/read-not-mmap-small-loose-object'

* dp/read-not-mmap-small-loose-object:
hash-object: don't use mmap() for small files

Merge branch 'jn/makedepend'Junio C Hamano Tue, 2 Mar 2010 20:44:08 +0000 (12:44 -0800)

Merge branch 'jn/makedepend'

* jn/makedepend:
Makefile: clarify definition of TEST_OBJS
Makefile: always remove .depend directories on 'make clean'
Makefile: tuck away generated makefile fragments in .depend
Teach Makefile to check header dependencies
Makefile: list standalone program object files in PROGRAM_OBJS
Makefile: lazily compute header dependencies
Makefile: list generated object files in OBJECTS
Makefile: disable default implicit rules
Makefile: rearrange dependency rules
Makefile: transport.o depends on branch.h now
Makefile: drop dependency on $(wildcard */*.h)
Makefile: clean up http-walker.o dependency rules
Makefile: remove wt-status.h from LIB_H
Makefile: make sure test helpers are rebuilt when headers change
Makefile: add missing header file dependencies

Conflicts:
Makefile

Merge branch 'jc/maint-status-preload'Junio C Hamano Tue, 2 Mar 2010 20:44:07 +0000 (12:44 -0800)

Merge branch 'jc/maint-status-preload'

* jc/maint-status-preload:
status: preload index to optimize lstat(2) calls

Merge branch 'gf/maint-sh-setup-nongit-ok'Junio C Hamano Tue, 2 Mar 2010 20:44:07 +0000 (12:44 -0800)

Merge branch 'gf/maint-sh-setup-nongit-ok'

* gf/maint-sh-setup-nongit-ok:
require_work_tree broken with NONGIT_OK

Merge branch 'jh/maint-submodule-status-in-void'Junio C Hamano Tue, 2 Mar 2010 20:44:07 +0000 (12:44 -0800)

Merge branch 'jh/maint-submodule-status-in-void'

* jh/maint-submodule-status-in-void:
submodule summary: Don't barf when invoked in an empty repo

Merge branch 'hm/imap-send-cram-md5'Junio C Hamano Tue, 2 Mar 2010 20:44:06 +0000 (12:44 -0800)

Merge branch 'hm/imap-send-cram-md5'

* hm/imap-send-cram-md5:
imap-send: support CRAM-MD5 authentication

Merge branch 'ml/color-when'Junio C Hamano Tue, 2 Mar 2010 20:44:06 +0000 (12:44 -0800)

Merge branch 'ml/color-when'

* ml/color-when:
Add an optional argument for --color options

Merge branch 'ac/cvsimport-revision-mapping'Junio C Hamano Tue, 2 Mar 2010 20:44:06 +0000 (12:44 -0800)

Merge branch 'ac/cvsimport-revision-mapping'

* ac/cvsimport-revision-mapping:
cvsimport: new -R option: generate .git/cvs-revisions mapping

Merge branch 'jc/grep-author-all-match-implicit'Junio C Hamano Tue, 2 Mar 2010 20:44:06 +0000 (12:44 -0800)

Merge branch 'jc/grep-author-all-match-implicit'

* jc/grep-author-all-match-implicit:
"log --author=me --grep=it" should find intersection, not union

fallback SSH_ASKPASS when GIT_ASKPASS not setFrank Li Tue, 2 Mar 2010 11:52:11 +0000 (19:52 +0800)

fallback SSH_ASKPASS when GIT_ASKPASS not set

If GIT_ASKPASS is not set and SSH_ASKPASS set, GIT_ASKPASS will
use SSH_ASKPASS.

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: Fix project-specific feature override behaviorJakub Narebski Mon, 1 Mar 2010 21:51:34 +0000 (22:51 +0100)

gitweb: Fix project-specific feature override behavior

This commit fixes a bug in processing project-specific override in
a situation when there is no project, e.g. for the projects list page.

When 'snapshot' feature had project specific config override enabled
by putting
$feature{'snapshot'}{'override'} = 1;

(or equivalent) in $GITWEB_CONFIG, and when viewing toplevel gitweb
page, which means the projects list page (to be more exact this
happens for any project-less action), gitweb would put the following
Perl warnings in error log:

gitweb.cgi: Use of uninitialized value $git_dir in concatenation (.) or string at gitweb.cgi line 2065.
fatal: error processing config file(s)
gitweb.cgi: Use of uninitialized value $git_dir in concatenation (.) or string at gitweb.cgi line 2221.
gitweb.cgi: Use of uninitialized value $git_dir in concatenation (.) or string at gitweb.cgi line 2218.

The problem is in the following fragment of code:

# path to the current git repository
our $git_dir;
$git_dir = "$projectroot/$project" if $project;

# list of supported snapshot formats
our @snapshot_fmts = gitweb_get_feature('snapshot');
@snapshot_fmts = filter_snapshot_fmts(@snapshot_fmts);

For the toplevel gitweb page, which is the list of projects, $project is not
defined, therefore neither is $git_dir. gitweb_get_feature() subroutine
calls git_get_project_config() if project specific override is turned
on... but we don't have project here.

Those errors mentioned above occur in the following fragment of code in
git_get_project_config():

# get config
if (!defined $config_file ||
$config_file ne "$git_dir/config") {
%config = git_parse_project_config('gitweb');
$config_file = "$git_dir/config";
}

git_parse_project_config() calls git_cmd() which has '--git-dir='.$git_dir

There are (at least) three possible solutions:
1. Harden gitweb_get_feature() so that it doesn't call
git_get_project_config() if $project (and therefore $git_dir) is not
defined; there is no project for project specific config.
2. Harden git_get_project_config() like you did in your fix, returning early
if $git_dir is not defined.
3. Harden git_cmd() so that it doesn't add "--git-dir=$git_dir" if $git_dir
is not defined, and change git_get_project_config() so that it doesn't
even try to access $git_dir if it is not defined.

This commit implements both 1.) and 2.), i.e. gitweb_get_feature() doesn't
call project-specific override if $git_dir is not defined (if there is no
project), and git_get_project_config() returns early if $git_dir is not
defined.

Add a test for this bug to t/t9500-gitweb-standalone-no-errors.sh test.

Reported-by: Eli Barzilay <eli@barzilay.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb multiple project roots documentationSylvain Rabot Tue, 2 Mar 2010 00:04:57 +0000 (01:04 +0100)

gitweb multiple project roots documentation

This commit adds in the gitweb/README file a description of how to use gitweb
with several project roots using apache virtualhost rewrite rules.

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'cc/maint-bisect-paths'Junio C Hamano Mon, 1 Mar 2010 09:09:21 +0000 (01:09 -0800)

Merge branch 'cc/maint-bisect-paths'

* cc/maint-bisect-paths:
bisect: error out when passing bad path parameters

bisect: error out when passing bad path parametersChristian Couder Sun, 28 Feb 2010 22:19:09 +0000 (23:19 +0100)

bisect: error out when passing bad path parameters

As reported by Mark Lodato, "git bisect", when it was started with
path parameters that match no commit was kind of working without
taking account of path parameters and was reporting something like:

Bisecting: -1 revisions left to test after this (roughly 0 steps)

It is more correct and safer to just error out in this case, before
displaying the revisions left, so this patch does just that.

Note that this bug is very old, it exists at least since v1.5.5.
And it is possible to detect that case earlier in the bisect
algorithm, but it is not clear that it would be an improvement to
error out earlier, on the contrary it may change the behavior of
"git rev-list --bisect-all" for example, which is currently correct.

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

Merge branch 'maint'Junio C Hamano Sun, 28 Feb 2010 19:41:57 +0000 (11:41 -0800)

Merge branch 'maint'

* maint:
Git 1.7.0.1
Remove reference to GREP_COLORS from documentation
sha1_name: fix segfault caused by invalid index access

Git 1.7.0.1 v1.7.0.1Junio C Hamano Sun, 28 Feb 2010 19:41:24 +0000 (11:41 -0800)

Git 1.7.0.1

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

Remove reference to GREP_COLORS from documentationMark Lodato Sat, 27 Feb 2010 04:57:48 +0000 (23:57 -0500)

Remove reference to GREP_COLORS from documentation

There is no longer support for external grep, as per bbc09c2 (grep: rip
out support for external grep, 2010-01-12), so remove the reference to it
from the documentation.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: clarify definition of TEST_OBJSJonathan Nieder Sun, 28 Feb 2010 09:11:55 +0000 (03:11 -0600)

Makefile: clarify definition of TEST_OBJS

The definition of TEST_OBJS in commit daa99a91 (Makefile: make sure
test helpers are rebuilt when headers change, 2010-01-26) moved a use
of $X to before the platform-specific section where it gets defined.
There are at least two ways to fix that:

- Change the definition of TEST_OBJS to use the = delayed
evaluation operator. This way, one need not worry about $(X)
needing to be defined before TEST_OBJS is set.

- Move the definition of TEST_OBJS to below the definition of $X.

Carry out the second. The later site of definition makes the code more
readable, since now a reader only has to look down one line to see what
TEST_OBJS is meant to be used for.

Oddly enough, with or without this change the behavior of the Makefile
is the same. Since TEST_PROGRAMS is defined with delayed evaluation,
the value of

TEST_OBJS := $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))

is independent of the value of $X when it is evaluated: the $X in the
pattern and the $X in $(TEST_PROGRAMS) will simply always cancel out.
Make sure $X has the expected expansion anyway to make the code and
the reader’s sanity more robust in the face of future changes.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_name: fix segfault caused by invalid index accessMarkus Heidelberg Sun, 28 Feb 2010 15:49:15 +0000 (16:49 +0100)

sha1_name: fix segfault caused by invalid index access

The code to see if user input "git show :path" makes sense tried to access
the index without properly checking the array bound.

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

git svn: delay importing SVN::Base until it is neededjosh robb Wed, 24 Feb 2010 03:13:50 +0000 (16:13 +1300)

git svn: delay importing SVN::Base until it is needed

Importing functions from a .dll into Git for Windows' perl is pretty slow,
so let's avoid importing if it is not necessary.

This seems particularly slow in virtualized enviroments. Before this
change (on my machine):

$ time perl /libexec/git-core/git-svn rebase
Current branch master is up to date.

real 2m56.750s
user 0m3.129s
sys 2m39.232s

Afterwards:

$ time perl /libexec/git-core/git-svn rebase
Current branch master is up to date.

real 0m33.407s
user 0m1.409s
sys 0m23.054s

git svn rebase -n goes from 3m7.046s to 0m10.312s.

Signed-off-by: Josh Robb <josh_robb@fastmail.fm>
Acked-by: Eric Wong <normalperson@yhbt.net>

git-svn: Fix discarding of extra parents from svn:mergeinfoTuomas Suutari Mon, 22 Feb 2010 18:12:53 +0000 (20:12 +0200)

git-svn: Fix discarding of extra parents from svn:mergeinfo

If parent J is an ancestor of parent I, then parent J should be
discarded, not I.

Note that J is an ancestor of I if and only if rev-list I..J is emtpy,
which is what we are testing here.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>

t9151: Add two new svn:mergeinfo test casesTuomas Suutari Mon, 22 Feb 2010 07:57:21 +0000 (09:57 +0200)

t9151: Add two new svn:mergeinfo test cases

When svn:mergeinfo contains two new parents in a specific order and
one is ancestor of the other, it is possible that git-svn discards the
wrong one. The first test case ("commit made to merged branch is
reachable from the merge") proves this.

The second test case ("merging two branches in one commit is detected
correctly") is just for completeness, since there was no test for
merging two (feature) branches to trunk in one commit.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>

t9151: Fix a few commits in the SVN dumpTuomas Suutari Mon, 22 Feb 2010 07:57:20 +0000 (09:57 +0200)

t9151: Fix a few commits in the SVN dump

A few "svn cp" commands and commit commands were executed in incorrect
order. Therefore some of the desired commits were missing and some
were committed with wrong revision number in the commit message. This
made it hard to compare the produced git repository with the SVN
repository.

The dump file is updated too, but only the relevant parts and with
hand-edited timestamps to make history linear.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>

Merge branch 'maint'Junio C Hamano Fri, 26 Feb 2010 07:21:50 +0000 (23:21 -0800)

Merge branch 'maint'

* maint:
t3301-notes: insert a shbang line in ./fake_editor.sh

Merge branch 'maint-1.6.6' into maintJunio C Hamano Fri, 26 Feb 2010 07:21:42 +0000 (23:21 -0800)

Merge branch 'maint-1.6.6' into maint

* maint-1.6.6:
t3301-notes: insert a shbang line in ./fake_editor.sh

Windows: redirect f[re]open("/dev/null") to f[re]open... Johannes Sixt Thu, 25 Feb 2010 20:03:44 +0000 (21:03 +0100)

Windows: redirect f[re]open("/dev/null") to f[re]open("nul")

On Windows, the equivalent of "/dev/null" is "nul". This implements
compatibility wrappers around fopen() and freopen() that check for this
particular file name.

The new tests exercise code paths where this is relevant.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3301-notes: insert a shbang line in ./fake_editor.shJohannes Sixt Thu, 25 Feb 2010 10:39:50 +0000 (11:39 +0100)

t3301-notes: insert a shbang line in ./fake_editor.sh

This is required on Windows because git-notes is now a built-in
rather than a shell script.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Wed, 24 Feb 2010 23:34:07 +0000 (15:34 -0800)

Merge branch 'maint'

* maint:
commit: quote the user name in the example

commit: quote the user name in the exampleMatt Kraai Wed, 24 Feb 2010 14:18:25 +0000 (06:18 -0800)

commit: quote the user name in the example

If the user runs

git config --global user.name Your Name

as suggested, user.name will be set to "Your". With this patch, the
suggested command will be

git config --global user.name "Your Name"

which will set user.name to "Your Name" and hopefully help users avoid
the former mistake.

Signed-off-by: Matt Kraai <kraai@ftbfs.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ml/maint-grep-doc' into maintJunio C Hamano Wed, 24 Feb 2010 23:33:23 +0000 (15:33 -0800)

Merge branch 'ml/maint-grep-doc' into maint

* ml/maint-grep-doc:
grep documentation: clarify what files match

Merge branch 'maint'Junio C Hamano Tue, 23 Feb 2010 22:27:55 +0000 (14:27 -0800)

Merge branch 'maint'

* maint:
am: remove rebase-apply directory before gc
rerere: fix memory leak if rerere images can't be read
Documentation: mention conflict marker size argument (%L) for merge driver

am: remove rebase-apply directory before gcJonathan Nieder Mon, 22 Feb 2010 14:35:46 +0000 (08:35 -0600)

am: remove rebase-apply directory before gc

When git am does an automatic gc it doesn't clean up the rebase-apply
directory until after this has finished. This means that if the user
aborts the gc then future am or rebase operations will report that an
existing operation is in progress, which is undesirable and confusing.

Reported by Mark Brown <broonie@debian.org> through
http://bugs.debian.org/570966

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rerere: fix memory leak if rerere images can't be readBert Wesarg Tue, 23 Feb 2010 20:11:53 +0000 (21:11 +0100)

rerere: fix memory leak if rerere images can't be read

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: mention conflict marker size argument... Bert Wesarg Tue, 23 Feb 2010 20:11:12 +0000 (21:11 +0100)

Documentation: mention conflict marker size argument (%L) for merge driver

23a64c9e (conflict-marker-size: new attribute, 2010-01-16) introduced the
new attribute and also pass the conflict marker size as %L to merge driver
commands. This documents the substitution.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

move encode_in_pack_object_header() to a better placeNicolas Pitre Tue, 23 Feb 2010 20:02:37 +0000 (15:02 -0500)

move encode_in_pack_object_header() to a better place

Commit 1b22b6c897 made duplicated versions of encode_header() into a
common version called encode_in_pack_object_header(). There is however
a better location that sha1_file.c for such a function though, as
sha1_file.c contains nothing related to the creation of packs, and
it is quite populated already.

Also the comment that was moved to the header file should really remain
near the function as it covers implementation details and provides no
information about the actual function interface.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: Fix race condition in t7006-pagerJonathan Nieder Mon, 22 Feb 2010 08:46:33 +0000 (02:46 -0600)

tests: Fix race condition in t7006-pager

Pagers that do not consume their input are dangerous: for example,

$ GIT_PAGER=: git log
$ echo $?
141
$

The only reason these tests were able to work before was that
'git log' would write to the pipe (and not fill it) before the
pager had time to terminate and close the pipe.

Fix it by using a program that consumes its input, namely wc (as
suggested by Johannes).

Reported-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file: be paranoid when creating loose objectsNicolas Pitre Sun, 21 Feb 2010 20:48:06 +0000 (15:48 -0500)

sha1_file: be paranoid when creating loose objects

We don't want the data being deflated and stored into loose objects
to be different from what we expect. While the deflated data is
protected by a CRC which is good enough for safe data retrieval
operations, we still want to be doubly sure that the source data used
at object creation time is still what we expected once that data has
been deflated and its CRC32 computed.

The most plausible data corruption may occur if the source file is
modified while Git is deflating and writing it out in a loose object.
Or Git itself could have a bug causing memory corruption. Or even bad
RAM could cause trouble. So it is best to make sure everything is
coherent and checksum protected from beginning to end.

To do so we compute the SHA1 of the data being deflated _after_ the
deflate operation has consumed that data, and make sure it matches
with the expected SHA1. This way we can rely on the CRC32 checked by
the inflate operation to provide a good indication that the data is still
coherent with its SHA1 hash. One pathological case we ignore is when
the data is modified before (or during) deflate call, but changed back
before it is hashed.

There is some overhead of course. Using 'git add' on a set of large files:

Before:

real 0m25.210s
user 0m23.783s
sys 0m1.408s

After:

real 0m26.537s
user 0m25.175s
sys 0m1.358s

The overhead is around 5% for full data coherency guarantee.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-diff: add a test for git diff --quiet -wLarry D'Anna Mon, 22 Feb 2010 02:58:44 +0000 (21:58 -0500)

git-diff: add a test for git diff --quiet -w

This patch adds two test cases for:

6977c25 git diff --quiet -w: check and report the status

Signed-off-by: Larry D'Anna <larry@elder-gods.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ml/maint-grep-doc'Junio C Hamano Sun, 21 Feb 2010 20:01:06 +0000 (12:01 -0800)

Merge branch 'ml/maint-grep-doc'

* ml/maint-grep-doc:
grep documentation: clarify what files match

Merge branch 'tc/maint-transport-ls-remote-with-void'Junio C Hamano Sun, 21 Feb 2010 20:01:03 +0000 (12:01 -0800)

Merge branch 'tc/maint-transport-ls-remote-with-void'

* tc/maint-transport-ls-remote-with-void:
transport: add got_remote_refs flag

Merge branch 'hm/maint-imap-send-crlf'Junio C Hamano Sun, 21 Feb 2010 20:00:21 +0000 (12:00 -0800)

Merge branch 'hm/maint-imap-send-crlf'

* hm/maint-imap-send-crlf:
git-imap-send: Convert LF to CRLF before storing patch to draft box

Merge branch 'sp/push-sideband'Junio C Hamano Sun, 21 Feb 2010 20:00:07 +0000 (12:00 -0800)

Merge branch 'sp/push-sideband'

* sp/push-sideband:
receive-pack: Send internal errors over side-band #2
t5401: Use a bare repository for the remote peer
receive-pack: Send hook output over side band #2
receive-pack: Wrap status reports inside side-band-64k
receive-pack: Refactor how capabilities are shown to the client
send-pack: demultiplex a sideband stream with status data
run-command: support custom fd-set in async
run-command: Allow stderr to be a caller supplied pipe

Merge branch 'jc/checkout-detached'Junio C Hamano Sun, 21 Feb 2010 19:59:42 +0000 (11:59 -0800)

Merge branch 'jc/checkout-detached'

* jc/checkout-detached:
Reword "detached HEAD" notification

Merge branch 'jc/maint-fix-test-perm'Junio C Hamano Sun, 21 Feb 2010 19:59:35 +0000 (11:59 -0800)

Merge branch 'jc/maint-fix-test-perm'

* jc/maint-fix-test-perm:
lib-patch-mode.sh: Fix permission
t6000lib: Fix permission

Merge branch 'jn/makefile-script-lib'Junio C Hamano Sun, 21 Feb 2010 19:59:22 +0000 (11:59 -0800)

Merge branch 'jn/makefile-script-lib'

* jn/makefile-script-lib:
Do not install shell libraries executable

Merge branch 'mv/request-pull-modernize'Junio C Hamano Sun, 21 Feb 2010 19:59:17 +0000 (11:59 -0800)

Merge branch 'mv/request-pull-modernize'

* mv/request-pull-modernize:
request-pull: avoid mentioning that the start point is a single commit

hash-object: don't use mmap() for small filesDmitry Potapov Sun, 21 Feb 2010 06:32:19 +0000 (09:32 +0300)

hash-object: don't use mmap() for small files

Using read() instead of mmap() can be 39% speed up for 1Kb files and is
1% speed up 1Mb files. For larger files, it is better to use mmap(),
because the difference between is not significant, and when there is not
enough memory, mmap() performs much better, because it avoids swapping.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file: don't malloc the whole compressed result... Nicolas Pitre Sun, 21 Feb 2010 04:27:31 +0000 (23:27 -0500)

sha1_file: don't malloc the whole compressed result when writing out objects

There is no real advantage to malloc the whole output buffer and
deflate the data in a single pass when writing loose objects. That is
like only 1% faster while using more memory, especially with large
files where memory usage is far more. It is best to deflate and write
the data out in small chunks reusing the same memory instead.

For example, using 'git add' on a few large files averaging 40 MB ...

Before:
21.45user 1.10system 0:22.57elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+828040outputs (0major+142640minor)pagefaults 0swaps

After:
21.50user 1.25system 0:22.76elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+828040outputs (0major+104408minor)pagefaults 0swaps

While the runtime stayed relatively the same, the number of minor page
faults went down significantly.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7006-pager: if stdout is not a terminal, make a new oneJonathan Nieder Sat, 20 Feb 2010 08:50:25 +0000 (02:50 -0600)

t7006-pager: if stdout is not a terminal, make a new one

Testing pagination requires (fake or real) access to a terminal so we
can see whether the pagination automatically kicks in, which makes it
hard to get good coverage when running tests without --verbose. There
are a number of ways to work around that:

- Replace all isatty calls with calls to a custom xisatty wrapper
that usually checks for a terminal but can be overridden for tests.
This would be workable, but it would require implementing xisatty
separately in three languages (C, shell, and perl) and making sure
that any code that is to be tested always uses the wrapper.

- Redirect stdout to /dev/tty. This would be problematic because
there might be no terminal available, and even if a terminal is
available, it might not be appropriate to spew output to it.

- Create a new pseudo-terminal on the fly and capture its output.

This patch implements the third approach.

The new test-terminal.perl helper uses IO::Pty from Expect.pm to create
a terminal and executes the program specified by its arguments with
that terminal as stdout. If the IO::Pty module is missing or not
working on a system, the test script will maintain its old behavior
(skipping most of its tests unless GIT_TEST_OPTS includes --verbose).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Sat, 20 Feb 2010 18:38:42 +0000 (10:38 -0800)

Merge branch 'maint'

* maint:
git-p4: fix bug in symlink handling
t1450: fix testcases that were wrongly expecting failure
Documentation: Fix indentation problem in git-commit(1)

cherry_pick_list: quit early if one side is emptyThomas Rast Sat, 20 Feb 2010 11:42:04 +0000 (12:42 +0100)

cherry_pick_list: quit early if one side is empty

The --cherry-pick logic starts by counting the commits on each side,
so that it can filter away commits on the bigger one. However, so
far it missed an opportunity for optimization: it doesn't need to do
any work if either side is empty.

This in particular helps the common use-case 'git rebase -i HEAD~$n':
it internally uses --cherry-pick, but since HEAD~$n is a direct
ancestor the left side is always empty.

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

tests: Add tests for automatic use of pagerJonathan Nieder Fri, 19 Feb 2010 07:18:58 +0000 (01:18 -0600)

tests: Add tests for automatic use of pager

Git’s automatic pagination support has some subtleties. Add some
tests to make sure we don’t break:

- when git will use a pager by default;
- the effect of the --paginate and --no-pager options;
- the effect of pagination on use of color;
- how the choice of pager is configured.

This does not yet test:

- use of pager by scripted commands (git svn and git am);
- effect of the pager.* configuration variables;
- setting of the LESS variable.

Some features involve checking whether stdout is a terminal, so many
of these tests are skipped unless output is passed through to the
terminal (i.e., unless $GIT_TEST_OPTS includes --verbose).

The immediate purpose for these tests was to avoid making things worse
after the breakage from my jn/editor-pager series (see commit 376f39,
2009-11-20). Thanks to Sebastian Celis <sebastian@sebastiancelis.com>
for the report.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

utf8.c: speculatively assume utf-8 in strbuf_add_wrappe... René Scharfe Fri, 19 Feb 2010 22:20:44 +0000 (23:20 +0100)

utf8.c: speculatively assume utf-8 in strbuf_add_wrapped_text()

is_utf8() works by calling utf8_width() for each character at the
supplied location. In strbuf_add_wrapped_text(), we do that anyway
while wrapping the lines. So instead of checking the encoding
beforehand, optimistically assume that it's utf-8 and wrap along
until an invalid character is hit, and when that happens start over.

This pays off if the text consists only of valid utf-8 characters.
The following command was run against the Linux kernel repo with
git 1.7.0:

$ time git log --format='%b' v2.6.32 >/dev/null

real 0m2.679s
user 0m2.580s
sys 0m0.100s

$ time git log --format='%w(60,4,8)%b' >/dev/null

real 0m4.342s
user 0m4.230s
sys 0m0.110s

And with this patch series:

$ time git log --format='%w(60,4,8)%b' >/dev/null

real 0m3.741s
user 0m3.630s
sys 0m0.110s

So the cost of wrapping is reduced to 70% in this case.

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

utf8.c: remove strbuf_write()René Scharfe Fri, 19 Feb 2010 22:16:45 +0000 (23:16 +0100)

utf8.c: remove strbuf_write()

The patch before the previous one made sure that all callers of
strbuf_add_wrapped_text() supply a strbuf. Replace all calls of
strbuf_write() with regular strbuf functions and remove it.

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

utf8.c: remove print_spaces()René Scharfe Fri, 19 Feb 2010 22:15:55 +0000 (23:15 +0100)

utf8.c: remove print_spaces()

The previous patch made sure that strbuf_add_wrapped_text() (and thus
strbuf_add_indented_text(), too) always get a strbuf. Make use of
this fact by adding strbuf_addchars(), a small helper that adds a
char the specified number of times to a strbuf, and use it to replace
print_spaces().

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

utf8.c: remove print_wrapped_text()René Scharfe Fri, 19 Feb 2010 22:15:01 +0000 (23:15 +0100)

utf8.c: remove print_wrapped_text()

strbuf_add_wrapped_text() is called only from print_wrapped_text()
without a strbuf (in which case it writes its results to stdout).

At its only callsite, supply a strbuf, call strbuf_add_wrapped_text()
directly and remove the wrapper function.

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

git-p4: fix bug in symlink handlingEvan Powers Tue, 16 Feb 2010 08:44:08 +0000 (00:44 -0800)

git-p4: fix bug in symlink handling

Fix inadvertent breakage from b932705 (git-p4: stream from perforce to
speed up clones, 2009-07-30) in the code that strips the trailing '\n'
from p4 print on a symlink. (In practice, contents is of the form
['target\n', ''].)

Signed-off-by: Evan Powers <evan.powers@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>