Code

git.git
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 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 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 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 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 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 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 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 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: work from the .git dir
Giuseppe Bilotta [Sat, 23 Jan 2010 10:03:36 +0000 (11:03 +0100)]
git-gui: work from the .git dir

When git-gui is run from a .git dir, _gitdir would be set to "." by
rev-parse, something that confuses the worktree detection.

Fix by expanding the value of _gitdir to pwd in this special case.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agogit-gui: Fix applying a line when all following lines are deletions
Jeff Epler [Tue, 8 Dec 2009 00:22:42 +0000 (18:22 -0600)]
git-gui: Fix applying a line when all following lines are deletions

If a diff looked like:

 @@
  context
 -del1
 -del2

and you wanted to stage the deletion 'del1', the generated patch
wouldn't apply because it was missing the line 'del2' converted to
context, but this line was counted in the @@-line

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agogit-gui: Correct file_states when unstaging partly staged entry
Jens Lehmann [Mon, 7 Dec 2009 20:35:59 +0000 (21:35 +0100)]
git-gui: Correct file_states when unstaging partly staged entry

When unstaging a partly staged file or submodule, the file_states
list was not updated properly (unless unstaged linewise). Its
index_info part did not contain the former head_info as it should
have but kept its old value.

This seems not to have had any bad effects but diminishes the value
of the file_states list for future enhancements.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agogit-gui: Fix gitk for branch whose name matches local file
Peter Krefting [Thu, 21 Jan 2010 12:15:17 +0000 (13:15 +0100)]
git-gui: Fix gitk for branch whose name matches local file

When trying to run gitk on a branch name whose name matches a local
file, it will toss an error saying that the name is ambiguous. Adding
a pair of dashes will make gitk parse the options to the left of
it as branch names. Since wish eats the first pair of dashes we
throw at it, we need to add a second one to ensure they get through.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agogit-gui: Keep repo_config(gui.recentrepos) and .gitconfig in sync
Christopher Beelby [Sat, 23 Jan 2010 22:37:17 +0000 (14:37 -0800)]
git-gui: Keep repo_config(gui.recentrepos) and .gitconfig in sync

When the number of recent repo's gets to ten there can be a
situation where an item is removed from the .gitconfig file via
a call to git config --unset, but the internal representation of
that file (repo_config(gui.recentrepo)) is not updated.  Then a
subsequent attempt to remove an item from the list fails because
git-gui attempts to call --unset on a value that has already
been removed.  This leads to duplicates in the .gitconfig file,
which then also cause errors if the git-gui tries to --unset them
(rather than using --unset-all. --unset-all is not used because it
is not expected that duplicates should ever be allowed to exist.)

When loading the list of recent repositories (proc _get_recentrepos)
if a repo in the list is not considered a valid git reposoitory
then we should go ahead and remove it so it doesn't take up a slot
in the list (since we limit to 10 items). This will prevent a bunch
of invalid entries in the list (which are not shown) from making
valid entries dissapear off the list even when there are less than
ten valid entries.

See: http://code.google.com/p/msysgit/issues/detail?id=362
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agogit-gui: handle really long error messages in updateindex.
Pat Thoyts [Sun, 20 Dec 2009 02:02:03 +0000 (02:02 +0000)]
git-gui: handle really long error messages in updateindex.

