Code

git.git
14 years agoRPM packaging: don't include foreign-scm-helper bits yet
Junio 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>
14 years agogrep: Fix two memory leaks
Dan 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>
14 years agorebase: don't invoke the pager for each commit summary
Markus 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>
14 years agoUpdate draft release notes to 1.7.0
Junio 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>
14 years agoMerge 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

14 years agoMerge branch 'maint-1.6.5' into maint
Junio 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

14 years agoImplement pthread_cond_broadcast on Windows
Johannes 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>
14 years agoIf deriving SVN_SSH from GIT_SSH on msys, also add quotes
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>
14 years agoMerge git://git.kernel.org/pub/scm/gitk/gitk
Junio 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

14 years agoadd shebang line to git-mergetool--lib.sh
Jeff 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>
14 years agofix off-by-one allocation error
Jeff 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>
14 years agofix memcpy of overlapping area
Jeff 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>
14 years agoMerge 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"

14 years agogit-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>
14 years agogitk: Update German translation
Christian 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>
14 years agogitk: Add French translation
Emmanuel 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>
14 years agogitk: update Italian translation
Michele 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>
14 years agogitk: Update Swedish translation
Peter 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>
14 years agogit-gui: Quote git path when starting another gui in a submodule
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>
14 years agoMerge 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

14 years agobash: support 'git notes' and its subcommands
SZEDER 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>
14 years agofilter-branch: Add tests for submodules in tree-filter
Michal 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>
14 years agofilter-branch: Fix to allow replacing submodules with another content
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>
14 years agobash: don't offer remote transport helpers as subcommands
SZEDER 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>
14 years agogrep --quiet: finishing touches
Junio 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>
14 years agoreject @{-1} not at beginning of object name
Jeff 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>
14 years agofix parsing of @{-1}@{u} combination
Jeff 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>
14 years agotest combinations of @{} syntax
Jeff 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>
14 years agorerere: fix too-short initialization
Jeff 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>
14 years agogit-gui: update Italian translation
Michele 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>
14 years agogit-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>
14 years agot0101: use absolute date
Jeff 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>
14 years agoMerge 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

14 years agoMerge 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

14 years agotests: update tests that used to fail
Junio 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>
14 years agogit-gui: use themed tk widgets with Tk 8.5
Pat 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>
14 years agogit-gui: Update German translation (12 new or changed strings).
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>
14 years agoMerge 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}

14 years agoMerge 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

14 years agoMerge 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

14 years agoMerge 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()

14 years agoMerge 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

