1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-01 06:47:52 +01:00
Commit graph

17925 commits

Author SHA1 Message Date
Linus Torvalds
c922b01f54 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>
2009-04-27 17:28:18 -07:00
Allan Caffee
d649048e68 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>
2009-04-27 09:36:40 -07:00
Allan Caffee
345f6e2cb5 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>
2009-04-27 09:36:14 -07:00
Junio C Hamano
f06b9f1dff Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
  test-genrandom: Add newline to usage string
2009-04-24 22:58:31 -07:00
Junio C Hamano
cc13719451 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  test-genrandom: Add newline to usage string
2009-04-24 22:49:34 -07:00
Stephen Boyd
c2318228ab 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>
2009-04-23 01:29:00 -07:00
Michał Kiedrowicz
f0583867e7 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>
2009-04-20 13:47:02 -07:00
Michał Kiedrowicz
e8141fcf54 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>
2009-04-20 13:46:58 -07:00
Michał Kiedrowicz
1d49f0d1a1 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>
2009-04-20 13:46:55 -07:00
Frank Lichtenheld
3ac3cfb8eb gitcvs-migration: Link to git-cvsimport documentation
Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-20 13:45:02 -07:00
Johannes Schindelin
7183c09d11 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>
2009-04-20 13:44:14 -07:00
Junio C Hamano
83ae209bf9 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>
2009-04-20 04:16:42 -07:00
Junio C Hamano
456156dc06 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>
2009-04-20 04:16:41 -07:00
Junio C Hamano
b9d37a5420 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>
2009-04-20 04:16:41 -07:00
Junio C Hamano
8cc21ce78c 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>
2009-04-20 04:16:40 -07:00
Wincent Colaiuta
a2fc8d6536 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>
2009-04-20 03:38:44 -07:00
Junio C Hamano
1f9b620fdb GIT 1.6.2.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-19 17:34:26 -07:00
Nguyễn Thái Ngọc Duy
318b847031 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>
2009-04-19 17:23:42 -07:00
Junio C Hamano
4f26c39806 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
2009-04-19 12:40:17 -07:00
Junio C Hamano
fe4ce3a721 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.
2009-04-19 12:40:14 -07:00
Junio C Hamano
84047e0f28 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
2009-04-19 12:40:11 -07:00
Junio C Hamano
5027acc4db 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
2009-04-19 12:40:05 -07:00
Matthieu Moy
cafa56702b 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>
2009-04-19 12:35:38 -07:00
Jeff King
7535e5a16a 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>
2009-04-19 12:35:38 -07:00
Matthieu Moy
cbd3a01ed8 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>
2009-04-19 12:35:37 -07:00
Junio Hamano
24cb1bb198 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>
2009-04-19 12:31:56 -07:00
Linus Torvalds
9ffb15d52a 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>
2009-04-19 12:31:56 -07:00
Erik Faye-Lund
aadd44404b 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>
2009-04-19 12:29:26 -07:00
Erik Faye-Lund
426193c025 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>
2009-04-19 12:29:26 -07:00
Erik Faye-Lund
38124d8f31 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>
2009-04-19 12:29:26 -07:00
Erik Faye-Lund
1092f6b3f8 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>
2009-04-19 12:29:25 -07:00
Junio C Hamano
67daebfd3b Describe fixes since 1.6.2.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-18 14:45:29 -07:00
Junio C Hamano
a51609a1c1 Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
2009-04-18 14:43:39 -07:00
Junio C Hamano
a4d1797332 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
2009-04-18 14:43:24 -07:00
Junio C Hamano
08e7239c36 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
2009-04-18 14:18:32 -07:00
Junio C Hamano
f392485813 Merge branch 'js/maint-submodule-checkout' into maint
* js/maint-submodule-checkout:
  Fix 'git checkout <submodule>' to update the index
2009-04-18 14:18:29 -07:00
Junio C Hamano
eb8a1c4aed 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
2009-04-18 14:18:25 -07:00
Markus Heidelberg
2aa3140bc0 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>
2009-04-18 13:40:34 -07:00
Junio C Hamano
d890d3f996 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
2009-04-18 13:39:52 -07:00
Markus Heidelberg
6285441044 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>
2009-04-18 13:39:42 -07:00
Frank Lichtenheld
32d1776b13 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>
2009-04-18 13:06:40 -07:00
Paul Bolle
43be7a782e 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>
2009-04-18 12:54:45 -07:00
Johan Herland
098082fb78 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>
2009-04-18 12:51:06 -07:00
Jeff King
c4c86d2389 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>
2009-04-17 21:28:07 -07:00
Junio C Hamano
f7446fc6bb Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
  Fix buffer overflow in config parser
2009-04-17 21:20:58 -07:00
Junio C Hamano
0fa0514b91 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  Fix buffer overflow in config parser
2009-04-17 21:06:11 -07:00
Thomas Jarosch
e0b3cc0dff 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>
2009-04-17 20:59:01 -07:00
Ulrich Windl
ae57ec223b git-apply: fix option description
Do not use non ASCII single quote.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-16 16:32:17 -07:00
Linus Torvalds
cf2ab916af 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>
2009-04-12 17:28:31 -07:00
Linus Torvalds
8d2dfc49b1 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>
2009-04-12 17:28:31 -07:00