As reported to msysGit (bug #340) it is possible to get some very
long error messages when updating the index. The use of a label to
display this prevents scrolling the output. This patch replaces the
label with a scrollable text widget configured to look like a label.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoDocumentation: rev-list: fix synopsys for --tags and and --remotes
Christian Couder [Sat, 23 Jan 2010 07:26:26 +0000 (08:26 +0100)]
Documentation: rev-list: fix synopsys for --tags and and --remotes

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge git://git.bogomips.org/git-svn
Junio C Hamano [Sat, 23 Jan 2010 18:42:47 +0000 (10:42 -0800)]
Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
  git-svn: allow subset of branches/tags to be specified in glob spec
  git-svn: allow UUID to be manually remapped via rewriteUUID
  git-svn: update svn mergeinfo test suite
  git-svn: document --username/commit-url for branch/tag
  git-svn: add --username/commit-url options for branch/tag
  git-svn: respect commiturl option for branch/tag
  git-svn: fix mismatched src/dst errors for branch/tag
  git-svn: handle merge-base failures
  git-svn: ignore changeless commits when checking for a cherry-pick

14 years agogit-svn: allow subset of branches/tags to be specified in glob spec
Jay Soffian [Sat, 23 Jan 2010 08:30:01 +0000 (03:30 -0500)]
git-svn: allow subset of branches/tags to be specified in glob spec

For very large projects it is useful to be able to clone a subset of the
upstream SVN repo's branches. Allow for this by letting the left-side of
the branches and tags glob specs contain a brace-delineated comma-separated
list of names. e.g.:

branches = branches/{red,green}/src:refs/remotes/branches/*

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: allow UUID to be manually remapped via rewriteUUID
Jay Soffian [Sat, 23 Jan 2010 08:30:00 +0000 (03:30 -0500)]
git-svn: allow UUID to be manually remapped via rewriteUUID

In certain situations it may be necessary to manually remap an svn
repostitory UUID. For example:

                  o--- [git-svn clone]
                 /
[origin svn repo]
                 \
                  o--- [svnsync clone]

Imagine that only "git-svn clone" and "svnsync clone" are made available
to external users. Furthur, "git-svn clone" contains only trunk, and for
reasons unknown, "svnsync clone" is missing the revision properties that
normally provide the origin svn repo's UUID.

A git user who has cloned the "git-svn clone" repo now wishes to use
git-svn to pull in the missing branches from the "synsync clone" repo.
In order for git-svn to get the history correct for those branches,
it needs to know the origin svn repo's UUID. Hence rewriteUUID.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: update svn mergeinfo test suite
Andrew Myrick [Thu, 21 Jan 2010 21:55:48 +0000 (21:55 +0000)]
git-svn: update svn mergeinfo test suite

Add a partial branch (e.g., a branch from a project subdirectory) to the
git-svn mergeinfo test repository.

Add a tag and a branch from that tag to the git-svn mergeinfo test repository.

Update the test script to expect a known failure in git-svn exposed by these
additions where merge info for partial branches is not preserved.

Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: document --username/commit-url for branch/tag
Igor Mironov [Mon, 11 Jan 2010 16:22:27 +0000 (03:22 +1100)]
git-svn: document --username/commit-url for branch/tag

[ew: shortened subject]

Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: add --username/commit-url options for branch/tag
Igor Mironov [Mon, 11 Jan 2010 16:21:51 +0000 (03:21 +1100)]
git-svn: add --username/commit-url options for branch/tag

Add ability to specify on the command line the username to perform the
operation as and the writable URL of the repository to perform it on.

[ew: shortened subject]

Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: respect commiturl option for branch/tag
Igor Mironov [Mon, 11 Jan 2010 16:21:23 +0000 (03:21 +1100)]
git-svn: respect commiturl option for branch/tag

When constructing a destination URL, use the property 'commiturl' if it
is specified in the configuration file; otherwise take 'url' as usual.
This accommodates the scenario where a user only wants to involve the
writable repository in operations performing a commit and defaults
everything else to a read-only URL.

[ew: shortened subject]

Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: fix mismatched src/dst errors for branch/tag
Igor Mironov [Mon, 11 Jan 2010 16:20:43 +0000 (03:20 +1100)]
git-svn: fix mismatched src/dst errors for branch/tag

This fixes the following issue:

$ git svn branch -t --username=svnuser \
  --commit-url=https://myproj.domain.com/svn mytag
Copying http://myproj.domain.com/svn/trunk at r26 to
https://myproj.domain.com/svn/tags/mytag...

Trying to use an unsupported feature: Source and dest appear not to be
in the same repository (src: 'http://myproj.domain.com/svn/trunk';
dst: 'https://myproj.domain.com/svn/tags/mytag')

[ew: shortened subject]

Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: handle merge-base failures
Andrew Myrick [Thu, 7 Jan 2010 00:25:22 +0000 (16:25 -0800)]
git-svn: handle merge-base failures

Change git-svn to warn and continue when merge-base fails while processing svn
merge tickets.

merge-base can fail when a partial branch is created and merged back to trunk
in svn, because it cannot find a common ancestor between the partial branch and
trunk.

Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agogit-svn: ignore changeless commits when checking for a cherry-pick
Andrew Myrick [Thu, 7 Jan 2010 00:25:21 +0000 (16:25 -0800)]
git-svn: ignore changeless commits when checking for a cherry-pick

Update git-svn to ignore commits that do not change the tree when it is
deciding if an svn merge ticket represents a real branch merge or just a
cherry-pick.

Consider the following integration model in the svn repository:

   F---G  branch1
  /     \
 D  tag1 \   E  tag2
/         \ /
A---B      C  trunk

branch1 is merged to trunk in commit C.

With this patch, git-svn will correctly identify branch1 as a proper merge
parent, instead of incorrectly ignoring it as a cherry-pick.

Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
14 years agot7800-difftool.sh: Test mergetool.prompt fallback
David Aguilar [Sat, 23 Jan 2010 06:03:36 +0000 (22:03 -0800)]
t7800-difftool.sh: Test mergetool.prompt fallback

4cacc621 made difftool fall back to mergetool.prompt
when difftool.prompt is unconfigured.  This adds a test.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomsvc: Add a definition of NORETURN compatible with msvc compiler
Ramsay Jones [Wed, 20 Jan 2010 19:45:12 +0000 (19:45 +0000)]
msvc: Add a definition of NORETURN compatible with msvc compiler

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoUpdate draft release notes to 1.7.0
Junio C Hamano [Sat, 23 Jan 2010 00:34:50 +0000 (16:34 -0800)]
Update draft release notes to 1.7.0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomsvc: Fix a compiler warning due to an incorrect pointer cast
Ramsay Jones [Wed, 20 Jan 2010 19:34:14 +0000 (19:34 +0000)]
msvc: Fix a compiler warning due to an incorrect pointer cast

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomsvc: Fix an "unrecognized option" linker warning
Ramsay Jones [Wed, 20 Jan 2010 19:25:51 +0000 (19:25 +0000)]
msvc: Fix an "unrecognized option" linker warning

Having recently added support for building git-imap-send on
Windows, we now link against OpenSSL libraries, and the linker
issues the following warning:

    warning LNK4044: unrecognized option '/lssl'; ignored

In order to suppress the warning, we change the msvc linker
script to translate an '-lssl' parameter to the ssleay32.lib
library.

Note that the linker script was already including ssleay32.lib
(along with libeay32.lib) as part of the translation of the
'-lcrypto' library parameter.  However, libeay32.dll does not
depend on ssleay32.dll and can be used stand-alone, so we remove
ssleay32.lib from the '-lcrypto' translation.

The dependence of ssleay32.dll on libeay32.dll is represented in
the Makefile by the NEEDS_CRYPTO_WITH_SSL build variable.

Also, add the corresponding change to the buildsystem generator.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Sat, 23 Jan 2010 00:12:41 +0000 (16:12 -0800)]
Merge branch 'maint'

* maint:
  ignore duplicated slashes in make_relative_path()

14 years agoMerge branch 'jc/branch-d'
Junio C Hamano [Sat, 23 Jan 2010 00:08:19 +0000 (16:08 -0800)]
Merge branch 'jc/branch-d'

* jc/branch-d:
  branch -d: base the "already-merged" safety on the branch it merges with

14 years agoMerge branch 'il/rev-glob'
Junio C Hamano [Sat, 23 Jan 2010 00:08:16 +0000 (16:08 -0800)]
Merge branch 'il/rev-glob'

* il/rev-glob:
  Documentation: improve description of --glob=pattern and friends
  rev-parse --branches/--tags/--remotes=pattern
  rev-parse --glob

14 years agoMerge branch 'js/refer-upstream'
Junio C Hamano [Sat, 23 Jan 2010 00:08:13 +0000 (16:08 -0800)]
Merge branch 'js/refer-upstream'

* js/refer-upstream:
  Teach @{upstream} syntax to strbuf_branchanme()
  t1506: more test for @{upstream} syntax
  Introduce <branch>@{upstream} notation

14 years agoMerge branch 'jl/submodule-diff'
Junio C Hamano [Sat, 23 Jan 2010 00:08:10 +0000 (16:08 -0800)]
Merge branch 'jl/submodule-diff'

* jl/submodule-diff:
  Performance optimization for detection of modified submodules
  git status: Show uncommitted submodule changes too when enabled
  Teach diff that modified submodule directory is dirty
  Show submodules as modified when they contain a dirty work tree

14 years agoMerge branch 'il/remote-updates'
Junio C Hamano [Sat, 23 Jan 2010 00:08:07 +0000 (16:08 -0800)]
Merge branch 'il/remote-updates'

* il/remote-updates:
  Add git remote set-url

14 years agoMerge branch 'il/branch-set-upstream'
Junio C Hamano [Sat, 23 Jan 2010 00:08:05 +0000 (16:08 -0800)]
Merge branch 'il/branch-set-upstream'

* il/branch-set-upstream:
  branch: warn and refuse to set a branch as a tracking branch of itself.
  Add branch --set-upstream

14 years agoMerge branch 'jc/maint-limit-note-output'
Junio C Hamano [Sat, 23 Jan 2010 00:08:01 +0000 (16:08 -0800)]
Merge branch 'jc/maint-limit-note-output'

* jc/maint-limit-note-output:
  Fix "log --oneline" not to show notes
  Fix "log" family not to be too agressive about showing notes

14 years agoMerge branch 'nd/ls-files-sparse-fix'
Junio C Hamano [Sat, 23 Jan 2010 00:07:18 +0000 (16:07 -0800)]
Merge branch 'nd/ls-files-sparse-fix'

* nd/ls-files-sparse-fix:
  Fix memory corruption when .gitignore does not end by \n

14 years agoMake difftool.prompt fall back to mergetool.prompt
Sebastian Schuberth [Fri, 22 Jan 2010 16:36:36 +0000 (17:36 +0100)]
Make difftool.prompt fall back to mergetool.prompt

The documentation states that "git-difftool falls back to git-mergetool
config variables when the difftool equivalents have not been defined".
Until now, this was not the case for "difftool.prompt".

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoengine.pl: Fix a recent breakage of the buildsystem generator
Ramsay Jones [Fri, 22 Jan 2010 20:00:47 +0000 (20:00 +0000)]
engine.pl: Fix a recent breakage of the buildsystem generator

Commit ade2ca0c (Do not try to remove directories when removing
old links, 2009-10-27) added an expression to a 'test' using an
'-o' or connective. This resulted in the buildsystem generator
mistaking a conditional 'rm' for a linker command. In order to
fix the breakage, we filter out all 'test' commands before then
attempting to identify the commands of interest.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoignore duplicated slashes in make_relative_path()
Junio C Hamano [Fri, 22 Jan 2010 03:05:19 +0000 (19:05 -0800)]
ignore duplicated slashes in make_relative_path()

The function takes two paths, an early part of abs is supposed to match
base; otherwise abs is not a path under base and the function returns the
full path of abs.  The caller can easily confuse the implementation by
giving duplicated and needless slashes in these path arguments.

Credit for test script, motivation and initial patch goes to Thomas Rast.
A follow-up fix (squashed) is by Hannes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-mv: fix moving more than one source to a single destination
Junio C Hamano [Fri, 22 Jan 2010 22:17:06 +0000 (14:17 -0800)]
git-mv: fix moving more than one source to a single destination

The code used as if return value from basename(3) were stable, but
often the function is implemented to return a pointer to a static
storage internal to it.

Because basename(3) is also allowed to modify its input parameter in
place, casting constness away from the strings we obtained from the
caller and giving them to basename is a no-no.

Reported, and initial fix and test supplied by David Rydh.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorebase -i: Enclose sed command substitution in quotes
Michael Haggerty [Fri, 22 Jan 2010 09:22:30 +0000 (10:22 +0100)]
rebase -i: Enclose sed command substitution in quotes

Reported by: Johannes Sixt <j.sixt@viscovery.net>

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorebase -i: Avoid non-portable "test X -a Y"
Michael Haggerty [Fri, 22 Jan 2010 09:22:29 +0000 (10:22 +0100)]
rebase -i: Avoid non-portable "test X -a Y"

Reported by: Eric Blake <ebb9@byu.net>

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "index-pack" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:55:19 +0000 (07:55 -0800)]
make "index-pack" a built-in

This required some fairly trivial packfile function 'const' cleanup,
since the builtin commands get a const char *argv[] array.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "git pack-redundant" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:42:14 +0000 (07:42 -0800)]
make "git pack-redundant" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "git unpack-file" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:38:03 +0000 (07:38 -0800)]
make "git unpack-file" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "mktag" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:34:44 +0000 (07:34 -0800)]
make "mktag" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "merge-index" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:29:21 +0000 (07:29 -0800)]
make "merge-index" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge-tree: remove unnecessary call of git_extract_argv0_path
Johannes Sixt [Fri, 22 Jan 2010 11:47:59 +0000 (12:47 +0100)]
merge-tree: remove unnecessary call of git_extract_argv0_path

This call should have been removed when the utility was made a builtin by
907a7cb.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "git patch-id" a built-in
Linus Torvalds [Fri, 22 Jan 2010 04:31:25 +0000 (20:31 -0800)]
make "git patch-id" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "git var" a built-in
Linus Torvalds [Fri, 22 Jan 2010 04:21:55 +0000 (20:21 -0800)]
make "git var" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofix git-p4 editor invocation
Nicolas Pitre [Fri, 22 Jan 2010 05:55:15 +0000 (00:55 -0500)]
fix git-p4 editor invocation

The strip() is required to remove the trailing newline character,
as already done elsewhere.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: improve description of --glob=pattern and friends
Thomas Rast [Fri, 22 Jan 2010 00:21:38 +0000 (01:21 +0100)]
Documentation: improve description of --glob=pattern and friends

Consolidate the descriptions of --branches, --tags and --remotes a
bit, to make it less repetitive.  Improve the grammar a bit, and spell
out the meaning of the 'append /*' rule.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Fri, 22 Jan 2010 04:08:31 +0000 (20:08 -0800)]
Merge branch 'maint'

* maint:
  merge-recursive: do not return NULL only to cause segfault
  retry request without query when info/refs?query fails

14 years agomake "git hash-object" a built-in
Linus Torvalds [Fri, 22 Jan 2010 03:50:11 +0000 (19:50 -0800)]
make "git hash-object" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomake "git merge-tree" a built-in
Linus Torvalds [Fri, 22 Jan 2010 02:25:20 +0000 (18:25 -0800)]
make "git merge-tree" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoslim down "git show-index"
Linus Torvalds [Thu, 21 Jan 2010 23:25:19 +0000 (15:25 -0800)]
slim down "git show-index"

As the documentation says, this is primarily for debugging, and
in the longer term we should rename it to test-show-index or something.

In the meantime, just avoid xmalloc (which slurps in the rest of git), and
separating out the trivial hex functions into "hex.o".

This results in

  [torvalds@nehalem git]$ size git-show-index
       text    data     bss     dec     hex filename
     222818    2276  112688  337782   52776 git-show-index (before)
       5696     624    1264    7584    1da0 git-show-index (after)

which is a whole lot better.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoRemove diff machinery dependency from read-cache
Linus Torvalds [Thu, 21 Jan 2010 19:37:38 +0000 (11:37 -0800)]
Remove diff machinery dependency from read-cache

Exal Sibeaz pointed out that some git files are way too big, and that
add_files_to_cache() brings in all the diff machinery to any git binary
that needs the basic git SHA1 object operations from read-cache.c. Which
is pretty much all of them.

It's doubly silly, since add_files_to_cache() is only used by builtin
programs (add, checkout and commit), so it's fairly easily fixed by just
moving the thing to builtin-add.c, and avoiding the dependency entirely.

I initially argued to Exal that it would probably be best to try to depend
on smart compilers and linkers, but after spending some time trying to
make -ffunction-sections work and giving up, I think Exal was right, and
the fix is to just do some trivial cleanups like this.

This trivial cleanup results in pretty stunning file size differences.
The diff machinery really is mostly used by just the builtin programs, and
you have things like these trivial before-and-after numbers:

  -rwxr-xr-x 1 torvalds torvalds 1727420 2010-01-21 10:53 git-hash-object
  -rwxrwxr-x 1 torvalds torvalds  940265 2010-01-21 11:16 git-hash-object

Now, I'm not saying that 940kB is good either, but that's mostly all the
debug information - you can see the real code with 'size':

   text    data     bss     dec     hex filename
 418675    3920  127408  550003   86473 git-hash-object (before)
 230650    2288  111728  344666   5425a git-hash-object (after)

ie we have a nice 24% size reduction from this trivial cleanup.

It's not just that one file either. I get:

[torvalds@nehalem git]$ du -s /home/torvalds/libexec/git-core
45640 /home/torvalds/libexec/git-core (before)
33508 /home/torvalds/libexec/git-core (after)

so we're talking 12MB of diskspace here.

(Of course, stripping all the binaries brings the 33MB down to 9MB, so the
whole debug information thing is still the bulk of it all, but that's a
separate issue entirely)

Now, I'm sure there are other things we should do, and changing our
compiler flags from -O2 to -Os would bring the text size down by an
additional almost 20%, but this thing Exal pointed out seems to be some
good low-hanging fruit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge-recursive: do not return NULL only to cause segfault
Junio C Hamano [Fri, 22 Jan 2010 00:38:56 +0000 (16:38 -0800)]
merge-recursive: do not return NULL only to cause segfault

merge-recursive calls write_tree_from_memory() to come up with a virtual
tree, with possible conflict markers inside the blob contents, while
merging multiple common ancestors down.  It is a bug to call the function
with unmerged entries in the index, even if the merge to come up with the
common ancestor resulted in conflicts.  Otherwise the result won't be
expressible as a tree object.

We _might_ want to suggest the user to set GIT_MERGE_VERBOSITY to 5 and
re-run the merge in the message.  At least we will know which part of
process_renames() or process_entry() functions is not correctly handling
the unmerged paths, and it might help us diagnosing the issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-rebase.txt: Fix spelling
Horst H. von Brand [Thu, 21 Jan 2010 20:34:25 +0000 (17:34 -0300)]
git-rebase.txt: Fix spelling

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoretry request without query when info/refs?query fails
Tay Ray Chuan [Thu, 21 Jan 2010 14:41:00 +0000 (22:41 +0800)]
retry request without query when info/refs?query fails

When "info/refs" is a static file and not behind a CGI handler, some
servers may not handle a GET request for it with a query string
appended (eg. "?foo=bar") properly.

If such a request fails, retry it sans the query string. In addition,
ensure that the "smart" http protocol is not used (a service has to be
specified with "?service=<service name>" to be conformant).

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Reported-and-tested-by: Yaroslav Halchenko <debian@onerussian.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoFix "log --oneline" not to show notes
Junio C Hamano [Thu, 21 Jan 2010 22:57:41 +0000 (14:57 -0800)]
Fix "log --oneline" not to show notes

This option should be treated pretty much the same as --format="%h %s".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMake 'rerere forget' work from a subdirectory.
Johannes Sixt [Thu, 21 Jan 2010 08:23:48 +0000 (09:23 +0100)]
Make 'rerere forget' work from a subdirectory.

It forgot to apply the prefix to the paths given on the command line.

[jc: added test]

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