14 years agotransport_get(): drop unnecessary check for !remote
Junio 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>
14 years agoFix remote.<remote>.vcs
Ilari 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>
14 years agot0101: use a fixed timestamp when searching in the reflog
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>
14 years agoUpdate @{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>
14 years agoMerge 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

14 years agowork around an obnoxious bash "safety feature" on OpenBSD
Junio 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>
14 years agogit-gui: Update translation template
Shawn 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>
14 years agofix portability issues with $ in double quotes
Stephen 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>
14 years agoapproxidate_careful() reports errorneous date string
Junio 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>
14 years agoFix 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>
14 years agoFix 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>
14 years agoFix 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>
14 years agoFix 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>
14 years agoAdd 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>
14 years agogit-cvsserver: allow regex metacharacters in CVSROOT
Gerrit 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>
14 years agobuiltin-config: Fix crash when using "-f <relative path>" from non-root dir
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>
14 years agoAllow 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>
14 years agoSupport addresses with ':' in git-daemon
Ilari 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>
14 years agogrep: use REG_STARTEND (if available) to speed up regexec
Benjamin 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>
14 years agoThreaded grep
Fredrik 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>
14 years agoam: fix patch format detection for Thunderbird "Save As" emails
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>
14 years agot0022: replace non-portable literal CR
Stephen 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>
14 years agotests: consolidate CR removal/addition functions
Stephen 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>
14 years agogrep: expose "status-only" feature via -q
Junio 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>
14 years agocommit-tree: remove unused #define
Stephen 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>
14 years agot5541-http-push: make grep expression check for one line only
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>
14 years agorebase: replace antiquated sed invocation
Stephen 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>
14 years agoAdd test-run-command to .gitignore
Alejandro 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>
14 years agogit_connect: use use_shell instead of explicit "sh", "-c"
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>
14 years agogit-gui: Remove unused icon file_parttick
Shawn 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>
14 years agogit-gui: use different icon for new and modified files in the index
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>
14 years agoTeach diff --submodule that modified submodule directory is dirty
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>
14 years agogit diff: Don't test submodule dirtiness with --ignore-submodules
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>
14 years agogitweb.js: Workaround for IE8 bug v1.7.0-rc0
Jakub 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>
14 years agoMerge branch 'jc/fix-tree-walk'
Junio C Hamano [Mon, 25 Jan 2010 01:35:58 +0000 (17:35 -0800)]
Merge branch 'jc/fix-tree-walk'

* jc/fix-tree-walk:
  read-tree --debug-unpack
  unpack-trees.c: look ahead in the index
  unpack-trees.c: prepare for looking ahead in the index
  Aggressive three-way merge: fix D/F case
  traverse_trees(): handle D/F conflict case sanely
  more D/F conflict tests
  tests: move convenience regexp to match object names to test-lib.sh

Conflicts:
builtin-read-tree.c
unpack-trees.c
unpack-trees.h

14 years agoMake test numbers unique
Johannes Sixt [Sun, 24 Jan 2010 21:40:20 +0000 (22:40 +0100)]
Make test numbers unique

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Sun, 24 Jan 2010 19:18:05 +0000 (11:18 -0800)]
Merge branch 'maint'

* maint:
  git-gui: work from the .git dir
  git-gui: Fix applying a line when all following lines are deletions
  git-gui: Correct file_states when unstaging partly staged entry
  git-gui: Fix gitk for branch whose name matches local file
  git-gui: Keep repo_config(gui.recentrepos) and .gitconfig in sync
  git-gui: handle really long error messages in updateindex.
  git-gui: Add hotkeys for "Unstage from commit" and "Revert changes"
  git-gui: Makefile: consolidate .FORCE-* targets

14 years agoMerge branch 'maint' of git://git.spearce.org/git-gui into maint
Junio C Hamano [Sun, 24 Jan 2010 19:16:26 +0000 (11:16 -0800)]
Merge branch 'maint' of git://git.spearce.org/git-gui into maint

* 'maint' of git://git.spearce.org/git-gui:
  git-gui: work from the .git dir
  git-gui: Fix applying a line when all following lines are deletions
  git-gui: Correct file_states when unstaging partly staged entry
  git-gui: Fix gitk for branch whose name matches local file
  git-gui: Keep repo_config(gui.recentrepos) and .gitconfig in sync
  git-gui: handle really long error messages in updateindex.
  git-gui: Add hotkeys for "Unstage from commit" and "Revert changes"
  git-gui: Makefile: consolidate .FORCE-* targets

14 years agoWindows: Remove dependency on pthreadGC2.dll
Michael Lukashov [Sun, 24 Jan 2010 10:10:30 +0000 (10:10 +0000)]
Windows: Remove dependency on pthreadGC2.dll

Commit 44626dc7 (MSVC: Windows-native implementation for subset
of threads API, 2010-01-15) introduces builtin replacement of
pthreadGC2.dll functionality, thus we can completely drop
dependency on this dll.

Signed-off-by: Michael Lukashov <michael.lukashov@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: move away misplaced 'push --upstream' description
Thomas Rast [Sat, 23 Jan 2010 22:18:23 +0000 (23:18 +0100)]
Documentation: move away misplaced 'push --upstream' description

