Code

git.git
15 years agoMerge branch 'jc/maint-read-tree-multi' into maint
Junio C Hamano [Sun, 3 May 2009 22:02:59 +0000 (15:02 -0700)]
Merge branch 'jc/maint-read-tree-multi' into maint

* jc/maint-read-tree-multi:
  checkout branch: prime cache-tree fully
  read-tree -m A B: prime cache-tree from the switched-to tree
  Move prime_cache_tree() to cache-tree.c
  read-tree A B: do not corrupt cache-tree

15 years agoMerge branch 'mk/maint-apply-swap' into maint
Junio C Hamano [Sun, 3 May 2009 22:02:52 +0000 (15:02 -0700)]
Merge branch 'mk/maint-apply-swap' into maint

* mk/maint-apply-swap:
  tests: make test-apply-criss-cross-rename more robust
  builtin-apply: keep information about files to be deleted
  tests: test applying criss-cross rename patch

15 years agoMerge branch 'mm/maint-add-p-quit' into maint
Junio C Hamano [Sun, 3 May 2009 22:02:46 +0000 (15:02 -0700)]
Merge branch 'mm/maint-add-p-quit' into maint

* mm/maint-add-p-quit:
  git add -p: add missing "q" to patch prompt

15 years agoMerge branch 'lt/pack-object-memuse' into maint
Junio C Hamano [Sun, 3 May 2009 22:02:40 +0000 (15:02 -0700)]
Merge branch 'lt/pack-object-memuse' into maint

* lt/pack-object-memuse:
  show_object(): push path_name() call further down
  process_{tree,blob}: show objects without buffering

