gitweb.git
gitweb: add a "string" variant of print_local_timeJohn 'Warthog9' Hawley Sat, 30 Jan 2010 22:30:42 +0000 (23:30 +0100)

gitweb: add a "string" variant of print_local_time

Add a function (named format_local_time) that returns the string that
print_local_time would print.

Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: Check that $site_header etc. are defined before... John 'Warthog9' Hawley Sat, 30 Jan 2010 22:30:41 +0000 (23:30 +0100)

gitweb: Check that $site_header etc. are defined before using them

If one of $site_header, $site_footer or $home_text is not defined, you
get extraneous errors in the web logs, for example (line wrapped for
better readibility):

[Wed Jan 13 16:55:42 2010] [error] [client ::1] [Wed Jan 13 16:55:42 2010]
gitweb.cgi: Use of uninitialized value $site_header in -f at
/var/www/gitweb/gitweb.cgi line 3287., referer: http://git/gitweb.cgi

This ensures that those variables are defined before trying to use it.

Note that such error can happen only because of an error in gitweb
config file; building gitweb.cgi can make mentioned variables holding
empty string (it is even the default), but they are still defined.

Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: Makefile improvementsJohn 'Warthog9' Hawley Sat, 30 Jan 2010 22:30:40 +0000 (23:30 +0100)

gitweb: Makefile improvements

Adjust the main Makefile so you can simply run

make gitweb

which in turn calls gitweb/Makefile. This means that in order to
generate gitweb, you can simply run 'make' from gitweb subdirectory:

cd gitweb
make

Targets gitweb/gitweb.cgi and (dependent on JSMIN being defined)
gitweb/gitweb.min.js in main Makefile are preserved for backward
compatibility.

Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: Load checkingJohn 'Warthog9' Hawley Sat, 30 Jan 2010 22:30:39 +0000 (23:30 +0100)

gitweb: Load checking

This changes slightly the behavior of gitweb, so that it verifies
that the box isn't inundated with before attempting to serve gitweb.
If the box is overloaded, it basically returns a 503 Server Unavailable
until the load falls below the defined threshold. This helps dramatically
if you have a box that's I/O bound, reaches a certain load and you
don't want gitweb, the I/O hog that it is, increasing the pain the
server is already undergoing.

This behavior is controlled by $maxload configuration variable.
Default is a load of 300, which for most cases should never be hit.
Unset it (set it to undefined value, i.e. undef) to turn off checking.

Currently it requires that '/proc/loadavg' file exists, otherwise the
load check is bypassed (load is taken to be 0). So platforms that do
not implement '/proc/loadavg' currently cannot use this feature
(provisions are included for additional checks to be added by others).

There is simple test in t/t9501-gitweb-standalone-http-status.sh to
check that it correctly returns "503 Service Unavailable" if load is
too high, and also if there are any Perl warnings or errors.

Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: Make running t9501 test with '--debug' reliable... Jakub Narebski Sat, 30 Jan 2010 22:30:38 +0000 (23:30 +0100)

gitweb: Make running t9501 test with '--debug' reliable and usable

Remove test_debug lines after 'snapshots: tgz only default format
enabled' and 'snapshots: all enabled in default, use default disabled
value' tests. Those tests constitute of multiple gitweb_run
invocation, therefore outputting gitweb.output for the last gitweb_run
wouldn't help much in debugging test failure, and can only confuse.

For snapshot tests which check for "200 OK" status, change
test_debug 'cat gitweb.output'
to
test_debug 'cat gitweb.headers'
Otherwise when running this test with '--debug' option,
t/t9501-gitweb-standalone-http-status.sh would dump *binary data* (the
snapshot itself) to standard output, which can mess up state of terminal
due to term control characters which can be embedded in output.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

is_submodule_modified(): fix breakage with external... v1.7.0-rc1Junio C Hamano Sat, 30 Jan 2010 20:08:26 +0000 (12:08 -0800)

is_submodule_modified(): fix breakage with external GIT_INDEX_FILE

Even when the environment was given for the top-level process, checking
in the submodule work tree should use the index file associated with the
work tree of the submodule. Do not export it to the environment.

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

RPM packaging: don't include foreign-scm-helper bits yetJunio C Hamano Sat, 30 Jan 2010 17:45:11 +0000 (09:45 -0800)

RPM packaging: don't include foreign-scm-helper bits yet

The files in /usr/lib/python* are only the support infrastructure for
foreign scm interface yet to be written and/or shipped with git. Don't
include them in the binary package (this will also free us from Python
dependency).

When we ship with foreign scm interface, we will need to package these
files with it in a separate subpackage, but we are not there yet.

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

grep: Fix two memory leaksDan McGee Sat, 30 Jan 2010 15:42:58 +0000 (09:42 -0600)

grep: Fix two memory leaks

We duplicate the grep_opt structure when using grep threads, but didn't
later free either the patterns attached to this new structure or the
structure itself.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: don't invoke the pager for each commit summaryMarkus Heidelberg Sat, 30 Jan 2010 16:23:37 +0000 (17:23 +0100)

rebase: don't invoke the pager for each commit summary

This regression was introduced by commit 0aa958d (rebase: replace
antiquated sed invocation, 2010-01-24), which changed the invocation of
"git rev-list | sed" to "git log".

It can be reproduced by something like this:
$ git rebase -s recursive origin/master

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

Update draft release notes to 1.7.0Junio C Hamano Sat, 30 Jan 2010 07:38:31 +0000 (23:38 -0800)

Update draft release notes to 1.7.0

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

Merge branch 'maint'Junio C Hamano Sat, 30 Jan 2010 07:36:17 +0000 (23:36 -0800)

Merge branch 'maint'

* maint:
fix memcpy of overlapping area

Merge branch 'maint-1.6.5' into maintJunio C Hamano Sat, 30 Jan 2010 07:36:13 +0000 (23:36 -0800)

Merge branch 'maint-1.6.5' into maint

* maint-1.6.5:
fix memcpy of overlapping area