e9fcd1e (Add push --set-upstream, 2010-01-16) inadvertently patched
the description of --upstream in the middle of that of --repo.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: add missing :: in config.txt
Thomas Rast [Sat, 23 Jan 2010 22:13:17 +0000 (23:13 +0100)]
Documentation: add missing :: in config.txt

bed575e (commit: support commit.status, --status, and --no-status,
2009-12-07) forgot to add the :: that sets off an item from the
paragraph that explains it, breaking the layout.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'doc-style/for-next' of git://repo.or.cz/git/trast
Junio C Hamano [Sun, 24 Jan 2010 18:58:57 +0000 (10:58 -0800)]
Merge branch 'doc-style/for-next' of git://repo.or.cz/git/trast

* 'doc-style/for-next' of git://repo.or.cz/git/trast:
  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
  Documentation: suggest `reset --merge` in How Merge Works section
  Documentation: merge: move configuration section to end
  Documentation: emphasise 'git shortlog' in its synopsis
  Documentation: show-files is now called git-ls-files
  Documentation: tiny git config manual tweaks
  Documentation: git gc packs refs by default now

Conflicts:
Documentation/config.txt

14 years agopull: re-fix command line generation
Junio C Hamano [Sun, 24 Jan 2010 18:11:27 +0000 (10:11 -0800)]
pull: re-fix command line generation

14e5d40 (pull: Fix parsing of -X<option>, 2010-01-17) forgot that
merge_name needs to stay as a single non-interpolated string.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: merge: use MERGE_HEAD to refer to the remote branch
Jonathan Nieder [Sat, 23 Jan 2010 22:48:40 +0000 (16:48 -0600)]
Documentation: merge: use MERGE_HEAD to refer to the remote branch

commit 57bddb11 (Documentation/git-merge: reword references to
"remote" and "pull", 2010-01-07) fixed the manual to drop the
assumption that the other branch being merged is from a remote
repository.  Unfortunately, in a few places, to do so it
introduced the antecedentless phrase "their versions".  Worse, in
passages like the following, 'they' is playing two roles.

|   highlighting changes from both the HEAD and their versions.
|
| * Look at the diffs on their own. 'git log --merge -p <path>'

Using HEAD and MERGE_HEAD nicely assigns terminology to "our" and
"their" sides.  It also provides the reader with practice using
names that git will recognize on the command line.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
14 years agoDocumentation: simplify How Merge Works
Jonathan Nieder [Sat, 23 Jan 2010 09:48:42 +0000 (03:48 -0600)]
Documentation: simplify How Merge Works

The user most likely does not care about the exact order of
operations because he cannot see it happening anyway.  Instead,
try to explain what it means to merge two commits into a single
tree.

While at it:

 - Change the heading to TRUE MERGE.  The entire manual page is
   about how merges work.

 - Document MERGE_HEAD.  It is a useful feature, since it makes
   the parents of the intended merge commit easier to refer to.

 - Do not assume commits named on the 'git merge' command line come
   from another repository.  For simplicity, the discussion of
   conflicts still does assume that there is only one and it is a
   branch head.

 - Do not start list items with `code`.  Otherwise, a toolchain bug
   produces a line break in the generated nroff, resulting in odd
   extra space.

Suggested-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
14 years agoDocumentation: merge: add a section about fast-forward
Jonathan Nieder [Sat, 23 Jan 2010 09:45:33 +0000 (03:45 -0600)]
Documentation: merge: add a section about fast-forward

Novices sometimes find the behavior of 'git merge' in the
fast-forward case surprising.  Describe it thoroughly.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
14 years agoDocumentation: emphasize when git merge terminates early
Jonathan Nieder [Sat, 23 Jan 2010 09:44:17 +0000 (03:44 -0600)]
Documentation: emphasize when git merge terminates early

A merge-based operation in git can fail in two ways: one that
stops before touching anything, or one that goes ahead and
results in conflicts.