15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Wed, 29 Apr 2009 22:40:33 +0000 (15:40 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  diff -c -p: do not die on submodules

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Wed, 29 Apr 2009 20:43:13 +0000 (13:43 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  diff -c -p: do not die on submodules

15 years agodiff -c -p: do not die on submodules
Junio C Hamano [Wed, 29 Apr 2009 19:49:52 +0000 (12:49 -0700)]
diff -c -p: do not die on submodules

The combine diff logic knew only about blobs (and their checked-out form
in the work tree, either regular files or symlinks), and barfed when fed
submodules.  This "externalizes" gitlinks in the same way as the normal
patch generation codepath does (i.e. "Subproject commit Xxx\n") to fix the
issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Tue, 28 Apr 2009 07:46:25 +0000 (00:46 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  grep: fix segfault when "git grep '('" is given
  Documentation: fix a grammatical error in api-builtin.txt
  builtin-merge: fix a typo in an error message

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Tue, 28 Apr 2009 07:46:20 +0000 (00:46 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  grep: fix segfault when "git grep '('" is given
  Documentation: fix a grammatical error in api-builtin.txt
  builtin-merge: fix a typo in an error message

15 years agogrep: fix segfault when "git grep '('" is given
Linus Torvalds [Mon, 27 Apr 2009 18:10:24 +0000 (11:10 -0700)]
grep: fix segfault when "git grep '('" is given

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: fix a grammatical error in api-builtin.txt
Allan Caffee [Mon, 13 Apr 2009 18:11:21 +0000 (14:11 -0400)]
Documentation: fix a grammatical error in api-builtin.txt

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-merge: fix a typo in an error message
Allan Caffee [Mon, 13 Apr 2009 18:10:08 +0000 (14:10 -0400)]
builtin-merge: fix a typo in an error message

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Acked-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Sat, 25 Apr 2009 05:58:31 +0000 (22:58 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  test-genrandom: Add newline to usage string

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sat, 25 Apr 2009 05:49:34 +0000 (22:49 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  test-genrandom: Add newline to usage string

15 years agotest-genrandom: Add newline to usage string
Stephen Boyd [Thu, 23 Apr 2009 07:25:33 +0000 (00:25 -0700)]
test-genrandom: Add newline to usage string

A minor fix to place the terminal input on a new line if test-genrandom
is run with no arguments.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: make test-apply-criss-cross-rename more robust
Michał Kiedrowicz [Sat, 18 Apr 2009 21:03:57 +0000 (23:03 +0200)]
tests: make test-apply-criss-cross-rename more robust

I realized that this test does check if git-apply succeeds, but doesn't
tell if it applies patches correctly. So I added test_cmp to check it.

I also added a test which checks swapping three files.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-apply: keep information about files to be deleted
Michał Kiedrowicz [Sat, 11 Apr 2009 19:31:00 +0000 (21:31 +0200)]
builtin-apply: keep information about files to be deleted

Example correct diff generated by `diff -M -B' might look like this:

diff --git a/file1 b/file2
similarity index 100%
rename from file1
rename to file2
diff --git a/file2 b/file1
similarity index 100%
rename from file2
rename to file1

Information about removing `file2' comes after information about creation
of new `file2' (renamed from `file1'). Existing implementation isn't able to
apply such patch, because it has to know in advance which files will be
removed.

This patch populates fn_table with information about removal of files
before calling check_patch() for each patch to be applied.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: test applying criss-cross rename patch
Michał Kiedrowicz [Sat, 11 Apr 2009 15:26:24 +0000 (17:26 +0200)]
tests: test applying criss-cross rename patch

Originally reported by Linus in $gmane/116198

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitcvs-migration: Link to git-cvsimport documentation
Frank Lichtenheld [Sat, 18 Apr 2009 14:38:42 +0000 (16:38 +0200)]
gitcvs-migration: Link to git-cvsimport documentation

Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix off-by-one in read_tree_recursive
Johannes Schindelin [Mon, 20 Apr 2009 17:44:53 +0000 (19:44 +0200)]
Fix off-by-one in read_tree_recursive

Found by valgrind.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocheckout branch: prime cache-tree fully
Junio C Hamano [Mon, 20 Apr 2009 10:58:20 +0000 (03:58 -0700)]
checkout branch: prime cache-tree fully

When switching to another branch, the earlier code relied on incremental
invalidation of cache-tree entries to degrade it.  While it is not wrong
per-se, we know that the resulting index must fully match the branch we
are switching to unless the -m (merge) option is used.

We should simply fully re-prime the cache-tree using the new tree object
in such a case.  And for safety, invalidate the cache-tree as a whole in
other cases.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoread-tree -m A B: prime cache-tree from the switched-to tree
Junio C Hamano [Mon, 20 Apr 2009 10:58:19 +0000 (03:58 -0700)]
read-tree -m A B: prime cache-tree from the switched-to tree

When switching to a new branch with "read-tree -m A B", the resulting
index must match tree B and we can prime the cache tree with it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMove prime_cache_tree() to cache-tree.c
Junio C Hamano [Mon, 20 Apr 2009 10:58:18 +0000 (03:58 -0700)]
Move prime_cache_tree() to cache-tree.c

The interface to build cache-tree belongs there.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoread-tree A B: do not corrupt cache-tree
Junio C Hamano [Mon, 20 Apr 2009 10:58:17 +0000 (03:58 -0700)]
read-tree A B: do not corrupt cache-tree

An earlier commit aab3b9a (read-tree A B C: do not create a bogus index
and do not segfault, 2009-03-12) resurrected the support for an obscure
(but useful) feature to read and overlay more than one tree into the index
without the -m (merge) option.  But the fix was not enough.

Exercising this feature exposes a longstanding bug in the code that primes
the cache-tree in the index from the tree that was read.  The intention
was that when we know that the index must exactly match the tree we just
read, we prime the entire cache-tree with it.

However, the logic to detect that case incorrectly triggered if you read
two trees without -m.  This resulted in a corrupted cache-tree, and
write-tree would have produced an incorrect tree object out of such an
index.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit add -p: add missing "q" to patch prompt
Wincent Colaiuta [Mon, 20 Apr 2009 09:42:52 +0000 (11:42 +0200)]
git add -p: add missing "q" to patch prompt

Commit cbd3a01 added a new "q" subcommand to the "git add -p"
command loop, but forgot to add it to the prompt.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.2.4 v1.6.2.4
Junio C Hamano [Mon, 20 Apr 2009 00:34:26 +0000 (17:34 -0700)]
GIT 1.6.2.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: remove {fetch,send}-pack from PROGRAMS as they are builtins
Nguyễn Thái Ngọc Duy [Mon, 20 Apr 2009 00:17:25 +0000 (10:17 +1000)]
Makefile: remove {fetch,send}-pack from PROGRAMS as they are builtins

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'ef/maint-fast-export' into maint
Junio C Hamano [Sun, 19 Apr 2009 19:40:17 +0000 (12:40 -0700)]
Merge branch 'ef/maint-fast-export' into maint

* ef/maint-fast-export:
  builtin-fast-export.c: handle nested tags
  builtin-fast-export.c: fix crash on tagged trees
  builtin-fast-export.c: turn error into warning
  test-suite: adding a test for fast-export with tag variants

15 years agoMerge branch 'mm/maint-add-p-quit' into maint
Junio C Hamano [Sun, 19 Apr 2009 19:40:14 +0000 (12:40 -0700)]
Merge branch 'mm/maint-add-p-quit' into maint

* mm/maint-add-p-quit:
  Update git-add.txt according to the new possibilities of 'git add -p'.
  add-interactive: refactor mode hunk handling
  git add -p: new "quit" command at the prompt.

15 years agoMerge branch 'lt/maint-reflog-expire' into maint
Junio C Hamano [Sun, 19 Apr 2009 19:40:11 +0000 (12:40 -0700)]
Merge branch 'lt/maint-reflog-expire' into maint

* lt/maint-reflog-expire:
  Speed up reflog pruning of unreachable commits
  Clean up reflog unreachability pruning decision

15 years agoMerge branch 'jc/maint-shared-literally' into maint
Junio C Hamano [Sun, 19 Apr 2009 19:40:05 +0000 (12:40 -0700)]
Merge branch 'jc/maint-shared-literally' into maint

* jc/maint-shared-literally:
  Update docs on behaviour of 'core.sharedRepository' and 'git init --shared'
  t1301-shared-repo: fix forced modes test

15 years agoUpdate git-add.txt according to the new possibilities of 'git add -p'.
Matthieu Moy [Thu, 16 Apr 2009 16:46:23 +0000 (18:46 +0200)]
Update git-add.txt according to the new possibilities of 'git add -p'.

The text is merely cut-and-pasted from git-add--interactive.perl. The
cut-and-paste also fixes a typo.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd-interactive: refactor mode hunk handling
Jeff King [Thu, 16 Apr 2009 07:14:15 +0000 (03:14 -0400)]
add-interactive: refactor mode hunk handling

The original implementation considered the mode separately
from the rest of the hunks, asking about it outside the main
hunk-selection loop. This patch instead places a mode change
as the first hunk in the loop. This has two advantages:

  1. less duplicated code (since we use the main selection
     loop). This also cleans up an inconsistency, which is
     that the main selection loop separates options with a
     comma, whereas the mode prompt used slashes.

  2. users can now skip the mode change and come back to it,
     search for it (via "/mode"), etc, as they can with other
     hunks.

To facilitate this, each hunk is now marked with a "type".
Mode hunks are not considered for splitting (which would
make no sense, and also confuses the split_hunk function),
nor are they editable. In theory, one could edit the mode
lines and change to a new mode. In practice, there are only
two modes that git cares about (0644 and 0755), so either
you want to move from one to the other or not (and you can
do that by staging or not staging).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit add -p: new "quit" command at the prompt.
Matthieu Moy [Fri, 10 Apr 2009 14:57:01 +0000 (16:57 +0200)]
git add -p: new "quit" command at the prompt.

There's already 'd' to stop staging hunks in a file, but no explicit
command to stop the interactive staging (for the current files and the
remaining ones).  Of course you can do 'd' and then ^C, but it would be
more intuitive to allow 'quit' action.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSpeed up reflog pruning of unreachable commits
Junio Hamano [Tue, 31 Mar 2009 04:34:14 +0000 (21:34 -0700)]
Speed up reflog pruning of unreachable commits

Instead of doing the (potentially very expensive) "in_merge_base()"
check for each commit that might be pruned if it is unreachable, do a
preparatory reachability graph of the commit space, so that the common
case of being reachable can be tested directly.

[ Cleaned up a bit and tweaked to actually work.  - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoClean up reflog unreachability pruning decision
Linus Torvalds [Tue, 31 Mar 2009 16:45:22 +0000 (09:45 -0700)]
Clean up reflog unreachability pruning decision

This clarifies the pruning rules for unreachable commits by having a
separate helpder function for the unreachability decision.

It's preparation for actual bigger changes to come to speed up the
decision when the reachability calculations become a bottleneck.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-fast-export.c: handle nested tags
Erik Faye-Lund [Mon, 23 Mar 2009 12:53:09 +0000 (12:53 +0000)]
builtin-fast-export.c: handle nested tags

When tags that points to tags are passed to fast-export, an error is given,
saying "Tag [TAGNAME] points nowhere?". This fix calls parse_object() on the
object before referencing it's tag, to ensure the tag-info is fully initialized.
In addition, it inserts a comment to point out where nested tags are handled.
This is consistent with the comment for signed tags.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-fast-export.c: fix crash on tagged trees
Erik Faye-Lund [Mon, 23 Mar 2009 12:53:08 +0000 (12:53 +0000)]
builtin-fast-export.c: fix crash on tagged trees

If a tag object points to a tree (or another unhandled type), the commit-
pointer is left uninitialized and later dereferenced. This patch adds a
default case to the switch that issues a warning and skips the object.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-fast-export.c: turn error into warning
Erik Faye-Lund [Mon, 23 Mar 2009 12:53:07 +0000 (12:53 +0000)]
builtin-fast-export.c: turn error into warning

fast-import doesn't have a syntax to support tree-objects (and some other
object-types), so fast-export shouldn't handle them. However, aborting the
operation is a bit drastic. This patch turns the error into a warning instead.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotest-suite: adding a test for fast-export with tag variants
Erik Faye-Lund [Mon, 23 Mar 2009 12:53:06 +0000 (12:53 +0000)]
test-suite: adding a test for fast-export with tag variants

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDescribe fixes since 1.6.2.3
Junio C Hamano [Sat, 18 Apr 2009 21:01:50 +0000 (14:01 -0700)]
Describe fixes since 1.6.2.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Sat, 18 Apr 2009 21:43:39 +0000 (14:43 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sat, 18 Apr 2009 21:43:24 +0000 (14:43 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  doc/git-daemon: add missing arguments to options
  init: Do not segfault on big GIT_TEMPLATE_DIR environment variable

15 years agoMerge branch 'bs/maint-1.6.0-tree-walk-prefix' into maint
Junio C Hamano [Sat, 18 Apr 2009 21:18:32 +0000 (14:18 -0700)]
Merge branch 'bs/maint-1.6.0-tree-walk-prefix' into maint

* bs/maint-1.6.0-tree-walk-prefix:
  match_tree_entry(): a pathspec only matches at directory boundaries
  tree_entry_interesting: a pathspec only matches at directory boundary

15 years agoMerge branch 'js/maint-submodule-checkout' into maint
Junio C Hamano [Sat, 18 Apr 2009 21:18:29 +0000 (14:18 -0700)]
Merge branch 'js/maint-submodule-checkout' into maint

* js/maint-submodule-checkout:
  Fix 'git checkout <submodule>' to update the index

15 years agoMerge branch 'cb/maint-merge-recursive-submodule-fix' into maint
Junio C Hamano [Sat, 18 Apr 2009 21:18:25 +0000 (14:18 -0700)]
Merge branch 'cb/maint-merge-recursive-submodule-fix' into maint

* cb/maint-merge-recursive-submodule-fix:
  simplify output of conflicting merge
  update cache for conflicting submodule entries
  add tests for merging with submodules

15 years agodoc/git-daemon: add missing arguments to max-connections option
Markus Heidelberg [Sat, 18 Apr 2009 09:46:06 +0000 (11:46 +0200)]
doc/git-daemon: add missing arguments to max-connections option

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Sat, 18 Apr 2009 20:39:52 +0000 (13:39 -0700)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  doc/git-daemon: add missing arguments to options
  init: Do not segfault on big GIT_TEMPLATE_DIR environment variable

15 years agodoc/git-daemon: add missing arguments to options
Markus Heidelberg [Sat, 18 Apr 2009 09:46:06 +0000 (11:46 +0200)]
doc/git-daemon: add missing arguments to options

Also fix some spellings and typos.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoinit: Do not segfault on big GIT_TEMPLATE_DIR environment variable
Frank Lichtenheld [Sat, 18 Apr 2009 14:14:02 +0000 (16:14 +0200)]
init: Do not segfault on big GIT_TEMPLATE_DIR environment variable

Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoimap-send: use correct configuration variable in documentation
Paul Bolle [Sat, 18 Apr 2009 11:26:42 +0000 (13:26 +0200)]
imap-send: use correct configuration variable in documentation

It's imap.pass (not imap.password).

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate docs on behaviour of 'core.sharedRepository' and 'git init --shared'
Johan Herland [Tue, 14 Apr 2009 13:15:42 +0000 (15:15 +0200)]
Update docs on behaviour of 'core.sharedRepository' and 'git init --shared'

This documentation update is needed to reflect the recent changes where
"core.sharedRepository = 0mode" was changed to set, not loosen, the
repository permissions.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodoc/gitattributes: clarify location of config text
Jeff King [Thu, 16 Apr 2009 07:17:12 +0000 (03:17 -0400)]
doc/gitattributes: clarify location of config text

The gitattributes documentation has a section on the "diff"
attribute, with subsections for each of the things you might
want to configure in your diff config section (external
diff, hunk headers, etc). The first such subsection
specifically notes that the definition of the diff driver
should go into $GIT_DIR/config, but subsequent sections do
not.

This location is implied if you are reading the
documentation sequentially, but it is not uncommon for a new
user to jump to (or be referred to) a specific section. For
a new user who does not know git well enough to recognize
the config syntax, it is not clear that those directives
don't also go into the gitattributes file.

This patch just mentions the config file in each subsection,
similar to the way it is mentioned in the first.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Sat, 18 Apr 2009 04:20:58 +0000 (21:20 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  Fix buffer overflow in config parser

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sat, 18 Apr 2009 04:06:11 +0000 (21:06 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  Fix buffer overflow in config parser

15 years agoFix buffer overflow in config parser
Thomas Jarosch [Fri, 17 Apr 2009 12:05:11 +0000 (14:05 +0200)]
Fix buffer overflow in config parser

When interpreting a config value, the config parser reads in 1+ space
character(s) and puts -one- space character in the buffer as soon as
the first non-space character is encountered (if not inside quotes).

Unfortunately the buffer size check lacks the extra space character
which gets inserted at the next non-space character, resulting in
a crash with a specially crafted config entry.

The unit test now uses Java to compile a platform independent
.NET framework to output the test string in C# :o)

    Read: Thanks to Johannes Sixt for the correct printf call
    which replaces the perl invocation.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-apply: fix option description
Ulrich Windl [Thu, 9 Apr 2009 09:12:58 +0000 (11:12 +0200)]
git-apply: fix option description

Do not use non ASCII single quote.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoshow_object(): push path_name() call further down
Linus Torvalds [Sat, 11 Apr 2009 01:15:26 +0000 (18:15 -0700)]
show_object(): push path_name() call further down

In particular, pushing the "path_name()" call _into_ the show() function
would seem to allow

 - more clarity into who "owns" the name (ie now when we free the name in
   the show_object callback, it's because we generated it ourselves by
   calling path_name())

 - not calling path_name() at all, either because we don't care about the
   name in the first place, or because we are actually happy walking the
   linked list of "struct name_path *" and the last component.

Now, I didn't do that latter optimization, because it would require some
more coding, but especially looking at "builtin-pack-objects.c", we really
don't even want the whole pathname, we really would be better off with the
list of path components.

Why? We use that name for two things:
 - add_preferred_base_object(), which actually _wants_ to traverse the
   path, and now does it by looking for '/' characters!
 - for 'name_hash()', which only cares about the last 16 characters of a
   name, so again, generating the full name seems to be just unnecessary
   work.

Anyway, so I didn't look any closer at those things, but it did convince
me that the "show_object()" calling convention was crazy, and we're
actually better off doing _less_ in list-objects.c, and giving people
access to the internal data structures so that they can decide whether
they want to generate a path-name or not.

This patch does that, and then for people who did use the name (even if
they might do something more clever in the future), it just does the
straightforward "name = path_name(path, component); .. free(name);" thing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoprocess_{tree,blob}: show objects without buffering
Linus Torvalds [Sat, 11 Apr 2009 00:27:58 +0000 (17:27 -0700)]
process_{tree,blob}: show objects without buffering

Here's a less trivial thing, and slightly more dubious one.

I was looking at that "struct object_array objects", and wondering why we
do that. I have honestly totally forgotten. Why not just call the "show()"
function as we encounter the objects? Rather than add the objects to the
object_array, and then at the very end going through the array and doing a
'show' on all, just do things more incrementally.

Now, there are possible downsides to this:

 - the "buffer using object_array" _can_ in theory result in at least
   better I-cache usage (two tight loops rather than one more spread out
   one). I don't think this is a real issue, but in theory..

 - this _does_ change the order of the objects printed. Instead of doing a
   "process_tree(revs, commit->tree, &objects, NULL, "");" in the loop
   over the commits (which puts all the root trees _first_ in the object
   list, this patch just adds them to the list of pending objects, and
   then we'll traverse them in that order (and thus show each root tree
   object together with the objects we discover under it)

   I _think_ the new ordering actually makes more sense, but the object
   ordering is actually a subtle thing when it comes to packing
   efficiency, so any change in order is going to have implications for
   packing. Good or bad, I dunno.

 - There may be some reason why we did it that odd way with the object
   array, that I have simply forgotten.

Anyway, now that we don't buffer up the objects before showing them
that may actually result in lower memory usage during that whole
traverse_commit_list() phase.

This is seriously not very deeply tested. It makes sense to me, it seems
to pass all the tests, it looks ok, but...

Does anybody remember why we did that "object_array" thing? It used to be
an "object_list" a long long time ago, but got changed into the array due
to better memory usage patterns (those linked lists of obejcts are
horrible from a memory allocation standpoint). But I wonder why we didn't
do this back then. Maybe there's a reason for it.

Or maybe there _used_ to be a reason, and no longer is.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.2.3 v1.6.2.3
Junio C Hamano [Sun, 12 Apr 2009 22:43:24 +0000 (15:43 -0700)]
GIT 1.6.2.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Sun, 12 Apr 2009 22:34:53 +0000 (15:34 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  State the effect of filter-branch on graft explicitly
  process_{tree,blob}: Remove useless xstrdup calls

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sun, 12 Apr 2009 22:20:29 +0000 (15:20 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  State the effect of filter-branch on graft explicitly
  process_{tree,blob}: Remove useless xstrdup calls

15 years agoState the effect of filter-branch on graft explicitly
Daniel Cheng (aka SDiZ) [Fri, 10 Apr 2009 06:26:49 +0000 (14:26 +0800)]
State the effect of filter-branch on graft explicitly

Signed-off-by: Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoprocess_{tree,blob}: Remove useless xstrdup calls
Linus Torvalds [Fri, 10 Apr 2009 22:20:18 +0000 (15:20 -0700)]
process_{tree,blob}: Remove useless xstrdup calls

On Wed, 8 Apr 2009, Björn Steinbrink wrote:
>
> The name of the processed object was duplicated for passing it to
> add_object(), but that already calls path_name, which allocates a new
> string anyway. So the memory allocated by the xstrdup calls just went
> nowhere, leaking memory.

Ack, ack.

There's another easy 5% or so for the built-in object walker: once we've
created the hash from the name, the name isn't interesting any more, and
so something trivial like this can help a bit.

Does it matter? Probably not on its own. But a few more memory saving
tricks and it might all make a difference.

Linus

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot1301-shared-repo: fix forced modes test
Johannes Sixt [Sun, 12 Apr 2009 19:22:02 +0000 (21:22 +0200)]
t1301-shared-repo: fix forced modes test

This test was added recently (5a688fe, "core.sharedrepository = 0mode"
should set, not loosen; 2009-03-28). It checked the result of a sed
invocation for emptyness, but in some cases it forgot to print anything
at all, so that those checks would never be false.

Due to this mistake, it went unnoticed that the files in objects/info are
not necessarily 0440, but can also be 0660.  Because the 0mode setting
tries to guarantee that the files are accessible only to the people they
are meant to be used by, we should only make sure that they are readable
by the user and the group when the configuration is set to 0660.  It is a
separate matter from the core.shredrepository settings that w-bit from
immutable object files under objects/[0-9a-f][0-9a-f] directories should
be dropped.

COMMIT_EDITMSG is still world-readable, but it (and any transient files
that are meant for repositories with a work tree) does not matter.  If you
are working on a shared machine and on a sekrit stuff, the root of the
work tree would be with mode 0700 (or 0750 to allow peeking by other
people in the group), and that would mean that .git/COMMIT_EDITMSG in such
a repository would not be readable by the strangers anyway.

Also, in the real-world use case, .git/COMMIT_EDITMSG will be given to an
arbitrary editor the user happens to use, and we have no guarantee what it
does (e.g. it may create a new file with umask and replace, it may rewrite
in place, it may leave an editor backup file but use umask to create it,
etc.), and the protection of the file lies majorly on the protection of
the root of the work tree.

This test cannot be run on Windows; it requires POSIXPERM when merged to
'master'.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoStart 1.6.2.3 preparation
Junio C Hamano [Thu, 9 Apr 2009 06:40:33 +0000 (23:40 -0700)]
Start 1.6.2.3 preparation

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/shared-literally' into maint
Junio C Hamano [Thu, 9 Apr 2009 06:23:41 +0000 (23:23 -0700)]
Merge branch 'jc/shared-literally' into maint

* jc/shared-literally:
  t1301: loosen test for forced modes
  set_shared_perm(): sometimes we know what the final mode bits should look like
  move_temp_to_file(): do not forget to chmod() in "Coda hack" codepath
  Move chmod(foo, 0444) into move_temp_to_file()
  "core.sharedrepository = 0mode" should set, not loosen

15 years agoMerge branch 'jc/maint-1.6.0-diff-borrow-carefully' into maint
Junio C Hamano [Thu, 9 Apr 2009 06:23:17 +0000 (23:23 -0700)]
Merge branch 'jc/maint-1.6.0-diff-borrow-carefully' into maint

* jc/maint-1.6.0-diff-borrow-carefully:
  diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged

15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Thu, 9 Apr 2009 06:22:09 +0000 (23:22 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  process_{tree,blob}: Remove useless xstrdup calls

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Thu, 9 Apr 2009 06:22:05 +0000 (23:22 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  process_{tree,blob}: Remove useless xstrdup calls

15 years agoMerge branch 'jc/maint-1.6.0-keep-pack' into maint
Junio C Hamano [Thu, 9 Apr 2009 06:21:10 +0000 (23:21 -0700)]
Merge branch 'jc/maint-1.6.0-keep-pack' into maint

* jc/maint-1.6.0-keep-pack:
  pack-objects: don't loosen objects available in alternate or kept packs
  t7700: demonstrate repack flaw which may loosen objects unnecessarily
  Remove --kept-pack-only option and associated infrastructure
  pack-objects: only repack or loosen objects residing in "local" packs
  git-repack.sh: don't use --kept-pack-only option to pack-objects
  t7700-repack: add two new tests demonstrating repacking flaws
  is_kept_pack(): final clean-up
  Simplify is_kept_pack()
  Consolidate ignore_packed logic more
  has_sha1_kept_pack(): take "struct rev_info"
  has_sha1_pack(): refactor "pretend these packs do not exist" interface
  git-repack: resist stray environment variable

Conflicts:
t/t7700-repack.sh

15 years agoMerge branch 'jc/maint-1.6.0-blame-s' into maint-1.6.1
Junio C Hamano [Thu, 9 Apr 2009 06:02:17 +0000 (23:02 -0700)]
Merge branch 'jc/maint-1.6.0-blame-s' into maint-1.6.1

* jc/maint-1.6.0-blame-s:
  blame: read custom grafts given by -S before calling setup_revisions()

Conflicts:
builtin-blame.c

15 years agoMerge branch 'bc/maint-1.6.1-branch-deleted-was' into maint-1.6.1
Junio C Hamano [Thu, 9 Apr 2009 06:01:15 +0000 (23:01 -0700)]
Merge branch 'bc/maint-1.6.1-branch-deleted-was' into maint-1.6.1

* bc/maint-1.6.1-branch-deleted-was:
  git-branch: display "was sha1" on branch deletion rather than just "sha1"

15 years agoMerge branch 'js/maint-1.6.0-exec-path-env' into maint-1.6.1
Junio C Hamano [Thu, 9 Apr 2009 06:01:10 +0000 (23:01 -0700)]
Merge branch 'js/maint-1.6.0-exec-path-env' into maint-1.6.1

* js/maint-1.6.0-exec-path-env:
  Propagate --exec-path setting to external commands via GIT_EXEC_PATH

15 years agoMerge branch 'tr/maint-1.6.1-doc-format-patch--root' into maint-1.6.1
Junio C Hamano [Thu, 9 Apr 2009 06:00:21 +0000 (23:00 -0700)]
Merge branch 'tr/maint-1.6.1-doc-format-patch--root' into maint-1.6.1

* tr/maint-1.6.1-doc-format-patch--root:
  Documentation: format-patch --root clarifications

15 years agoprocess_{tree,blob}: Remove useless xstrdup calls
Björn Steinbrink [Wed, 8 Apr 2009 11:28:54 +0000 (13:28 +0200)]
process_{tree,blob}: Remove useless xstrdup calls

The name of the processed object was duplicated for passing it to
add_object(), but that already calls path_name, which allocates a new
string anyway. So the memory allocated by the xstrdup calls just went
nowhere, leaking memory.

This reduces the RSS usage for a "rev-list --all --objects" by about 10% on
the gentoo repo (fully packed) as well as linux-2.6.git:

    gentoo:
                    | old           | new
    ----------------|-------------------------------
    RSS             |       1537284 |       1388408
    VSZ             |       1816852 |       1667952
    time elapsed    |       1:49.62 |       1:48.99
    min. page faults|        417178 |        379919

    linux-2.6.git:
                    | old           | new
    ----------------|-------------------------------
    RSS             |        324452 |        292996
    VSZ             |        491792 |        460376
    time elapsed    |       0:14.53 |       0:14.28
    min. page faults|         89360 |         81613

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-pull.sh: better warning message for "git pull" on detached head.
Matthieu Moy [Wed, 8 Apr 2009 07:24:03 +0000 (09:24 +0200)]
git-pull.sh: better warning message for "git pull" on detached head.

Otherwise, git complains about not finding a branch to pull from in
'branch..merge', which is hardly understandable. While we're there,
reword the sentences slightly.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Wed, 8 Apr 2009 06:05:14 +0000 (23:05 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  Documentation: clarify .gitattributes search
  git-checkout.txt: clarify that <branch> applies when no path is given.
  git-checkout.txt: fix incorrect statement about HEAD and index

15 years agoChange double quotes to single quotes in message
Jari Aalto [Sat, 21 Mar 2009 09:00:54 +0000 (11:00 +0200)]
Change double quotes to single quotes in message

Most of the time when we give branch name in the message, we quote it
inside a pair of single-quotes.  git-checkout uses double-quotes; this
patch corrects the inconsistency.

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Wed, 8 Apr 2009 05:51:14 +0000 (22:51 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  Documentation: clarify .gitattributes search
  git-checkout.txt: clarify that <branch> applies when no path is given.
  git-checkout.txt: fix incorrect statement about HEAD and index

15 years agoDocumentation: clarify .gitattributes search
Jason Merrill [Mon, 6 Apr 2009 15:03:36 +0000 (11:03 -0400)]
Documentation: clarify .gitattributes search

Use the term "toplevel of the work tree" in gitattributes.txt and
gitignore.txt to define the limits of the search for those files.

Signed-off-by: Jason Merrill <jason@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-checkout.txt: clarify that <branch> applies when no path is given.
Matthieu Moy [Tue, 7 Apr 2009 12:43:53 +0000 (14:43 +0200)]
git-checkout.txt: clarify that <branch> applies when no path is given.

Otherwise, the sentence "Defaults to HEAD." can be mis-read to mean
that "git checkout -- hello.c" checks-out from HEAD.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-checkout.txt: fix incorrect statement about HEAD and index
Matthieu Moy [Mon, 6 Apr 2009 20:45:21 +0000 (22:45 +0200)]
git-checkout.txt: fix incorrect statement about HEAD and index

The command "git checkout" checks out from the index by default, not
HEAD (the introducing comment were correct, but the detailled
explanation added below were not).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit submodule: fix usage line
Julien Danjou [Tue, 31 Mar 2009 15:50:12 +0000 (17:50 +0200)]
git submodule: fix usage line

Actually, you have to set the -b option after the add command.

Signed-off-by: Julien Danjou <julien@danjou.info>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Sun, 5 Apr 2009 08:04:54 +0000 (01:04 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  commit: abort commit if interactive add failed
  git-repack: use non-dashed update-server-info

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sun, 5 Apr 2009 08:04:38 +0000 (01:04 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  commit: abort commit if interactive add failed
  git-repack: use non-dashed update-server-info

Conflicts:
builtin-commit.c

15 years agodoc/git-pack-refs: fix two grammar issues
Markus Heidelberg [Sat, 4 Apr 2009 10:35:22 +0000 (12:35 +0200)]
doc/git-pack-refs: fix two grammar issues

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocommit: abort commit if interactive add failed
Jeff King [Fri, 3 Apr 2009 19:28:56 +0000 (15:28 -0400)]
commit: abort commit if interactive add failed

Previously we ignored the result of calling add_interactive,
which meant that if an error occurred we simply committed
whatever happened to be in the index.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosimplify output of conflicting merge
Clemens Buchacher [Sun, 5 Apr 2009 00:47:00 +0000 (02:47 +0200)]
simplify output of conflicting merge

This simplifies the code without changing the semantics and removes
the unhelpful "needs $sha1" part of the conflicting submodule message.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoupdate cache for conflicting submodule entries
Clemens Buchacher [Sun, 5 Apr 2009 00:46:59 +0000 (02:46 +0200)]
update cache for conflicting submodule entries

When merging merge bases during a recursive merge we do not want to
leave any unmerged entries. Otherwise we cannot create a temporary
tree for the recursive merge to work with.

We failed to do so in case of a submodule conflict between merge
bases, causing a NULL pointer dereference in the next step of the
recursive merge.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd tests for merging with submodules
Clemens Buchacher [Sun, 5 Apr 2009 00:46:58 +0000 (02:46 +0200)]
add tests for merging with submodules

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-repack: use non-dashed update-server-info
Dan McGee [Sat, 4 Apr 2009 16:59:55 +0000 (11:59 -0500)]
git-repack: use non-dashed update-server-info

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix 'git checkout <submodule>' to update the index
Johannes Schindelin [Thu, 2 Apr 2009 13:30:25 +0000 (15:30 +0200)]
Fix 'git checkout <submodule>' to update the index

While 'git checkout <submodule>' should not update the submodule's
working directory, it should update the index.  This is in line with
how submodules are handled in the rest of Git.

While at it, test 'git reset [<commit>] <submodule>', too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.2.2 v1.6.2.2
Junio C Hamano [Thu, 2 Apr 2009 19:21:57 +0000 (12:21 -0700)]
GIT 1.6.2.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/maint-1.6.0-blame-s' into maint
Junio C Hamano [Thu, 2 Apr 2009 19:14:37 +0000 (12:14 -0700)]
Merge branch 'jc/maint-1.6.0-blame-s' into maint

* jc/maint-1.6.0-blame-s:
  blame: read custom grafts given by -S before calling setup_revisions()

Conflicts:
builtin-blame.c

15 years agoMerge branch 'js/maint-diff-temp-smudge' into maint
Junio C Hamano [Thu, 2 Apr 2009 19:02:30 +0000 (12:02 -0700)]
Merge branch 'js/maint-diff-temp-smudge' into maint

* js/maint-diff-temp-smudge:
  Smudge the files fed to external diff and textconv

15 years agoMerge branch 'js/maint-1.6.0-exec-path-env' into maint
Junio C Hamano [Thu, 2 Apr 2009 19:02:25 +0000 (12:02 -0700)]
Merge branch 'js/maint-1.6.0-exec-path-env' into maint

* js/maint-1.6.0-exec-path-env:
  Propagate --exec-path setting to external commands via GIT_EXEC_PATH

15 years agoMerge branch 'bc/maint-1.6.1-branch-deleted-was' into maint
Junio C Hamano [Thu, 2 Apr 2009 19:02:18 +0000 (12:02 -0700)]
Merge branch 'bc/maint-1.6.1-branch-deleted-was' into maint

* bc/maint-1.6.1-branch-deleted-was:
  git-branch: display "was sha1" on branch deletion rather than just "sha1"

Conflicts:
builtin-branch.c

15 years agoMerge branch 'tr/maint-1.6.1-doc-format-patch--root' into maint
Junio C Hamano [Thu, 2 Apr 2009 19:00:59 +0000 (12:00 -0700)]
Merge branch 'tr/maint-1.6.1-doc-format-patch--root' into maint

* tr/maint-1.6.1-doc-format-patch--root:
  Documentation: format-patch --root clarifications

15 years agoMerge branch 'dm/maint-docco' into maint
Junio C Hamano [Thu, 2 Apr 2009 18:58:39 +0000 (11:58 -0700)]
Merge branch 'dm/maint-docco' into maint

* dm/maint-docco:
  Documentation: Remove spurious uses of "you" in git-bisect.txt.
  Documentation: minor grammatical fix in git-check-ref-format.txt
  Documentation: minor grammatical fixes in git-check-attr.txt
  Documentation: minor grammatical fixes in git-cat-file.txt
  Documentation: minor grammatical fixes and rewording in git-bundle.txt
  Documentation: remove some uses of the passive voice in git-bisect.txt
  Documentation: reword example text in git-bisect.txt.
  Documentation: reworded the "Description" section of git-bisect.txt.
  Documentation: minor grammatical fixes in git-branch.txt.
  Documentation: minor grammatical fixes in git-blame.txt.
  Documentation: reword the "Description" section of git-bisect.txt.
  Documentation: minor grammatical fixes in git-archive.txt.