request-pull: avoid mentioning that the start point... Miklos Vajna Fri, 29 Jan 2010 14:17:59 +0000 (15:17 +0100)

request-pull: avoid mentioning that the start point is a single commit

Previously we ran shortlog on the start commit which always printed
"(1)" after the start commit, which gives no information, but makes the
output less easy to read. Instead of giving the author name of the
commit, use the space for committer timestamp to help recipient judge
the freshness of the offered branch more easily.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Reword "detached HEAD" notificationJunio C Hamano Sat, 30 Jan 2010 06:03:24 +0000 (22:03 -0800)

Reword "detached HEAD" notification

The old "advice" message explained how to create a branch after going into
a detached HEAD state but didn't make it clear why the user may want to do
so. Also "moving to ... which isn't a local branch" was unclear if it is
complaining, if it is describing the new state, or if it is explaining why
the HEAD is detached (the true reason is the last one).

Give the established phrase 'detached HEAD' first to make it easy for
users to look up the concept in documentation, and briefly describe what
can be done in the state (i.e. play around without having to clean up)
before telling the user how to keep what was done during the temporary
state.

Allow the long description to be hidden by setting advice.detachedHead
configuration to false.

We might want to customize the advice depending on how the commit to check
out was spelled (e.g. instead of "new-branch-name", we way want to say
"topic" when "git checkout origin/topic" triggered this message) in later
updates, but this encapsulates that into a separate function and it should
be a good first step.

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

Implement pthread_cond_broadcast on WindowsJohannes Sixt Fri, 29 Jan 2010 23:54:05 +0000 (00:54 +0100)

Implement pthread_cond_broadcast on Windows

See http://www.cse.wustl.edu/~schmidt/win32-cv-1.html, section "The
SignalObjectAndWait solution". But note that this implementation does not
use SignalObjectAndWait (which is needed to achieve fairness, but we do
not need fairness).

Note that our implementations of pthread_cond_broadcast and
pthread_cond_signal require that they are invoked with the mutex held that
is used in the pthread_cond_wait calls.

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

If deriving SVN_SSH from GIT_SSH on msys, also add... Sebastian Schuberth Sat, 23 Jan 2010 14:20:28 +0000 (15:20 +0100)

If deriving SVN_SSH from GIT_SSH on msys, also add quotes

In contrast to GIT_SSH, SVN_SSH requires quotes for paths that contain
spaces. As GIT_SSH will not work if it contains quotes, it is safe to
assume it never contains quotes. Also, adding quotes to SVN_SSH for paths
that do not contain spaces does no harm. So we always add quotes when
deriving SVN_SSH from GIT_SSH on msys.

This fixes msysGit issue 385, see
http://code.google.com/p/msysgit/issues/detail?id=385

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://git.kernel.org/pub/scm/gitk/gitkJunio C Hamano Fri, 29 Jan 2010 20:57:44 +0000 (12:57 -0800)

Merge git://git.kernel.org/pub/scm/gitk/gitk

* git://git.kernel.org/pub/scm/gitk/gitk:
gitk: Update German translation
gitk: Add French translation
gitk: update Italian translation
gitk: Update Swedish translation
gitk: Adjust two equal strings which differed in whitespace
gitk: Display submodule diffs with appropriate encoding
gitk: Fix display of newly-created tags
gitk: Enable gitk to create tags with messages
gitk: Update Hungarian translation
gitk: Add Hungarian translation
gitk: Add "--no-replace-objects" option

add shebang line to git-mergetool--lib.shJeff King Fri, 29 Jan 2010 10:37:23 +0000 (05:37 -0500)

add shebang line to git-mergetool--lib.sh

Even though this script is expected to be sourced instead of
executed on its own, the #!/bin/sh line provides simple
documentation about what format the file is in.

In particular, the lack of such a line was confusing the
valgrind support of our test scripts, which assumed that any
executable without a #!-line should be intercepted and run
through valgrind. So during valgrind-enabled tests, any
script sourcing this file actually sourced the valgrind
interception script instead.

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

fix off-by-one allocation errorJeff King Fri, 29 Jan 2010 10:31:30 +0000 (05:31 -0500)

fix off-by-one allocation error

Caught by valgrind in t5516. Reading the code shows we
malloc enough for our string, but not trailing NUL.

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

fix memcpy of overlapping areaJeff King Fri, 29 Jan 2010 10:28:44 +0000 (05:28 -0500)

fix memcpy of overlapping area

Caught by valgrind in t5500, but it is pretty obvious from
reading the code that this is shifting elements of an array
to the left, which needs memmove.

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

Merge branch 'maint'Shawn O. Pearce Fri, 29 Jan 2010 15:58:56 +0000 (07:58 -0800)

Merge branch 'maint'

* maint:
git-gui: fix shortcut for menu "Commit/Revert Changes"

git-gui: fix shortcut for menu "Commit/Revert Changes"Heiko Voigt Fri, 29 Jan 2010 15:57:48 +0000 (16:57 +0100)

git-gui: fix shortcut for menu "Commit/Revert Changes"

The shortcut was not properly recognized previously.

Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

gitk: Update German translationChristian Stimming Fri, 29 Jan 2010 11:55:14 +0000 (22:55 +1100)

gitk: Update German translation

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Add French translationEmmanuel Trillaud Tue, 12 Jan 2010 13:02:50 +0000 (14:02 +0100)

gitk: Add French translation

Signed-off-by: Emmanuel Trillaud <etrillaud@gmail.com>
Signed-off-by: Thomas Moulard <thomas.moulard@gmail.com>
Signed-off-by: Guy Brand <gb@unistra.fr>
Signed-off-by: Nicolas Sebrecht <nicolas.s.dev@gmx.fr>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: update Italian translationMichele Ballabio Fri, 29 Jan 2010 11:51:28 +0000 (22:51 +1100)

gitk: update Italian translation

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Update Swedish translationPeter Krefting Fri, 29 Jan 2010 11:50:29 +0000 (22:50 +1100)

