Code

git.git
18 years agoMerge git://git.kernel.org/pub/scm/gitk/gitk
Junio C Hamano [Wed, 7 Jun 2006 06:24:27 +0000 (23:24 -0700)]
Merge git://git.kernel.org/pub/scm/gitk/gitk

* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Re-read the descendent/ancestor tag & head info on update
  gitk: Show branch name(s) as well, if "show nearby tags" is enabled
  gitk: Show nearby tags
  gitk: Add a goto next/previous highlighted commit function
  gitk: Provide ability to highlight based on relationship to selected commit
  gitk: Fix bug in highlight stuff when no line is selected
  gitk: Move "pickaxe" find function to highlight facility
  gitk: Improve the text window search function
  gitk: First cut at a search function in the patch/file display window
  gitk: Highlight paths of interest in tree view as well
  gitk: Highlight entries in the file list as well
  gitk: Make a row of controls for controlling highlighting

18 years agohttp-fetch: fix possible segfault
Nick Hengeveld [Wed, 7 Jun 2006 05:22:35 +0000 (22:22 -0700)]
http-fetch: fix possible segfault

Initialize an object request's slot to a safe value.  A non-NULL value
can cause a segfault if the request is aborted before it starts.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoRefactor git_tcp_connect() functions a little.
Jon Loeliger [Wed, 7 Jun 2006 03:58:41 +0000 (22:58 -0500)]
Refactor git_tcp_connect() functions a little.

Add client side sending of "\0host=%s\0" extended
arg for git native protocol, backwards compatibly.

Signed-off-by: Jon Loeliger <jdl@jdl.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'jc/lockfile'
Junio C Hamano [Tue, 6 Jun 2006 23:42:52 +0000 (16:42 -0700)]
Merge branch 'jc/lockfile'

* jc/lockfile:
  ref-log: style fixes.
  refs.c: convert it to use lockfile interface.
  Make index file locking code reusable to others.

18 years agoMerge branch 'js/alias'
Junio C Hamano [Tue, 6 Jun 2006 23:42:46 +0000 (16:42 -0700)]
Merge branch 'js/alias'

* js/alias:
  git alias: try alias last.
  If you have a config containing something like this:

18 years agoMerge branch 'vb/sendemail'
Junio C Hamano [Tue, 6 Jun 2006 23:42:33 +0000 (16:42 -0700)]
Merge branch 'vb/sendemail'

* vb/sendemail:
  send-email: a bit more careful domain regexp.
  send-email: be more lenient and just catch obvious mistakes.
  Cleanup git-send-email.perl:extract_valid_email

18 years agobuiltin-grep: pass ignore case option to external grep
Robert Fitzsimons [Tue, 6 Jun 2006 23:15:16 +0000 (23:15 +0000)]
builtin-grep: pass ignore case option to external grep

Don't just read the --ignore-case/-i option, pass the flag on to the
external grep program.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitk: Re-read the descendent/ancestor tag & head info on update
Paul Mackerras [Tue, 6 Jun 2006 23:19:45 +0000 (09:19 +1000)]
gitk: Re-read the descendent/ancestor tag & head info on update

Signed-off-by: Paul Mackerras <paulus@samba.org>
18 years agoref-log: style fixes.
Junio C Hamano [Tue, 6 Jun 2006 21:04:17 +0000 (14:04 -0700)]
ref-log: style fixes.

A few style fixes to get the code in line with the rest.

 - asterisk to make a type a pointer to something goes in front
   of the variable, not at the end of the base type.
   E.g. a pointer to an integer is "int *ip", not "int* ip".

 - open parenthesis for function parameter list, unlike
   syntactic constructs, comes immediately after the function
   name.  E.g. "if (foo) bar();" not "if(foo) bar ();".

 - "else" does not come on the same line as the closing brace of
   corresponding "if".

The style is mostly a matter of personal taste, and people may
disagree, but consistency is important.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agorefs.c: convert it to use lockfile interface.
Junio C Hamano [Tue, 6 Jun 2006 20:54:14 +0000 (13:54 -0700)]
refs.c: convert it to use lockfile interface.

This updates the ref locking code to use creat-rename locking
code we use for the index file, so that it can borrow the code
to clean things up upon signals and program termination.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake index file locking code reusable to others.
Junio C Hamano [Tue, 6 Jun 2006 19:51:49 +0000 (12:51 -0700)]
Make index file locking code reusable to others.

The framework to create lockfiles that are removed at exit is
first used to reliably write the index file, but it is
applicable to other things, so stop calling it "cache_file".

This also rewords a few remaining error message that called the
index file "cache file".

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoHTTP cleanup
Junio C Hamano [Tue, 6 Jun 2006 21:26:57 +0000 (14:26 -0700)]
HTTP cleanup

This ifdef's out more functions that are not used while !USE_MULTI
in http code.  Also the dependency of http related objects on http.h
header file was missing in the Makefile.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoHTTP cleanup
Nick Hengeveld [Tue, 6 Jun 2006 16:41:32 +0000 (09:41 -0700)]
HTTP cleanup

Fix broken build when USE_CURL_MULTI is not defined, as noted by Becky Bruce.

During cleanup, free header slist that was created during init, as noted
by Junio.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-format-patch: add --output-directory long option again
Junio C Hamano [Tue, 6 Jun 2006 15:46:23 +0000 (08:46 -0700)]
git-format-patch: add --output-directory long option again

Additionally notices and complains to an -o option without
directory or a duplicated -o option, -o and --stdout given
together.  Also delays the creation of directory until all
arguments are parsed, so that the command does not leave an
empty directory behind when it exits after seeing an unrelated
invalid option.