As the 'git merge' manual explains:

| A merge is always between the current `HEAD` and one or more
| commits (usually, branch head or tag), and the index file must
| match the tree of `HEAD` commit (i.e. the contents of the last commit)
| when it starts out.

Unfortunately, the placement of this sentence makes it easy to
skip over, and its formulation leaves the important point, that
any other attempted merge will be gracefully aborted, unspoken.

So give this point its own section and expand upon it.

Probably this could be simplified somewhat: after all, a change
registered in the index is just a special kind of local
uncommited change, so the second added paragraph is only a
special case of the first.  It seemed more helpful to be explicit
here.

Inspired by <http://gitster.livejournal.com/25801.html>.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
14 years agoDocumentation: merge: add an overview
Jonathan Nieder [Sat, 23 Jan 2010 09:42:46 +0000 (03:42 -0600)]
Documentation: merge: add an overview

The reader unfamiliar with the concepts of branching and merging
would have been completely lost.  Try to help him with a diagram.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
14 years agoDocumentation: merge: move merge strategy list to end
Jonathan Nieder [Sat, 23 Jan 2010 09:33:37 +0000 (03:33 -0600)]
Documentation: merge: move merge strategy list to end

So the section layout changes as follows:

 NAME
 SYNOPSIS
 DESCRIPTION
 OPTIONS
-MERGE STRATEGIES
 HOW MERGE WORKS
 HOW CONFLICTS ARE PRESENTED
 HOW TO RESOLVE CONFLICTS
 EXAMPLES
+MERGE STRATEGIES
 CONFIGURATION
 SEE ALSO
 AUTHOR
 DOCUMENTATION
 GIT
 NOTES

The first-time user will care more about conflicts than about
strategies other than 'recursive'.

One of the examples uses -s ours, but I do not think this hinders
readability.

Suggested-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
14 years agoDocumentation: suggest `reset --merge` in How Merge Works section
Jonathan Nieder [Sat, 23 Jan 2010 09:31:19 +0000 (03:31 -0600)]
Documentation: suggest `reset --merge` in How Merge Works section

The 'merge' manual suggests 'reset' to cancel a merge at the end
of the Merge Strategies list.  It is more logical to explain this
right before explaining how merge conflicts work, so the daunted
reader can have a way out when he or she needs it most.

While at it, make the advice more dependable and self-contained
by providing the --merge option.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
14 years agoDocumentation: merge: move configuration section to end
Jonathan Nieder [Sat, 23 Jan 2010 09:26:57 +0000 (03:26 -0600)]
Documentation: merge: move configuration section to end

Configuration and environment variables belong to the back matter
of a manual page.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
14 years agoMake ce_uptodate() trustworthy again
Junio C Hamano [Sun, 24 Jan 2010 08:10:20 +0000 (00:10 -0800)]
Make ce_uptodate() trustworthy again

The rule has always been that a cache entry that is ce_uptodate(ce)
means that we already have checked the work tree entity and we know
there is no change in the work tree compared to the index, and nobody
should have to double check.  Note that false ce_uptodate(ce) does not
mean it is known to be dirty---it only means we don't know if it is
clean.

There are a few codepaths (refresh-index and preload-index are among
them) that mark a cache entry as up-to-date based solely on the return
value from ie_match_stat(); this function uses lstat() to see if the
work tree entity has been touched, and for a submodule entry, if its
HEAD points at the same commit as the commit recorded in the index of
the superproject (a submodule that is not even cloned is considered
clean).

A submodule is no longer considered unmodified merely because its HEAD
matches the index of the superproject these days, in order to prevent
people from forgetting to commit in the submodule and updating the
superproject index with the new submodule commit, before commiting the
state in the superproject.  However, the patch to do so didn't update
the codepath that marks cache entries up-to-date based on the updated
definition and instead worked it around by saying "we don't trust the
return value of ce_uptodate() for submodules."