gitk: Update Swedish translation

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
Signed-off-by: Paul Mackerras <paulus@samba.org>

git-gui: Quote git path when starting another gui in... Jens Lehmann Thu, 28 Jan 2010 21:20:39 +0000 (22:20 +0100)

git-gui: Quote git path when starting another gui in a submodule

In do_git_gui the path of the git executable has to be put into a
list, otherwise calling it will fail when when spaces are present
in its path.

Reported-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Merge branch 'maint'Junio C Hamano Thu, 28 Jan 2010 22:33:33 +0000 (14:33 -0800)

Merge branch 'maint'

* maint:
bash: don't offer remote transport helpers as subcommands

bash: support 'git notes' and its subcommandsSZEDER Gábor Thu, 28 Jan 2010 01:05:55 +0000 (02:05 +0100)

bash: support 'git notes' and its subcommands

... and it will offer refs unless after -m or -F, because these two
options require a non-ref argument.

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

filter-branch: Add tests for submodules in tree-filterMichal Sojka Thu, 28 Jan 2010 09:08:47 +0000 (10:08 +0100)

filter-branch: Add tests for submodules in tree-filter

Add tests to make sure that:

1) a submodule can be removed and its content replaced with regular files
('rewrite submodule with another content'). This test passes only with
the previous patch applied.

2) it is possible to replace submodule revision by direct index
manipulation ('replace submodule revision'). Although it would be
better to run such a filter in --index-filter, this test shows that
this functionality is not broken by the previous patch. This succeeds
both with and without the previous patch.

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

filter-branch: Fix to allow replacing submodules with... Michal Sojka Thu, 28 Jan 2010 09:08:46 +0000 (10:08 +0100)

filter-branch: Fix to allow replacing submodules with another content

When git filter-branch is used to replace a submodule with another
content, it always fails on the first commit.

Consider a repository with submod directory containing a submodule. The
following command to remove the submodule and replace it with a file fails:

git filter-branch --tree-filter 'rm -rf submod &&
git rm -q submod &&
mkdir submod &&
touch submod/file'

with an error:

error: submod: is a directory - add files inside instead

The reason is that git diff-index, which generates the first part of the
list of files updated by the tree filter, emits also the removed submodule
even if it was replaced by a real directory.

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

bash: don't offer remote transport helpers as subcommandsSZEDER Gábor Fri, 22 Jan 2010 10:54:51 +0000 (11:54 +0100)

bash: don't offer remote transport helpers as subcommands

Since commits a2d725b7 (Use an external program to implement fetching
with curl, 2009-08-05) and c9e388bb (Make the
"traditionally-supported" URLs a special case, 2009-09-03) remote
transport helpers like 'remote-ftp' and 'remote-curl' are offered by the
completion script as available subcommands. Not good, since they are
helpers, therefore should not be offered, so filter them out.

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

grep --quiet: finishing touchesJunio C Hamano Thu, 28 Jan 2010 20:33:42 +0000 (12:33 -0800)

grep --quiet: finishing touches

Name the option "--quiet" not "--quick", document it, and add tests.

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

reject @{-1} not at beginning of object nameJeff King Thu, 28 Jan 2010 09:56:43 +0000 (04:56 -0500)

reject @{-1} not at beginning of object name

Something like foo@{-1} is nonsensical, as the @{-N} syntax
is reserved for "the Nth last branch", and is not an actual
reflog selector. We should not feed such nonsense to
approxidate at all.

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

fix parsing of @{-1}@{u} combinationJeff King Thu, 28 Jan 2010 09:52:22 +0000 (04:52 -0500)

fix parsing of @{-1}@{u} combination

Previously interpret_branch_name would see @{-1} and stop
parsing, leaving the @{u} as cruft that provoked an error.
Instead, we should recurse if there is more to parse.

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

test combinations of @{} syntaxJeff King Thu, 28 Jan 2010 09:50:20 +0000 (04:50 -0500)

test combinations of @{} syntax

Now that we have several different types of @{} syntax, it
is a good idea to test them together, which reveals some
failures.

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

rerere: fix too-short initializationJeff King Thu, 28 Jan 2010 14:52:16 +0000 (09:52 -0500)

rerere: fix too-short initialization

This was caused by a typo in the sizeof parameter, and meant
we looked at uninitialized memory. Caught by valgrind in
t2030.

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

git-gui: update Italian translationMichele Ballabio Mon, 7 Sep 2009 16:45:16 +0000 (18:45 +0200)

git-gui: update Italian translation

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Update Swedish translation (520t0f0u)Peter Krefting Thu, 28 Jan 2010 12:57:34 +0000 (13:57 +0100)