[jc: originally from Dennis Stosberg but with minor fixes, and
 documentation updates from Dennis.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agosend-email: a bit more careful domain regexp.
Junio C Hamano [Tue, 6 Jun 2006 21:12:46 +0000 (14:12 -0700)]
send-email: a bit more careful domain regexp.

This tightens the regexp a bit to make sure there is no double dots.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agosend-email: be more lenient and just catch obvious mistakes.
Junio C Hamano [Tue, 6 Jun 2006 07:05:56 +0000 (00:05 -0700)]
send-email: be more lenient and just catch obvious mistakes.

This cleans up the pattern matching subroutine by introducing
two variables to hold regexp to approximately match local-part
and domain in the e-mail address.  It is meant to catch obvious
mistakes with a cheap check.

The patch also moves "scalar" to force Email::Valid->address()
to work in !wantarray environment to extract_valid_address;
earlier it was in the caller of the subroutine, which was way
too error prone.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agorev-parse: tighten constness properly. v1.4.0-rc1
Junio C Hamano [Tue, 6 Jun 2006 05:36:21 +0000 (22:36 -0700)]
rev-parse: tighten constness properly.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoA Perforce importer for git.
Sean [Wed, 24 May 2006 22:04:38 +0000 (18:04 -0400)]
A Perforce importer for git.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit alias: try alias last.
Junio C Hamano [Tue, 6 Jun 2006 01:09:40 +0000 (18:09 -0700)]
git alias: try alias last.

This disables alias "foo" from being used for git-foo, and when
we do use alias we check the built-in and then existing command
names first and then alias as the fallback.  This avoids the
problem of common commands used in scripts getting clobbered by
user specific aliases.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoIf you have a config containing something like this:
Johannes Schindelin [Mon, 5 Jun 2006 17:43:52 +0000 (19:43 +0200)]
If you have a config containing something like this:

[alias]
l = "log --stat -M ORIG_HEAD.."

you can call

git l

and it will do the same as

git log --stat -M ORIG_HEAD..

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agobuiltin-push: don't pass --thin to HTTP transport
Nick Hengeveld [Mon, 5 Jun 2006 20:02:29 +0000 (13:02 -0700)]
builtin-push: don't pass --thin to HTTP transport

git-http-push does not currently use packs to transfer objects.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agopack-objects: improve path grouping heuristics.
Linus Torvalds [Mon, 5 Jun 2006 19:03:31 +0000 (12:03 -0700)]
pack-objects: improve path grouping heuristics.

This trivial patch not only simplifies the name hashing, it actually
improves packing for both git and the kernel.

The git archive pack shrinks from 6824090->6622627 bytes (a 3%
improvement), and the kernel pack shrinks from 108756213 to 108219021 (a
mere 0.5% improvement, but still, it's an improvement from making the
hashing much simpler!)

We just create a 32-bit hash, where we "age" previous characters by two
bits, so the last characters in a filename count most. So when we then
compare the hashes in the sort routine, filenames that end the same way
sort the same way.

It takes the subdirectory into account (unless the filename is > 16
characters), but files with the same name within the same subdirectory
will obviously sort closer than files in different subdirectories.

And, incidentally (which is why I tried the hash change in the first
place, of course) builtin-rev-list.c will sort fairly close to rev-list.c.

And no, it's not a "good hash" in the sense of being secure or unique, but
that's not what we're looking for. The whole "hash" thing is misnamed
here. It's not so much a hash as a "sorting number".

[jc: rolled in simplification for computing the sorting number
 computation for thin pack base objects]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agorev-list: fix process_tree() conversion.
Linus Torvalds [Mon, 5 Jun 2006 18:44:36 +0000 (11:44 -0700)]
rev-list: fix process_tree() conversion.

The tree-walking conversion of the "process_tree()" function
broke packing by using an unrelated variable from outer scope.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoFix typo in tutorial-2.txt
Linus Torvalds [Mon, 5 Jun 2006 19:47:49 +0000 (12:47 -0700)]
Fix typo in tutorial-2.txt

This should be obvious enough.

I didn't actually _test_ the tutorial, but if the old command worked,
something is really wrong!

Signed-off-by: Linus "Duh!" Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoFix Documentation/everyday.txt: Junio's workflow
Horst H. von Brand [Mon, 5 Jun 2006 02:10:33 +0000 (22:10 -0400)]
Fix Documentation/everyday.txt: Junio's workflow

The workflow for Junio was badly formatted.

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoAdd example xinetd(8) configuration to Documentation/everyday.txt
Horst H. von Brand [Sun, 4 Jun 2006 23:53:45 +0000 (19:53 -0400)]
Add example xinetd(8) configuration to Documentation/everyday.txt

Many Linux distributions use xinetd(8), not inetd(8).
Give a sample configuration file.

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoread-tree: fix eye-candy.
Linus Torvalds [Sun, 4 Jun 2006 17:48:31 +0000 (10:48 -0700)]
read-tree: fix eye-candy.

Anton Blanchard spotted that watching checkout stage of a clone
on a slow terminal takes ages because it forgot to clear the
"once a second happened" flag, so instead of updates the
percentage output for every file it checks out after the first
second has passed.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitview: Add some useful keybindings.
Aneesh Kumar K.V [Sun, 4 Jun 2006 18:07:48 +0000 (23:37 +0530)]
gitview: Add some useful keybindings.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoCleanup git-send-email.perl:extract_valid_email
Horst H. von Brand [Sat, 3 Jun 2006 17:11:48 +0000 (13:11 -0400)]
Cleanup git-send-email.perl:extract_valid_email

- Fix the regular expressions for local addresses
- Fix the fallback regexp for non-local addresses, simplify the logic

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'lt/tree-2'
Junio C Hamano [Sun, 4 Jun 2006 06:59:27 +0000 (23:59 -0700)]
Merge branch 'lt/tree-2'

* lt/tree-2:
  fetch.c: do not call process_tree() from process_tree().
  tree_entry(): new tree-walking helper function
  adjust to the rebased series by Linus.
  Remove "tree->entries" tree-entry list from tree parser
  Switch "read_tree_recursive()" over to tree-walk functionality
  Make "tree_entry" have a SHA1 instead of a union of object pointers
  Add raw tree buffer info to "struct tree"
  Remove last vestiges of generic tree_entry_list
  Convert fetch.c: process_tree() to raw tree walker
  Convert "mark_tree_uninteresting()" to raw tree walker
  Remove unused "zeropad" entry from tree_list_entry
  fsck-objects: avoid unnecessary tree_entry_list usage
  Remove "tree->entries" tree-entry list from tree parser
  builtin-read-tree.c: avoid tree_entry_list in prime_cache_tree_rec()
  Switch "read_tree_recursive()" over to tree-walk functionality
  Make "tree_entry" have a SHA1 instead of a union of object pointers
  Make "struct tree" contain the pointer to the tree buffer

18 years agoMerge branch 'sp/reflog'
Junio C Hamano [Sun, 4 Jun 2006 06:59:03 +0000 (23:59 -0700)]
Merge branch 'sp/reflog'

* sp/reflog:
  fetch.c: do not pass uninitialized lock to unlock_ref().
  Test that git-branch -l works.
  Verify git-commit provides a reflog message.
  Enable ref log creation in git checkout -b.
  Create/delete branch ref logs.
  Include ref log detail in commit, reset, etc.
  Change order of -m option to update-ref.
  Correct force_write bug in refs.c
  Change 'master@noon' syntax to 'master@{noon}'.
  Log ref updates made by fetch.
  Force writing ref if it doesn't exist.
  Added logs/ directory to repository layout.
  General ref log reading improvements.
  Fix ref log parsing so it works properly.
  Support 'master@2 hours ago' syntax
  Log ref updates to logs/refs/<ref>
  Convert update-ref to use ref_lock API.
  Improve abstraction of ref lock/write.

18 years agoMerge branch 'ff/svnimport'
Junio C Hamano [Sun, 4 Jun 2006 06:58:26 +0000 (23:58 -0700)]
Merge branch 'ff/svnimport'

* ff/svnimport:
  git-svnimport: Improved detection of merges.

18 years agoread-tree --reset: update working tree file for conflicted paths.
Junio C Hamano [Sat, 3 Jun 2006 08:49:31 +0000 (01:49 -0700)]
read-tree --reset: update working tree file for conflicted paths.

The earlier "git reset --hard" simplification stopped removing
leftover working tree files from a failed automerge, when
switching back to the HEAD version that does not have the
paths.

This patch, instead of removing the unmerged paths from the
index, drops them down to stage#0 but marks them with mode=0
(the same "to be deleted" marker we internally use for paths
deleted by the merge).  one_way_merge() function and the
functions it calls already know what to do with them -- if the
tree we are reading has the path the working tree file is
overwritten, and if it doesn't the working tree file is
removed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'jc/fmt-patch'
Junio C Hamano [Sun, 4 Jun 2006 06:57:15 +0000 (23:57 -0700)]
Merge branch 'jc/fmt-patch'

* jc/fmt-patch:
  Update documentation for git-format-patch
  format-patch: resurrect extra headers from config
  format-patch --signoff

18 years agoDocumentation: Spelling fixes
Horst H. von Brand [Sat, 3 Jun 2006 20:27:26 +0000 (16:27 -0400)]
Documentation: Spelling fixes

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoBuiltin git-rev-parse.
Christian Couder [Sat, 3 Jun 2006 16:45:43 +0000 (18:45 +0200)]
Builtin git-rev-parse.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agofetch: do not report "same" unless -verbose.
Junio C Hamano [Sun, 4 Jun 2006 06:44:40 +0000 (23:44 -0700)]
fetch: do not report "same" unless -verbose.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitk: Show branch name(s) as well, if "show nearby tags" is enabled
Paul Mackerras [Sun, 4 Jun 2006 01:50:38 +0000 (11:50 +1000)]
gitk: Show branch name(s) as well, if "show nearby tags" is enabled

This is a small extension to the code that reads the complete commit
graph, to make it compute descendent heads as well as descendent tags.
We don't exclude descendent heads that are descendents of other
descendent heads as we do for tags, since it is useful to know all the
branches that a commit is on.

Signed-off-by: Paul Mackerras <paulus@samba.org>
18 years agogitk: Show nearby tags
Paul Mackerras [Sat, 3 Jun 2006 09:11:13 +0000 (19:11 +1000)]
gitk: Show nearby tags

This adds a feature to the diff display window where it will show
the tags that this commit follows (is a descendent of) and precedes
(is an ancestor of).  Specifically, it will show the tags for all
tagged descendents that are not a descendent of another tagged
descendent of this commit, and the tags for all tagged ancestors
that are not ancestors of another tagged ancestor of this commit.

To do this, gitk reads the complete commit graph using git rev-list
and performs a couple of traversals of the tree.  This is done in
the background, but since it can be time-consuming, there is an option
to turn it off in the `edit preferences' window.

Signed-off-by: Paul Mackerras <paulus@samba.org>
18 years agoMerge branch 'ds/doc' into jc/fmt-patch
Junio C Hamano [Sat, 3 Jun 2006 01:17:35 +0000 (18:17 -0700)]
Merge branch 'ds/doc' into jc/fmt-patch

* ds/doc:
  Update documentation for git-format-patch
  sha1_file: avoid re-preparing duplicate packs
  handle concurrent pruning of packed objects
  http: prevent segfault during curl handle reuse
  Remove possible segfault in http-fetch.
  gitk: show_error fix
  [PATCH] gitk: start-up bugfix
  [PATCH] gitk: Replace "git-" commands with "git "
  [PATCH] gitk: Display commit messages with word wrap
  gitk: Fix bug where page-up/down wouldn't always work properly
  gitk: Fix display of "(...)" for parents/children we haven't drawn
  send-email: only 'require' instead of 'use' Net::SMTP
  Allow multiple -m options to git-commit.

18 years agoUpdate documentation for git-format-patch
Dennis Stosberg [Wed, 31 May 2006 14:14:08 +0000 (16:14 +0200)]
Update documentation for git-format-patch

[jc: adjusted for recently resurrected features]

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agofetch.c: do not call process_tree() from process_tree().
Junio C Hamano [Fri, 2 Jun 2006 22:23:47 +0000 (15:23 -0700)]
fetch.c: do not call process_tree() from process_tree().

This function reads a freshly fetched tree object, and schedules
the objects pointed by it for further fetching, so doing
lookup_tree() and process_tree() recursively from there does not
make much sense.  We need to use process() on it to make sure we
fetch it first, and leave the recursive processing to later
stages.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agosha1_file: avoid re-preparing duplicate packs
Jeff King [Fri, 2 Jun 2006 16:49:32 +0000 (12:49 -0400)]
sha1_file: avoid re-preparing duplicate packs

When adding packs, skip the pack if we already have it in the packed_git
list. This might happen if we are re-preparing our packs because of a
missing object.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agohandle concurrent pruning of packed objects
Jeff King [Fri, 2 Jun 2006 15:32:23 +0000 (11:32 -0400)]
handle concurrent pruning of packed objects

This patch causes read_sha1_file and sha1_object_info to re-examine the
list of packs if an object cannot be found. It works by re-running
prepare_packed_git() after an object fails to be found.

It does not attempt to clean up the old pack list. Old packs which are in
use can continue to be used (until unused by lru selection).  New packs
are placed at the front of the list and will thus be examined before old
packs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'nh/http'
Junio C Hamano [Fri, 2 Jun 2006 17:31:15 +0000 (10:31 -0700)]
Merge branch 'nh/http'

* nh/http:
  http: prevent segfault during curl handle reuse
  Remove possible segfault in http-fetch.

18 years agoformat-patch: resurrect extra headers from config
Johannes Schindelin [Fri, 2 Jun 2006 13:21:17 +0000 (15:21 +0200)]
format-patch: resurrect extra headers from config

Once again, if you have

[format]
headers = "Origamization: EvilEmpire\n"

format-patch will add these headers just after the "Subject:" line.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge git://git.kernel.org/pub/scm/gitk/gitk
Junio C Hamano [Thu, 1 Jun 2006 05:27:26 +0000 (22:27 -0700)]
Merge git://git.kernel.org/pub/scm/gitk/gitk

* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: show_error fix
  [PATCH] gitk: start-up bugfix
  [PATCH] gitk: Replace "git-" commands with "git "
  [PATCH] gitk: Display commit messages with word wrap
  gitk: Fix bug where page-up/down wouldn't always work properly
  gitk: Fix display of "(...)" for parents/children we haven't drawn

18 years agohttp: prevent segfault during curl handle reuse
Nick Hengeveld [Wed, 31 May 2006 23:25:03 +0000 (16:25 -0700)]
http: prevent segfault during curl handle reuse

If a curl handle is configured with special options, they may reference
information that is freed after the request is complete which can cause
a segfault if the curl handle is reused for a different type of request.

This patch resets these options to a safe state when a transfer slot is
assigned to a new request.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agosend-email: only 'require' instead of 'use' Net::SMTP
Johannes Schindelin [Wed, 31 May 2006 22:55:47 +0000 (00:55 +0200)]
send-email: only 'require' instead of 'use' Net::SMTP

This was proposed by Eric Wong and fixes the test. (Of course, git-send-email
does not work, if there is no Net::SMTP here, but it will say what is wrong
when you actually try to use send-email.)

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoAllow multiple -m options to git-commit.
Shawn Pearce [Mon, 29 May 2006 08:45:49 +0000 (04:45 -0400)]
Allow multiple -m options to git-commit.

I find it very convenient to be able to supply multiple paragraphs
of text on the command line with a single git-commit call.  This
change permits multiple -m/--message type options to be supplied
to git-commit with each message being added as its own paragraph
of text in the commit message.

The -m option is still not permitted with -c/-C/-F nor are multiple
occurrences of these options permitted.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agofetch.c: do not pass uninitialized lock to unlock_ref().
Junio C Hamano [Wed, 31 May 2006 22:23:44 +0000 (15:23 -0700)]
fetch.c: do not pass uninitialized lock to unlock_ref().

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoformat-patch --signoff
Junio C Hamano [Wed, 31 May 2006 22:11:49 +0000 (15:11 -0700)]
format-patch --signoff

This resurrects --signoff option to format-patch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-svnimport: Improved detection of merges.
Florian Forster [Wed, 31 May 2006 10:32:08 +0000 (12:32 +0200)]
git-svnimport: Improved detection of merges.

The regexes detecting merges (while still relying on the commit messages,
though) have been improved to catch saner (and hopefully more) messages. The
old regex was so generic that it often matched something else and missed the
actual merge-message.
Also, the regex given with the `-M' commandline-option is checked first:
Explicitely given regexes should be considered better than the builtin ones,
and should therefore be given a chance to match a message first.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoImproved pack format documentation.
Shawn Pearce [Mon, 29 May 2006 07:17:18 +0000 (03:17 -0400)]
Improved pack format documentation.

While trying to implement a pack reader in Java I was mislead by
some facts listed in this documentation as well as found a few
details to be missing about the pack header.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agotree_entry(): new tree-walking helper function
Linus Torvalds [Tue, 30 May 2006 16:45:45 +0000 (09:45 -0700)]
tree_entry(): new tree-walking helper function

This adds a "tree_entry()" function that combines the common operation of
doing a "tree_entry_extract()" + "update_tree_entry()".

It also has a simplified calling convention, designed for simple loops
that traverse over a whole tree: the arguments are pointers to the tree
descriptor and a name_entry structure to fill in, and it returns a boolean
"true" if there was an entry left to be gotten in the tree.

This allows tree traversal with

struct tree_desc desc;
struct name_entry entry;

desc.buf = tree->buffer;
desc.size = tree->size;
while (tree_entry(&desc, &entry) {
... use "entry.{path, sha1, mode, pathlen}" ...
}

which is not only shorter than writing it out in full, it's hopefully less
error prone too.

[ It's actually a tad faster too - we don't need to recalculate the entry
  pathlength in both extract and update, but need to do it only once.
  Also, some callers can avoid doing a "strlen()" on the result, since
  it's returned as part of the name_entry structure.

  However, by now we're talking just 1% speedup on "git-rev-list --objects
  --all", and we're definitely at the point where tree walking is no
  longer the issue any more. ]

NOTE! Not everybody wants to use this new helper function, since some of
the tree walkers very much on purpose do the descriptor update separately
from the entry extraction. So the "extract + update" sequence still
remains as the core sequence, this is just a simplified interface.

We should probably add a silly two-line inline helper function for
initializing the descriptor from the "struct tree" too, just to cut down
on the noise from that common "desc" initializer.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit_exec_path, execv_git_cmd: ignore empty environment variables
Dmitry V. Levin [Mon, 29 May 2006 00:34:34 +0000 (04:34 +0400)]
git_exec_path, execv_git_cmd: ignore empty environment variables

Ignoring empty environment variables is good common practice.
Ignoring --exec-path with empty argument won't harm, too:
if user means current directory, there is a "--exec-path=."

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoexecv_git_cmd: Fix stack buffer overflow.
Dmitry V. Levin [Tue, 30 May 2006 14:58:52 +0000 (18:58 +0400)]
execv_git_cmd: Fix stack buffer overflow.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoFixed Cygwin CR-munging problem in mailsplit
Salikh Zakirov [Sat, 27 May 2006 17:57:29 +0000 (21:57 +0400)]
Fixed Cygwin CR-munging problem in mailsplit

Do not open mailbox file as fopen(..., "rt")
as this strips CR characters from the diff,
thus breaking the patch context for changes
in CRLF files.

Signed-off-by: Salikh Zakirov <Salikh.Zakirov@Intel.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'master' into new
Paul Mackerras [Tue, 30 May 2006 11:35:07 +0000 (21:35 +1000)]
Merge branch 'master' into new

Conflicts:

gitk

18 years agogitk: Add a goto next/previous highlighted commit function
Paul Mackerras [Tue, 30 May 2006 11:33:07 +0000 (21:33 +1000)]
gitk: Add a goto next/previous highlighted commit function

This is invoked by shift-down/shift-up.  It relies on a patch to
git-diff-tree that has recently gone into the git repository, commit
ID e0c97ca6 (without this it may just sit there doing waiting for
git-diff-tree when looking for the next/previous highlight).

Signed-off-by: Paul Mackerras <paulus@samba.org>
18 years agoMerge branch 'ew/tests'
Junio C Hamano [Tue, 30 May 2006 08:48:54 +0000 (01:48 -0700)]
Merge branch 'ew/tests'

* ew/tests:
  t6000lib: workaround a possible dash bug
  t5500-fetch-pack: remove local (bashism) usage.
  tests: Remove heredoc usage inside quotes
  t3300-funny-names: shell portability fixes

18 years agosend-email: do not pass bogus address to local sendmail binary
Junio C Hamano [Tue, 30 May 2006 06:53:13 +0000 (23:53 -0700)]
send-email: do not pass bogus address to local sendmail binary

This makes t9001 test happy.  Also fixes the warning on
uninitialized $references variable again.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoAdd a basic test case for git send-email, and fix some real bugs discovered.
Ryan Anderson [Mon, 29 May 2006 19:30:15 +0000 (12:30 -0700)]
Add a basic test case for git send-email, and fix some real bugs discovered.

Signed-off-by: Ryan Anderson <rda@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoFix a bug in email extraction used in git-send-email.
Ryan Anderson [Mon, 29 May 2006 19:30:14 +0000 (12:30 -0700)]
Fix a bug in email extraction used in git-send-email.

(Also, kill off an accidentally created warning.)

Signed-off-by: Ryan Anderson <rda@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoAdd support for --bcc to git-send-email.
Ryan Anderson [Mon, 29 May 2006 19:30:13 +0000 (12:30 -0700)]
Add support for --bcc to git-send-email.

Signed-off-by: Ryan Anderson <rda@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-send-email: Add References: headers to emails, in addition to In-Reply-To:
Ryan Anderson [Mon, 29 May 2006 19:30:12 +0000 (12:30 -0700)]
git-send-email: Add References: headers to emails, in addition to In-Reply-To:

Signed-off-by: Ryan Anderson <rda@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-clean fails on files beginning with a dash
Dennis Stosberg [Mon, 29 May 2006 15:06:32 +0000 (17:06 +0200)]
git-clean fails on files beginning with a dash

Reproducible with:

$ git init-db
$ echo "some text" >-file
$ git clean
Removing -file
rm: invalid option -- l
Try `rm --help' for more information.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-svn: remove assertion that broke with older versions of svn
Eric Wong [Tue, 30 May 2006 02:03:46 +0000 (19:03 -0700)]
git-svn: remove assertion that broke with older versions of svn

svn < 1.3.x would display changes to keywords lines as modified
if they aren't expanded in the working copy.  We already check
for changes against the git tree here, so checking against the
svn one is probably excessive.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-svn: t0001: workaround a heredoc bug in old versions of dash
Eric Wong [Tue, 30 May 2006 02:03:45 +0000 (19:03 -0700)]
git-svn: t0001: workaround a heredoc bug in old versions of dash

The dash installed on my Debian Sarge boxes don't seem to like
<<'' as a heredoc starter.  Recent versions of dash do not need
this fix.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: fix a tutorial-2 typo
J. Bruce Fields [Mon, 29 May 2006 23:31:36 +0000 (19:31 -0400)]
Documentation: fix a tutorial-2 typo

Fix a typo.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: retitle the git-core tutorial
J. Bruce Fields [Mon, 29 May 2006 23:31:34 +0000 (19:31 -0400)]
Documentation: retitle the git-core tutorial

Give the git-core tutorial a name that better reflects its intended
audience.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agodocumentation: add brief mention of cat-file to tutorial part I
J. Bruce Fields [Mon, 29 May 2006 23:31:33 +0000 (19:31 -0400)]
documentation: add brief mention of cat-file to tutorial part I

I'd rather avoid git cat-file so early on, but the

git-cat-file -p old-commit:/path/to/file

trick is too useful....

Also fix a nearby typo while we're at it.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agodocumentation: mention gitk font adjustment in tutorial
J. Bruce Fields [Mon, 29 May 2006 23:31:32 +0000 (19:31 -0400)]
documentation: mention gitk font adjustment in tutorial

Kind of silly, but the font I get by default in gitk makes it mostly
unusable for me, so this is the first thing I'd want to know about.
(But maybe there's a better suggestion than just Ctrl-='ing until
satisfied.)

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoFix some documentation typoes
Horst von Brand [Mon, 29 May 2006 21:11:28 +0000 (17:11 -0400)]
Fix some documentation typoes

Fix some typoes in Documentation/everyday.txt

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'jc/lt-tree-n-cache-tree' into lt/tree-2
Junio C Hamano [Tue, 30 May 2006 05:13:09 +0000 (22:13 -0700)]
Merge branch 'jc/lt-tree-n-cache-tree' into lt/tree-2

* jc/lt-tree-n-cache-tree:
  adjust to the rebased series by Linus.
  Remove "tree->entries" tree-entry list from tree parser
  Switch "read_tree_recursive()" over to tree-walk functionality
  Make "tree_entry" have a SHA1 instead of a union of object pointers
  Add raw tree buffer info to "struct tree"

This results as if an "ours" merge absorbed the previous "next"
branch change into the 10-patch series, but it really is a result
of an honest merge.

nothing to commit

18 years agoadjust to the rebased series by Linus.
Junio C Hamano [Tue, 30 May 2006 05:00:21 +0000 (22:00 -0700)]
adjust to the rebased series by Linus.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoRemove last vestiges of generic tree_entry_list
Linus Torvalds [Mon, 29 May 2006 19:21:28 +0000 (12:21 -0700)]
Remove last vestiges of generic tree_entry_list

The old tree_entry_list is dead, long live the unified single tree
parser.

Yes, we now still have a compatibility function to create a bogus
tree_entry_list in builtin-read-tree.c, but that is now entirely local
to that very messy piece of code.

I'd love to clean read-tree.c up too, but I'm too scared right now, so
the best I can do is to just contain the damage, and try to make sure
that no new users of the tree_entry_list sprout up by not having it as
an exported interface any more.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoConvert fetch.c: process_tree() to raw tree walker
Linus Torvalds [Mon, 29 May 2006 19:20:48 +0000 (12:20 -0700)]
Convert fetch.c: process_tree() to raw tree walker

This leaves only the horrid code in builtin-read-tree.c using the old
interface. Some day I will gather the strength to tackle that one too.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoConvert "mark_tree_uninteresting()" to raw tree walker
Linus Torvalds [Mon, 29 May 2006 19:20:14 +0000 (12:20 -0700)]
Convert "mark_tree_uninteresting()" to raw tree walker

Not very many users to go..

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoRemove unused "zeropad" entry from tree_list_entry
Linus Torvalds [Mon, 29 May 2006 19:19:37 +0000 (12:19 -0700)]
Remove unused "zeropad" entry from tree_list_entry

That was a hack, only needed because 'git fsck-objects' didn't look at
the raw tree format.  Now that fsck traverses the tree itself, we can
drop it.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agofsck-objects: avoid unnecessary tree_entry_list usage
Linus Torvalds [Mon, 29 May 2006 19:19:02 +0000 (12:19 -0700)]
fsck-objects: avoid unnecessary tree_entry_list usage

Prime example of where the raw tree parser is easier for everybody.

[jc: "Aieee" one-liner fix from the list applied. ]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoRemove "tree->entries" tree-entry list from tree parser
Linus Torvalds [Mon, 29 May 2006 19:18:33 +0000 (12:18 -0700)]
Remove "tree->entries" tree-entry list from tree parser

Instead, just use the tree buffer directly, and use the tree-walk
infrastructure to walk the buffers instead of the tree-entry list.

The tree-entry list is inefficient, and generates tons of small
allocations for no good reason. The tree-walk infrastructure is
generally no harder to use than following a linked list, and allows
us to do most tree parsing in-place.

Some programs still use the old tree-entry lists, and are a bit
painful to convert without major surgery. For them we have a helper
function that creates a temporary tree-entry list on demand.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agobuiltin-read-tree.c: avoid tree_entry_list in prime_cache_tree_rec()
Linus Torvalds [Mon, 29 May 2006 19:18:00 +0000 (12:18 -0700)]
builtin-read-tree.c: avoid tree_entry_list in prime_cache_tree_rec()

Use the raw tree walker instead.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoSwitch "read_tree_recursive()" over to tree-walk functionality
Linus Torvalds [Mon, 29 May 2006 19:17:28 +0000 (12:17 -0700)]
Switch "read_tree_recursive()" over to tree-walk functionality

Don't use the tree_entry list any more.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake "tree_entry" have a SHA1 instead of a union of object pointers
Linus Torvalds [Mon, 29 May 2006 19:16:46 +0000 (12:16 -0700)]
Make "tree_entry" have a SHA1 instead of a union of object pointers

This is preparatory work for further cleanups, where we try to make
tree_entry look more like the more efficient tree-walk descriptor.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake "struct tree" contain the pointer to the tree buffer
Linus Torvalds [Mon, 29 May 2006 19:16:12 +0000 (12:16 -0700)]
Make "struct tree" contain the pointer to the tree buffer

This allows us to avoid allocating information for names etc, because
we can just use the information from the tree buffer directly.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake git-diff-tree indicate when it flushes
Paul Mackerras [Tue, 30 May 2006 02:01:38 +0000 (19:01 -0700)]
Make git-diff-tree indicate when it flushes

There are times when gitk needs to know that the commits it has sent
to git-diff-tree --stdin did not match, and it needs to know in a
timely fashion even if none of them match.  At the moment,
git-diff-tree outputs nothing for non-matching commits, so it is
impossible for gitk to distinguish between git-diff-tree being slow
and git-diff-tree saying no.

This makes git-diff-tree flush its output and echo back the
input line when it is not a valid-looking object name.  Gitk, or
other users of git-diff-tree --stdin, can use a blank line or
any other "marker line" to indicate that git-diff-tree has
processed all the commits on its input up to the echoed back
marker line, and any commits that have not been output do not
match.

[jc: re-done after a couple of back-and-forth discussion on the list.]

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoRemove unnecessary output from t3600-rm.
Shawn Pearce [Mon, 29 May 2006 08:06:48 +0000 (04:06 -0400)]
Remove unnecessary output from t3600-rm.

Moved the setup commands into test_expect_success blocks so their
output is hidden unless -v is used.  This makes the test suite look
a little cleaner when the rm test-file setup step fails (and was
expected to fail for most cases).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitk: Provide ability to highlight based on relationship to selected commit
Paul Mackerras [Mon, 29 May 2006 09:50:02 +0000 (19:50 +1000)]
gitk: Provide ability to highlight based on relationship to selected commit

This provides a way to highlight commits that are, or are not,
descendents or ancestors of the currently selected commit.  It's
still rough around the edges but seems to be useful even so.

Signed-off-by: Paul Mackerras <paulus@samba.org>
18 years agoMerge branch 'lt/apply'
Junio C Hamano [Mon, 29 May 2006 06:00:50 +0000 (23:00 -0700)]
Merge branch 'lt/apply'

* lt/apply:
  apply: force matching at the beginning.
  Add a test-case for git-apply trying to add an ending line
  apply: treat EOF as proper context.

18 years agoMerge branch 'jc/cache-tree'
Junio C Hamano [Mon, 29 May 2006 05:57:47 +0000 (22:57 -0700)]
Merge branch 'jc/cache-tree'

* jc/cache-tree: (26 commits)
  builtin-rm: squelch compiler warnings.
  git-write-tree writes garbage on sparc64
  Fix crash when reading the empty tree
  fsck-objects: do not segfault on missing tree in cache-tree
  cache-tree: a bit more debugging support.
  read-tree: invalidate cache-tree entry when a new index entry is added.
  Fix test-dump-cache-tree in one-tree disappeared case.
  fsck-objects: mark objects reachable from cache-tree
  cache-tree: replace a sscanf() by two strtol() calls
  cache-tree.c: typefix
  test-dump-cache-tree: validate the cached data as well.
  cache_tree_update: give an option to update cache-tree only.
  read-tree: teach 1-way merege and plain read to prime cache-tree.
  read-tree: teach 1 and 2 way merges about cache-tree.
  update-index: when --unresolve, smudge the relevant cache-tree entries.
  test-dump-cache-tree: report number of subtrees.
  cache-tree: sort the subtree entries.
  Teach fsck-objects about cache-tree.
  index: make the index file format extensible.
  cache-tree: protect against "git prune".
  ...

Conflicts:

Makefile, builtin.h, git.c: resolved the same way as in next.

18 years agoMerge branch 'lt/tree' into jc/lt-tree-n-cache-tree
Junio C Hamano [Mon, 29 May 2006 05:47:53 +0000 (22:47 -0700)]
Merge branch 'lt/tree' into jc/lt-tree-n-cache-tree

* lt/tree: (98 commits)
  Remove "tree->entries" tree-entry list from tree parser
  Switch "read_tree_recursive()" over to tree-walk functionality
  Make "tree_entry" have a SHA1 instead of a union of object pointers
  Add raw tree buffer info to "struct tree"
  Don't use "sscanf()" for tree mode scanning
  git-fetch: avoid using "case ... in (arm)"
  mailinfo: skip bogus UNIX From line inside body
  mailinfo: More carefully parse header lines in read_one_header_line()
  Allow in body headers beyond the in body header prefix.
  More accurately detect header lines in read_one_header_line
  In handle_body only read a line if we don't already have one.
  Refactor commit messge handling.
  Move B and Q decoding into check header.
  Make read_one_header_line return a flag not a length.
  Fix memory leak in "git rev-list --objects"
  gitview: Move the console error messages to message dialog
  gitview: Add key binding for F5.
  Let git-clone to pass --template=dir option to git-init-db.
  Make cvsexportcommit create parent directories as needed.
  Document current cvsexportcommit limitations.
  ...

Conflicts:

Makefile, builtin.h, git.c are trivially resolved.
builtin-read-tree.c needed adjustment for the tree
parser change.

18 years agoMerge branch 'jc/dirwalk-n-cache-tree' into jc/cache-tree
Junio C Hamano [Mon, 29 May 2006 05:34:34 +0000 (22:34 -0700)]
Merge branch 'jc/dirwalk-n-cache-tree' into jc/cache-tree

* jc/dirwalk-n-cache-tree: (212 commits)
  builtin-rm: squelch compiler warnings.
  Add builtin "git rm" command
  Move pathspec matching from builtin-add.c into dir.c
  Prevent bogus paths from being added to the index.
  builtin-add: fix unmatched pathspec warnings.
  Remove old "git-add.sh" remnants
  builtin-add: warn on unmatched pathspecs
  Do "git add" as a builtin
  Clean up git-ls-file directory walking library interface
  libify git-ls-files directory traversal
  Add a conversion tool to migrate remote information into the config
  fetch, pull: ask config for remote information
  Fix build procedure for builtin-init-db
  read-tree -m -u: do not overwrite or remove untracked working tree files.
  apply --cached: do not check newly added file in the working tree
  Implement a --dry-run option to git-quiltimport
  Implement git-quiltimport
  Revert "builtin-grep: workaround for non GNU grep."
  builtin-grep: workaround for non GNU grep.
  builtin-grep: workaround for non GNU grep.
  ...

18 years agoRemove "tree->entries" tree-entry list from tree parser
Linus Torvalds [Sun, 28 May 2006 22:13:53 +0000 (15:13 -0700)]
Remove "tree->entries" tree-entry list from tree parser

This finally removes the tree-entry list from "struct tree", since most of
the users can just use the tree-walk infrastructure to walk the raw tree
buffers instead of the tree-entry list.

The tree-entry list is inefficient, and generates tons of small
allocations for no good reason. The tree-walk infrastructure is generally
no harder to use than following a linked list, and allows us to do most
tree parsing in-place.

Some programs still use the old tree-entry lists, and are a bit painful to
convert without major surgery. For them we have a helper function that
creates a temporary tree-entry list on demand. We can convert those too
eventually, but with this they no longer affect any users who don't need
the explicit lists.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoSwitch "read_tree_recursive()" over to tree-walk functionality
Linus Torvalds [Sun, 28 May 2006 22:11:28 +0000 (15:11 -0700)]
Switch "read_tree_recursive()" over to tree-walk functionality

Don't use the tree_entry list, it really had no major reason not to just
walk the raw tree instead.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake "tree_entry" have a SHA1 instead of a union of object pointers
Linus Torvalds [Sun, 28 May 2006 22:10:04 +0000 (15:10 -0700)]
Make "tree_entry" have a SHA1 instead of a union of object pointers

This is preparatory work for further cleanups, where we try to make
tree_entry look more like the more efficient tree-walk descriptor.

Instead of having a union of pointers to blob/tree/objects, this just
makes "struct tree_entry" have the raw SHA1, and makes all the users use
that instead (often that implies adding a "lookup_tree(..)" on the sha1,
but sometimes the user just wanted the SHA1 in the first place, and it
just avoids an unnecessary indirection).

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoAdd raw tree buffer info to "struct tree"
Linus Torvalds [Sun, 28 May 2006 22:07:07 +0000 (15:07 -0700)]
Add raw tree buffer info to "struct tree"

This allows us to avoid allocating information for names etc, because
we can just use the information from the tree buffer directly.

We still keep the old "tree_entry_list" in struct tree as well, so old
users aren't affected, apart from the fact that the allocations are
different (if you free a tree entry, you should no longer free the name
allocation for it, since it's allocated as part of "tree->buffer")

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDon't use "sscanf()" for tree mode scanning
Linus Torvalds [Sun, 28 May 2006 23:16:15 +0000 (16:16 -0700)]
Don't use "sscanf()" for tree mode scanning

Doing an oprofile run on the result of my git rev-list memory leak fixes
and tree parsing cleanups, I was surprised by the third-highest entry
being

samples  %        image name               app name                 symbol name
179751    2.7163  libc-2.4.so              libc-2.4.so              _IO_vfscanf@@GLIBC_2.4

where that 2.7% is actually more than 5% of one CPU, because this was run
on a dual CPU setup with the other CPU just being idle.

That seems to all be from the use of 'sscanf(tree, "%o", &mode)' for the
tree buffer parsing.

So do the trivial octal parsing by hand, which also gives us where the
first space in the string is (and thus where the pathname starts) so we
can get rid of the "strchr(tree, ' ')" call too.

This brings the "git rev-list --all --objects" time down from 63 seconds
to 55 seconds on the historical kernel archive for me, so it's quite
noticeable - tree parsing is a lot of what we end up doing when following
all the objects.

[ I also see a 5% speedup on a full "git fsck-objects" on the current
  kernel archive, so that sscanf() really does seem to have hurt our
  performance by a surprising amount ]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-fetch: avoid using "case ... in (arm)"
Junio C Hamano [Mon, 29 May 2006 02:24:28 +0000 (19:24 -0700)]
git-fetch: avoid using "case ... in (arm)"

NetBSD ash chokes on the optional open parenthesis for case arms.  Inside
$(command substitution), however, bash barfs without.  So adjust things
accordingly.

Originally pointed out by Dennis Stosberg.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'jc/mailinfo'
Junio C Hamano [Sun, 28 May 2006 20:39:05 +0000 (13:39 -0700)]
Merge branch 'jc/mailinfo'

* jc/mailinfo:
  mailinfo: skip bogus UNIX From line inside body