This makes ce_uptodate() trustworthy again by not marking submodule
entries up-to-date.

The next step _could_ be to introduce a few "in-core" flag bits to
cache_entry structure to record "this entry is _known_ to be dirty",
call is_submodule_modified() from ie_match_stat(), and use these new
bits to avoid running this rather expensive check more than once, but
that can be a separate patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorebase -i: Export GIT_AUTHOR_* variables explicitly
Junio C Hamano [Fri, 22 Jan 2010 21:09:24 +0000 (13:09 -0800)]
rebase -i: Export GIT_AUTHOR_* variables explicitly

There is no point doing self-assignments of these variables.  Instead,
just export them to the environment, but do so in a sub-shell, because

VAR1=VAL1 VAR2=VAL2 ... command arg1 arg2...

does not mark the variables exported if command that is run
is a shell function, according to POSIX.1.

The callers of do_with_author do not rely on seeing the effect of any
shell variable assignments that may happen inside what was called through
this shell function (currently "output" is the only one), so running it in
the subshell doesn't have an adverse semantic effect.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-gui: set GIT_DIR and GIT_WORK_TREE after setup
Giuseppe Bilotta [Sat, 23 Jan 2010 23:59:00 +0000 (00:59 +0100)]
git-gui: set GIT_DIR and GIT_WORK_TREE after setup

Rather than juggling with the env var GIT_DIR around the invocation of
gitk, set it and GIT_WORK_TREE after finishing setup, ensuring that any
external tool works with the setup we're running with.

This also allows us to remove a couple of conditionals when running gitk
or git gui in a submodule, as we know that the variables are present and
have to be unset and reset before and after the invocation.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agogit-gui: update shortcut tools to use _gitworktree
Giuseppe Bilotta [Sat, 23 Jan 2010 10:03:38 +0000 (11:03 +0100)]
git-gui: update shortcut tools to use _gitworktree

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agogit-gui: handle bare repos correctly
Giuseppe Bilotta [Sat, 23 Jan 2010 10:03:35 +0000 (11:03 +0100)]
git-gui: handle bare repos correctly

Refactor checking for a bare repository into its own proc, that relies
on git rev-parse --is-bare-repository if possible. For older versions of
git we fall back to a logic such that the repository is considered bare
if:
 * either the core.bare setting is true
 * or the worktree is not set and the directory name ends with .git
The error message for the case of an unhandled bare repository is also
updated to reflect the fact that the problem is not the funny name but
the bareness.

The new refactored proc is also used to disable the menu entry to
explore the working copy, and to skip changing to the worktree before
the gitk invocation.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agogit-gui: handle non-standard worktree locations
Giuseppe Bilotta [Sat, 23 Jan 2010 10:03:34 +0000 (11:03 +0100)]
git-gui: handle non-standard worktree locations

Don't rely on the git worktree being the updir of the gitdir, since it
might not be. Instead, define (and use) a new _gitworktree global
variable, setting it to $GIT_WORK_TREE if present, falling back to
core.worktree if defined, and finally to whatever we guess the correct
worktree is. Getting core.worktree requires the config from the alleged
git dir _gitdir to be loaded early.

Supporting non-standard worktree locations also breaks the git-gui
assumption (made when calling gitk) that the worktree was the dirname of
$_gitdir and that, by consequence, the git dir could be set to the tail
of $_gitdir once we changed to the worktree root directory. Therefore,
we need to export a GIT_DIR environment variable set to the full,
normalized path of $_gitdir instead. We also skip changing to the worktree
directory if it's empty (i.e. if we're working on a bare repository).

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agogit-gui: Support applying a range of changes at once
Jeff Epler [Tue, 8 Dec 2009 00:22:43 +0000 (18:22 -0600)]
git-gui: Support applying a range of changes at once

Multiple lines can be selected in the diff viewer and applied all
at once, rather than selecting "Stage Line For Commit" on each
individual line.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>