git-gui: Update Swedish translation (520t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

t0101: use absolute dateJeff King Thu, 28 Jan 2010 08:52:18 +0000 (03:52 -0500)

t0101: use absolute date

The original version used relative approxidates, which don't
reproduce as reliably as absolute ones. Commit 6c647a fixed
this for one case, but missed the "silly" case.

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

Merge branch 'fk/threaded-grep'Junio C Hamano Thu, 28 Jan 2010 08:46:45 +0000 (00:46 -0800)

Merge branch 'fk/threaded-grep'

* fk/threaded-grep:
Threaded grep
grep: expose "status-only" feature via -q

Merge branch 'gp/maint-cvsserver'Junio C Hamano Thu, 28 Jan 2010 08:46:33 +0000 (00:46 -0800)

Merge branch 'gp/maint-cvsserver'

* gp/maint-cvsserver:
git-cvsserver: allow regex metacharacters in CVSROOT

tests: update tests that used to failJunio C Hamano Thu, 28 Jan 2010 08:41:52 +0000 (00:41 -0800)

tests: update tests that used to fail

"diff --cc" output t4038 tests was fixed by b810cbb (diff --cc: a lost
line at the beginning of the file is shown incorrectly, 2009-07-22), which
was actually the commit that introduced this test..

An error in "git merge -s resolve" t6035 tests was fixed by 730f728
(unpack-trees.c: look ahead in the index, 2009-09-20).

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

git-gui: use themed tk widgets with Tk 8.5Pat Thoyts Tue, 26 Jan 2010 00:05:31 +0000 (00:05 +0000)

git-gui: use themed tk widgets with Tk 8.5

This patch enables the use of themed Tk widgets with Tk 8.5 and above.
These make a significant difference on Windows in making the
application appear native. On Windows and MacOSX ttk defaults to the
native look as much as possible. On X11 the user may select a theme
using the TkTheme XRDB resource class by adding an line to the
.Xresources file. The set of installed theme names is available using
the Tk command 'ttk::themes'. The default on X11 is similar to the current
un-themed style - a kind of thin bordered motif look.

A new git config variable 'gui.usettk' may be set to disable this if
the user prefers the classic Tk look. Using Tk 8.4 will also avoid the
use of themed widgets as these are only available since 8.5.

Some support is included for Tk 8.6 features (themed spinbox and native
font chooser for MacOSX and Windows).

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Update German translation (12 new or changed... Christian Stimming Tue, 26 Jan 2010 21:26:45 +0000 (22:26 +0100)

git-gui: Update German translation (12 new or changed strings).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Merge branch 'jc/upstream-reflog'Junio C Hamano Wed, 27 Jan 2010 22:58:21 +0000 (14:58 -0800)

Merge branch 'jc/upstream-reflog'

* jc/upstream-reflog:
Fix log -g this@{upstream}

Merge branch 'jc/maint-reflog-bad-timestamp'Junio C Hamano Wed, 27 Jan 2010 22:57:37 +0000 (14:57 -0800)

Merge branch 'jc/maint-reflog-bad-timestamp'

* jc/maint-reflog-bad-timestamp:
t0101: use a fixed timestamp when searching in the reflog
Update @{bogus.timestamp} fix not to die()
approxidate_careful() reports errorneous date string

Merge branch 'il/maint-colon-address'Junio C Hamano Wed, 27 Jan 2010 22:56:42 +0000 (14:56 -0800)

Merge branch 'il/maint-colon-address'

* il/maint-colon-address:
Allow use of []-wrapped addresses in git://
Support addresses with ':' in git-daemon

Merge branch 'il/maint-xmallocz'Junio C Hamano Wed, 27 Jan 2010 22:56:38 +0000 (14:56 -0800)

Merge branch 'il/maint-xmallocz'

* il/maint-xmallocz:
Fix integer overflow in unpack_compressed_entry()
Fix integer overflow in unpack_sha1_rest()
Fix integer overflow in patch_delta()
Add xmallocz()

Merge branch 'jh/maint-config-file-prefix'Junio C Hamano Wed, 27 Jan 2010 22:56:25 +0000 (14:56 -0800)

Merge branch 'jh/maint-config-file-prefix'

* jh/maint-config-file-prefix:
builtin-config: Fix crash when using "-f <relative path>" from non-root dir

transport_get(): drop unnecessary check for !remoteJunio C Hamano Wed, 27 Jan 2010 20:22:37 +0000 (12:22 -0800)

transport_get(): drop unnecessary check for !remote

At the beginning of the function we make sure remote is not NULL, and
the remainder of the funciton already depends on it.

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

Fix remote.<remote>.vcsIlari Liusvaara Wed, 27 Jan 2010 17:53:17 +0000 (19:53 +0200)

Fix remote.<remote>.vcs

remote.<remote>.vcs causes remote->foreign_vcs to be set on entry to
transport_get(). Unfortunately, the code assumed that any such entry
is stale from previous round.

Fix this by making VCS set by URL to be volatile w.r.t. transport_get()
instead.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0101: use a fixed timestamp when searching in the... Junio C Hamano Wed, 27 Jan 2010 18:54:22 +0000 (10:54 -0800)

t0101: use a fixed timestamp when searching in the reflog

That will give us a better reproducibility during tests.

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

Update @{bogus.timestamp} fix not to die()Junio C Hamano Wed, 27 Jan 2010 18:53:09 +0000 (10:53 -0800)

Update @{bogus.timestamp} fix not to die()

The caller will say "It is not a valid object name" if it wants to, and
some callers may even try to see if it names an object and otherwise try to
see if it is a path.

Pointed out by Jeff King.

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

Teach Makefile to check header dependenciesJonathan Nieder Tue, 26 Jan 2010 15:57:15 +0000 (09:57 -0600)

Teach Makefile to check header dependencies

Add a target to use the gcc-generated makefile snippets for
dependencies on header files to check the hard-coded dependencies.

With this patch applied, if any dependencies are missing, then

make clean
make COMPUTE_HEADER_DEPENDENCIES=YesPlease
make CHECK_HEADER_DEPENDENCIES=YesPlease

will produce an error message like the following:

CHECK fast-import.o
missing dependencies: exec_cmd.h
make: *** [fast-import.o] Error 1

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Makefile: list standalone program object files in PROGR... Jonathan Nieder Tue, 26 Jan 2010 15:54:23 +0000 (09:54 -0600)

Makefile: list standalone program object files in PROGRAM_OBJS

Because of new commands like git-remote-http, the OBJECTS list
contains fictitious objects such as remote-http.o. Thus any
out-of-tree rules that require all $(OBJECTS) to be buildable
are broken. Add a list of real program objects to avoid this
problem.

To avoid duplication of effort, calculate the command list in
the PROGRAMS variable using the expansion of PROGRAM_OBJS.
This calculation occurs at the time $(PROGRAMS) is expanded,
so later additions to PROGRAM_OBJS will be reflected in it,
provided they occur before the build rules begin on line 1489.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Merge branch 'jl/diff-submodule-ignore'Junio C Hamano Wed, 27 Jan 2010 06:53:13 +0000 (22:53 -0800)

Merge branch 'jl/diff-submodule-ignore'

* jl/diff-submodule-ignore:
Teach diff --submodule that modified submodule directory is dirty
git diff: Don't test submodule dirtiness with --ignore-submodules
Make ce_uptodate() trustworthy again

work around an obnoxious bash "safety feature" on OpenBSDJunio C Hamano Wed, 27 Jan 2010 00:29:30 +0000 (16:29 -0800)

work around an obnoxious bash "safety feature" on OpenBSD

Bash (4.0.24) on OpenBSD 4.6 refuses to run this snippet:

$ cat gomi.sh
#!/bin/sh
one="/var/tmp/1 1"
rm -f /var/tmp/1 "/var/tmp/1 1"
echo hello >$one
$ sh gomi.sh; ls /var/tmp/1*
/var/tmp/1 1
$ bash gomi.sh; ls /var/tmp/1*
gomi.sh: line 4: $one: ambiguous redirect
ls: /var/tmp/1*: No such file or directory

Every competent shell programmer knows that a <$word in redirection is not
subject to field splitting (POSIX.1 "2.7 Redirection" explicitly lists the
kind of expansion performed: "... the word that follows the redirection
operator shall be subjected to ...", and "Field Splitting" is not among
them).

Some clueless folks apparently decided that users need to be protected in
the name of "security", however.

Output from "git grep -e '> *\$' -- '*.sh'" indicates that rebase-i
suffers from this bogus "safety". Work it around by surrounding the
variable reference with a dq pair.

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

git-gui: Update translation templateShawn O. Pearce Tue, 26 Jan 2010 23:47:45 +0000 (15:47 -0800)

git-gui: Update translation template

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

fix portability issues with $ in double quotesStephen Boyd Tue, 26 Jan 2010 23:08:31 +0000 (15:08 -0800)

fix portability issues with $ in double quotes

Using a dollar sign in double quotes isn't portable. Escape them with
a backslash or replace the double quotes with single quotes.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

approxidate_careful() reports errorneous date stringJunio C Hamano Tue, 26 Jan 2010 19:58:00 +0000 (11:58 -0800)

approxidate_careful() reports errorneous date string

For a long time, the time based reflog syntax (e.g. master@{yesterday})
didn't complain when the "human readable" timestamp was misspelled, as
the underlying mechanism tried to be as lenient as possible. The funny
thing was that parsing of "@{now}" even relied on the fact that anything
not recognized by the machinery returned the current timestamp.

Introduce approxidate_careful() that takes an optional pointer to an
integer, that gets assigned 1 when the input does not make sense as a
timestamp.

As I am too lazy to fix all the callers that use approxidate(), most of
the callers do not take advantage of the error checking, but convert the
code to parse reflog to use it as a demonstration.

Tests are mostly from Jeff King.

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

Fix log -g this@{upstream}Junio C Hamano Tue, 26 Jan 2010 21:48:28 +0000 (13:48 -0800)

Fix log -g this@{upstream}

It showed the correct objects but walked a wrong reflog.
Again, tests are from Jeff King.

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

Fix integer overflow in unpack_compressed_entry()Ilari Liusvaara Tue, 26 Jan 2010 18:24:15 +0000 (20:24 +0200)

Fix integer overflow in unpack_compressed_entry()

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix integer overflow in unpack_sha1_rest()Ilari Liusvaara Tue, 26 Jan 2010 18:24:14 +0000 (20:24 +0200)

Fix integer overflow in unpack_sha1_rest()

[jc: later NUL termination by the caller becomes unnecessary]

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix integer overflow in patch_delta()Ilari Liusvaara Tue, 26 Jan 2010 18:24:13 +0000 (20:24 +0200)

Fix integer overflow in patch_delta()

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add xmallocz()Ilari Liusvaara Tue, 26 Jan 2010 18:24:12 +0000 (20:24 +0200)

Add xmallocz()

Add routine for allocating NUL-terminated memory block without risking
integer overflow in addition of +1 for NUL byte.

[jc: with suggestion from Bill Lear]

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-cvsserver: allow regex metacharacters in CVSROOTGerrit Pape Tue, 26 Jan 2010 14:47:16 +0000 (14:47 +0000)

git-cvsserver: allow regex metacharacters in CVSROOT

When run in a repository with a path name containing regex metacharacters
(e.g. +), git-cvsserver failed to split the client request into CVSROOT
and module. Now metacharacters are disabled for the value of CVSROOT in
the perl regex so that directory names containing metacharacters are
handled properly.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-config: Fix crash when using "-f <relative... Johan Herland Tue, 26 Jan 2010 15:02:16 +0000 (16:02 +0100)

builtin-config: Fix crash when using "-f <relative path>" from non-root dir

When your current directory is not at the root of the working tree, and you
use the "-f" option with a relative path, the current code tries to read
from a wrong file, since argv[2] is now beyond the end of the rearranged
argument list.

This patch replaces the incorrect argv[2] with the variable holding the
given config file name.

The bug was introduced by d64ec16 (git config: reorganize to use parseopt).

[jc: added test]

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Allow use of []-wrapped addresses in git://Ilari Liusvaara Tue, 26 Jan 2010 18:24:42 +0000 (20:24 +0200)

Allow use of []-wrapped addresses in git://

Allow using "["<host>"]":<port> and "["<host>"]" notations in git://
host addresses. This is needed to be able to connect to addresses
that contain ':' (e.g. numeric IPv6 addresses). Also send the host
header []-wrapped so it can actually be parsed by remote end.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Support addresses with ':' in git-daemonIlari Liusvaara Tue, 26 Jan 2010 18:24:41 +0000 (20:24 +0200)

Support addresses with ':' in git-daemon

If host address could have ':' in it (e.g. numeric IPv6 address), then
host and port could not be uniquely parsed. Fix this by parsing the
"["<host>"]":<port> and "["<host>"]" notations. Currently the built-in
git:// client would send <host>:<port> or <host> for such thing, but
it doesn't matter as due to bugs, resolving address fails if <host>
contains ':'.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: use REG_STARTEND (if available) to speed up regexecBenjamin Kramer Tue, 26 Jan 2010 17:48:36 +0000 (18:48 +0100)

grep: use REG_STARTEND (if available) to speed up regexec

BSD and glibc have an extension to regexec which takes a buffer + length pair
instead of a NUL-terminated string. Since we already have the length computed
this can save us a strlen call inside regexec.

Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Threaded grepFredrik Kuivinen Mon, 25 Jan 2010 22:51:39 +0000 (23:51 +0100)

Threaded grep

Make git grep use threads when it is available.

The results below are best of five runs in the Linux repository (on a
box with two cores).

With the patch:

git grep qwerty
1.58user 0.55system 0:01.16elapsed 183%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+800outputs (0major+5774minor)pagefaults 0swaps

Without:

git grep qwerty
1.59user 0.43system 0:02.02elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+800outputs (0major+3716minor)pagefaults 0swaps

And with a pattern with quite a few matches:

With the patch:

$ /usr/bin/time git grep void
5.61user 0.56system 0:03.44elapsed 179%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+800outputs (0major+5587minor)pagefaults 0swaps

Without:

$ /usr/bin/time git grep void
5.36user 0.51system 0:05.87elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+800outputs (0major+3693minor)pagefaults 0swaps

In either case we gain about 40% by the threading.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: lazily compute header dependenciesJonathan Nieder Tue, 26 Jan 2010 15:52:49 +0000 (09:52 -0600)

Makefile: lazily compute header dependencies

Use the gcc -MMD -MP -MF options to generate dependency rules as
a byproduct when building .o files if the
COMPUTE_HEADER_DEPENDENCIES variable is defined. That variable
is left undefined by default for now.

As each object file is built, write a makefile fragment
containing its dependencies in the deps/ subdirectory of its
containing directory. The deps/ directories should be generated
if they are missing at the start of each build. So let each
object file depend on $(missing_dep_dirs), which lists only the
directories of this kind that are missing to avoid needlessly
regenerating files when the directories' timestamps change.

gcc learned the -MMD -MP -MF options in version 3.0, so most gcc
users should have them by now.

The dependencies this option computes are more specific than the
rough estimates hard-coded in the Makefile, greatly speeding up
rebuilds when only a little-used header file has changed.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Makefile: list generated object files in OBJECTSJonathan Nieder Tue, 26 Jan 2010 15:52:11 +0000 (09:52 -0600)

Makefile: list generated object files in OBJECTS

Set the OBJECTS variable to a comprehensive list of all object
file targets. To make sure it is truly comprehensive, restrict
the scope of the %.o pattern rule to only generate objects in
this list.

Attempts to build other object files will fail loudly:

$ touch foo.c
$ make foo.o
make: *** No rule to make target `foo.o'. Stop.

providing a reminder to add the new object to the OBJECTS list.

The new variable is otherwise unused. The intent is for later
patches to take advantage of it.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Makefile: disable default implicit rulesJonathan Nieder Tue, 26 Jan 2010 15:51:24 +0000 (09:51 -0600)

Makefile: disable default implicit rules

The git makefile never uses any default implicit rules.
Unfortunately, if a prerequisite for one of the intended rules is
missing, a default rule can be used in its place:

$ make var.s
CC var.s
$ rm var.c
$ make var.o
as -o var.o var.s

Avoiding the default rules avoids this hard-to-debug behavior.
It also should speed things up a little in the normal case.

Future patches may restrict the scope of the %.o: %.c pattern.
This patch would then ensure that for targets not listed, we do
not fall back to the default rule.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Makefile: rearrange dependency rulesJonathan Nieder Tue, 26 Jan 2010 15:49:33 +0000 (09:49 -0600)

Makefile: rearrange dependency rules

Put rules listing dependencies of compiled objects (.o files) on
header files (.h files) in one place, to make them easier to
compare and modify all at once.

Add a GIT_OBJS variable listing objects that depend on LIB_H,
for similar reasons.

No change in build-time behavior intended.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Makefile: transport.o depends on branch.h nowJonathan Nieder Tue, 26 Jan 2010 15:47:25 +0000 (09:47 -0600)

Makefile: transport.o depends on branch.h now

Since commit e9fcd1e2 (Add push --set-upstream, 2010-01-16),
transport.c uses branch.h.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Merge branch 'master' of git://repo.or.cz/alt-git into... Jonathan Nieder Tue, 26 Jan 2010 16:08:44 +0000 (10:08 -0600)

Merge branch 'master' of git://repo.or.cz/alt-git into jn/autodep

* 'master' of git://repo.or.cz/alt-git: (384 commits)
am: fix patch format detection for Thunderbird "Save As" emails
t0022: replace non-portable literal CR
tests: consolidate CR removal/addition functions
commit-tree: remove unused #define
t5541-http-push: make grep expression check for one line only
rebase: replace antiquated sed invocation
Add test-run-command to .gitignore
git_connect: use use_shell instead of explicit "sh", "-c"
gitweb.js: Workaround for IE8 bug
Make test numbers unique
Windows: Remove dependency on pthreadGC2.dll
Documentation: move away misplaced 'push --upstream' description
Documentation: add missing :: in config.txt
pull: re-fix command line generation
Documentation: merge: use MERGE_HEAD to refer to the remote branch
Documentation: simplify How Merge Works
Documentation: merge: add a section about fast-forward
Documentation: emphasize when git merge terminates early
Documentation: merge: add an overview
Documentation: merge: move merge strategy list to end
...

Conflicts:
Makefile

Makefile: drop dependency on $(wildcard */*.h)Jonathan Nieder Tue, 26 Jan 2010 15:46:59 +0000 (09:46 -0600)

Makefile: drop dependency on $(wildcard */*.h)

The files this pulls in are already pulled in by other dependency
rules (some recently added).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Makefile: clean up http-walker.o dependency rulesJonathan Nieder Tue, 26 Jan 2010 15:46:37 +0000 (09:46 -0600)

Makefile: clean up http-walker.o dependency rules

http-walker.o depends on http.h twice: once in the rule listing
files that use http.h, and again in the rule explaining how to
build it. Messy.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Makefile: remove wt-status.h from LIB_HJonathan Nieder Tue, 26 Jan 2010 15:46:16 +0000 (09:46 -0600)

Makefile: remove wt-status.h from LIB_H

A list of the few translation units using this header is
half-populated already. Including the dependency on this header
twice (once explicitly, once through LIB_H) makes it difficult to
figure out where future headers should be added to the Makefile.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Makefile: make sure test helpers are rebuilt when heade... Jonathan Nieder Tue, 26 Jan 2010 15:45:54 +0000 (09:45 -0600)

Makefile: make sure test helpers are rebuilt when headers change

It is not worth the bother to maintain an up-to-date list of
which headers each test helper uses, so depend on $(LIB_H) to
catch them all.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Makefile: add missing header file dependenciesJonathan Nieder Tue, 26 Jan 2010 15:44:47 +0000 (09:44 -0600)

Makefile: add missing header file dependencies

LIB_H is missing exec_cmd.h and color.h. cache.h includes
SHA1_HEADER, and thus so does almost everything else, so add that
to LIB_H, too. xdiff-interface.h is not included by any header
files, but so many source files use xdiff that it is simplest to
include it in LIB_H, too.

xdiff-interface.o uses the xdiff library heavily; let it depend
on all xdiff headers to avoid needing to keep track of which
headers it uses.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

"log --author=me --grep=it" should find intersection... Junio C Hamano Mon, 18 Jan 2010 04:09:06 +0000 (20:09 -0800)

"log --author=me --grep=it" should find intersection, not union

Historically, any grep filter in "git log" family of commands were taken
as restricting to commits with any of the words in the commit log message.
However, the user almost always want to find commits "done by this person
on that topic". With "--all-match" option, a series of grep patterns can
be turned into a requirement that all of them must produce a match, but
that makes it impossible to ask for "done by me, on either this or that"
with:

log --author=me --committer=him --grep=this --grep=that

because it will require both "this" and "that" to appear.

Change the "header" parser of grep library to treat the headers specially,
and parse it as:

(all-match-OR (HEADER-AUTHOR me)
(HEADER-COMMITTER him)
(OR
(PATTERN this)
(PATTERN that) ) )

Even though the "log" command line parser doesn't give direct access to
the extended grep syntax to group terms with parentheses, this change will
cover the majority of the case the users would want.

This incidentally revealed that one test in t7002 was bogus. It ran:

log --author=Thor --grep=Thu --format='%s'

and expected (wrongly) "Thu" to match "Thursday" in the author/committer
date, but that would never match, as the timestamp in raw commit buffer
does not have the name of the day-of-the-week.

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

am: fix patch format detection for Thunderbird "Save... Stephen Boyd Tue, 26 Jan 2010 00:33:59 +0000 (16:33 -0800)

am: fix patch format detection for Thunderbird "Save As" emails

The patch detection wants to inspect all the headers of a rfc2822 message
and ensure that they look like header fields. The headers are always
separated from the message body with a blank line. When Thunderbird saves
the message the blank line separating the headers from the body includes a
CR. The patch detection is failing because a CRLF doesn't match /^$/. Fix
this by allowing a CR to exist on the separating line.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0022: replace non-portable literal CRStephen Boyd Tue, 26 Jan 2010 00:33:58 +0000 (16:33 -0800)

t0022: replace non-portable literal CR

We shouldn't have literal CR's in tests as they aren't portable.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: consolidate CR removal/addition functionsStephen Boyd Tue, 26 Jan 2010 00:33:57 +0000 (16:33 -0800)

tests: consolidate CR removal/addition functions

append_cr(), remove_cr(), q_to_nul() and q_to_cr() are defined in multiple
tests. Consolidate them into test-lib.sh so we can stop redefining them.
The use of remove_cr() in t0020 to test for a CR is replaced with a new
function has_cr() to accurately reflect what is intended (the output of
remove_cr() was being thrown away).

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: expose "status-only" feature via -qJunio C Hamano Mon, 25 Jan 2010 23:37:23 +0000 (15:37 -0800)

grep: expose "status-only" feature via -q

Teach "git grep" a new "-q" option to report the presense of a match via
its exit status without showing any output, similar to how "grep -q"
works. Internally "grep" engine already knew this "status-only" mode of
operation because it needed to grep inside log message to filter commits
when called from the "git log" machinery, and this patch only exposes it
to the command line tool.

A somewhat unfair benchmark in the Linux kernel directory shows a dramatic
improvement:

(with patch)
$ time ../git.git/git grep -q linux HEAD ; echo $?

real 0m0.030s
user 0m0.004s
sys 0m0.004s
0

(without patch)
$ time git grep linux HEAD >/dev/null; echo $?

real 0m4.432s
user 0m4.272s
sys 0m0.076s
0

This is "somewhat unfair" because I knew a file with such a string comes
very early in the tree traversal (namely, ".gitignore").

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

commit-tree: remove unused #defineStephen Boyd Mon, 25 Jan 2010 07:05:43 +0000 (23:05 -0800)

commit-tree: remove unused #define

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

t5541-http-push: make grep expression check for one... Tay Ray Chuan Mon, 25 Jan 2010 07:42:23 +0000 (15:42 +0800)

t5541-http-push: make grep expression check for one line only

Don't feed a multiple-line pattern to grep and expect the them to match
with lines in order.

Simplify the grep expressions in the non-fast-forward tests to check
only for the first line of the non-fast-forward warning - having that
line should be enough assurance that the full warning is printed.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: replace antiquated sed invocationStephen Boyd Mon, 25 Jan 2010 07:06:31 +0000 (23:06 -0800)

rebase: replace antiquated sed invocation

Use the modern form of printing a commit subject instead of piping
the output of rev-list to sed.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add test-run-command to .gitignoreAlejandro Riveira Fernández Mon, 25 Jan 2010 15:56:21 +0000 (16:56 +0100)

Add test-run-command to .gitignore

Add test-run-command to .gitignore so it does not pollute
git status output.

Signed-off-by: Alejandro Riveira Fernández <ariveira@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git_connect: use use_shell instead of explicit "sh... Johannes Sixt Mon, 25 Jan 2010 12:32:44 +0000 (13:32 +0100)

git_connect: use use_shell instead of explicit "sh", "-c"

This is a followup to ac0ba18 (run-command: convert simple callsites to
use_shell, 2009-12-30), for consistency.

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

git-gui: Remove unused icon file_parttickShawn O. Pearce Mon, 25 Jan 2010 15:33:41 +0000 (07:33 -0800)

git-gui: Remove unused icon file_parttick

This icon hasn't been used in git gui. I think it dates back to
the original set of icons I took from Paul Mackerras' prototype
that I turned into git gui.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: use different icon for new and modified files... Peter Oberndorfer Sun, 24 Jan 2010 18:54:19 +0000 (19:54 +0100)

git-gui: use different icon for new and modified files in the index

This allows to quickly differentiate between new and modified files
in the index without selecting the file and looking at the diff.

Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Teach diff --submodule that modified submodule director... Jens Lehmann Sun, 24 Jan 2010 14:09:00 +0000 (15:09 +0100)

Teach diff --submodule that modified submodule directory is dirty

Since commit 8e08b4 git diff does append "-dirty" to the work tree side
if the working directory of a submodule contains new or modified files.
Lets do the same when the --submodule option is used.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git diff: Don't test submodule dirtiness with --ignore... Jens Lehmann Sat, 23 Jan 2010 16:37:26 +0000 (17:37 +0100)

git diff: Don't test submodule dirtiness with --ignore-submodules

The diff family suppresses the output of submodule changes when
requested but checks them nonetheless. But since recently submodules
get examined for their dirtiness, which is rather expensive. There is
no need to do that when the --ignore-submodules option is used, as
the gathered information is never used anyway.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb.js: Workaround for IE8 bug v1.7.0-rc0Jakub Narebski Sun, 24 Jan 2010 18:05:23 +0000 (19:05 +0100)

gitweb.js: Workaround for IE8 bug

In Internet Explorer 8 (IE8) the 'blame_incremental' view, which uses
JavaScript to generate blame info using AJAX, sometimes hang at the
beginning (at 0%) of blaming, e.g. for larger files with long history
like git's own gitweb/gitweb.perl.

The error shown by JavaScript console is "Unspecified error" at char:2
of the following line in gitweb/gitweb.js:

if (xhr.readyState === 3 && xhr.status !== 200) {

Debugging it using IE8 JScript debuger shown that the error occurs
when trying to access xhr.status (xhr is XMLHttpRequest object).
Watch for xhr object shows 'Unspecified error.' as "value" of
xhr.status, and trying to access xhr.status from console throws error.

This bug is some intermittent bug, depending on XMLHttpRequest timing,
as it doesn't occur in all cases. It is probably caused by the fact
that handleResponse is called from timer (pollTimer), to work around
the fact that some browsers call onreadystatechange handler only once
for each state change, and not like required for 'blame_incremental'
as soon as new data is available from server. It looks like xhr
object is not properly initialized; still it is a bug to throw an
error when accessing xhr.status (and not use 'null' or 'undefined' as
value).

Work around this bug in IE8 by using try-catch block when accessing
xhr.status.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset: add test cases for "--keep" optionChristian Couder Tue, 19 Jan 2010 04:25:58 +0000 (05:25 +0100)

reset: add test cases for "--keep" option

This shows that with the "--keep" option, changes that are both in
the work tree and the index are kept in the work tree after the
reset (but discarded in the index).

In the case of unmerged entries, we can see that "git reset --keep"
works only when the target state is the same as HEAD. And then the
work tree is not reset.

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

reset: add option "--keep" to "git reset"Christian Couder Tue, 19 Jan 2010 04:25:57 +0000 (05:25 +0100)

reset: add option "--keep" to "git reset"

The purpose of this new option is to discard some of the
last commits but to keep current changes in the work tree.

The use case is when you work on something and commit
that work. And then you work on something else that touches
other files, but you don't commit it yet. Then you realize
that what you commited when you worked on the first thing
is not good or belongs to another branch.

So you want to get rid of the previous commits (at least in
the current branch) but you want to make sure that you keep
the changes you have in the work tree. And you are pretty
sure that your changes are independent from what you
previously commited, so you don't want the reset to succeed
if the previous commits changed a file that you also
changed in your work tree.

The table below shows what happens when running
"git reset --keep target" to reset the HEAD to another
commit (as a special case "target" could be the same as
HEAD).

working index HEAD target working index HEAD
----------------------------------------------------
A B C D --keep (disallowed)
A B C C --keep A C C
B B C D --keep (disallowed)
B B C C --keep B C C

In this table, A, B and C are some different states of
a file. For example the last line of the table means
that if a file is in state B in the working tree and
the index, and in a different state C in HEAD and in
the target, then "git reset --keep target" will put
the file in state B in the working tree, and in state
C in the index and in HEAD.

The following table shows what happens on unmerged entries:

working index HEAD target working index HEAD
----------------------------------------------------
X U A B --keep (disallowed)
X U A A --keep X A A

In this table X can be any state and U means an unmerged
entry.

Though the error message when "reset --keep" is disallowed
on unmerged entries is something like:

error: Entry 'file1' would be overwritten by merge. Cannot merge.
fatal: Could not reset index file to revision 'HEAD^'.

which is not very nice.

A following patch will add some test cases for "--keep".

The "--keep" option is implemented by doing a 2 way merge
between HEAD and the reset target, and if this succeeds
by doing a mixed reset to the target.

The code comes from the sequencer GSoC project, where
such an option was developed by Stephan Beyer:

git://repo.or.cz/git/sbeyer.git

(at commit 5a78908b70ceb5a4ea9fd4b82f07ceba1f019079)

But in the sequencer project the "reset" flag was set
in the "struct unpack_trees_options" passed to
"unpack_trees()". With this flag the changes in the
working tree were discarded if the file was different
between HEAD and the reset target.

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