Merge branch 'master' of git://linux-nfs.org/~bfields/git

This is in the hope of giving JBF's user-manual wider exposure.
I am not very happy with trailing whitespaces in the new
document, but let's not worry too much about the formatting
issues for now, but concentrate more on the structure and the
contents.
diff --git a/.gitignore b/.gitignore
index 6da1cdb..a43444f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@
 git-clone
 git-commit
 git-commit-tree
+git-config
 git-convert-objects
 git-count-objects
 git-cvsexportcommit
@@ -41,6 +42,7 @@
 git-fmt-merge-msg
 git-for-each-ref
 git-format-patch
+git-fsck
 git-fsck-objects
 git-gc
 git-get-tar-commit-id
diff --git a/.mailmap b/.mailmap
index 2c658f4..c7a3a75 100644
--- a/.mailmap
+++ b/.mailmap
@@ -30,7 +30,9 @@
 Santi Béjar <sbejar@gmail.com>
 Sean Estabrooks <seanlkml@sympatico.ca>
 Shawn O. Pearce <spearce@spearce.org>
+Theodore Ts'o <tytso@mit.edu>
 Tony Luck <tony.luck@intel.com>
+Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de>
 Ville Skyttä <scop@xemacs.org>
 YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
 anonymous <linux@horizon.com>
diff --git a/Documentation/.gitignore b/Documentation/.gitignore
index c87c61a..6a51331 100644
--- a/Documentation/.gitignore
+++ b/Documentation/.gitignore
@@ -4,4 +4,4 @@
 *.7
 howto-index.txt
 doc.dep
-README
+cmds-*.txt
diff --git a/Documentation/Makefile b/Documentation/Makefile
index c2ee5b4..5e012f4 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -71,14 +71,24 @@
 
 -include doc.dep
 
-git.7: README
+cmds_txt = cmds-ancillaryinterrogators.txt \
+	cmds-ancillarymanipulators.txt \
+	cmds-mainporcelain.txt \
+	cmds-plumbinginterrogators.txt \
+	cmds-plumbingmanipulators.txt \
+	cmds-synchingrepositories.txt \
+	cmds-synchelpers.txt \
+	cmds-purehelpers.txt \
+	cmds-foreignscminterface.txt
 
-README: ../README
-	cp $< $@
+$(cmds_txt): cmd-list.perl $(MAN1_TXT)
+	perl ./cmd-list.perl
 
+git.7 git.html: git.txt core-intro.txt
 
 clean:
-	rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html doc.dep README
+	rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html doc.dep
+	rm -f $(cmds_txt)
 
 %.html : %.txt
 	asciidoc -b xhtml11 -d manpage -f asciidoc.conf $<
@@ -95,8 +105,6 @@
 user-manual.html: user-manual.xml
 	xmlto -m /etc/asciidoc/docbook-xsl/xhtml.xsl html-nochunks $<
 
-git.html: git.txt README
-
 glossary.html : glossary.txt sort_glossary.pl
 	cat $< | \
 	perl sort_glossary.pl | \
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 646b6e7..ce85d06 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -23,7 +23,8 @@
 
 Oh, another thing.  I am picky about whitespaces.  Make sure your
 changes do not trigger errors with the sample pre-commit hook shipped
-in templates/hooks--pre-commit.
+in templates/hooks--pre-commit.  To help ensure this does not happen,
+run git diff --check on your changes before you commit.
 
 
 (2) Generate your patch using git tools out of your commits.
@@ -72,7 +73,9 @@
 material between the three dash lines and the diffstat.
 
 Do not attach the patch as a MIME attachment, compressed or not.
-Do not let your e-mail client send quoted-printable.  Many
+Do not let your e-mail client send quoted-printable.  Do not let
+your e-mail client send format=flowed which would destroy
+whitespaces in your patches. Many
 popular e-mail applications will not always transmit a MIME
 attachment as plain text, making it impossible to comment on
 your code.  A MIME attachment also takes a bit more time to
@@ -312,3 +315,19 @@
 	mail.identity.default.compose_html	=> false
 	mail.identity.id?.compose_html		=> false
 
+
+
+Gnus
+----
+
+'|' in the *Summary* buffer can be used to pipe the current
+message to an external program, and this is a handy way to drive
+"git am".  However, if the message is MIME encoded, what is
+piped into the program is the representation you see in your
+*Article* buffer after unwrapping MIME.  This is often not what
+you would want for two reasons.  It tends to screw up non ASCII
+characters (most notably in people's names), and also
+whitespaces (fatal in patches).  Running 'C-u g' to display the
+message in raw form before using '|' to run the pipe can work
+this problem around.
+
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
new file mode 100755
index 0000000..6dba8d8
--- /dev/null
+++ b/Documentation/cmd-list.perl
@@ -0,0 +1,186 @@
+#
+
+sub format_one {
+	my ($out, $name) = @_;
+	my ($state, $description);
+	open I, '<', "$name.txt" or die "No such file $name.txt";
+	while (<I>) {
+		if (/^NAME$/) {
+			$state = 1;
+			next;
+		}
+		if ($state == 1 && /^----$/) {
+			$state = 2;
+			next;
+		}
+		next if ($state != 2);
+		chomp;
+		$description = $_;
+		last;
+	}
+	close I;
+	if (!defined $description) {
+		die "No description found in $name.txt";
+	}
+	if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
+		print $out "gitlink:$name\[1\]::\n";
+		print $out "\t$text.\n\n";
+	}
+	else {
+		die "Description does not match $name: $description";
+	}
+}
+
+my %cmds = ();
+while (<DATA>) {
+	next if /^#/;
+
+	chomp;
+	my ($name, $cat) = /^(\S+)\s+(.*)$/;
+	push @{$cmds{$cat}}, $name;
+}
+
+for my $cat (qw(ancillaryinterrogators
+		ancillarymanipulators
+		mainporcelain
+		plumbinginterrogators
+		plumbingmanipulators
+		synchingrepositories
+		foreignscminterface
+		purehelpers
+		synchelpers)) {
+	my $out = "cmds-$cat.txt";
+	open O, '>', "$out+" or die "Cannot open output file $out+";
+	for (@{$cmds{$cat}}) {
+		format_one(\*O, $_);
+	}
+	close O;
+	rename "$out+", "$out";
+}
+
+__DATA__
+git-add                                 mainporcelain
+git-am                                  mainporcelain
+git-annotate                            ancillaryinterrogators
+git-applymbox                           ancillaryinterrogators
+git-applypatch                          purehelpers
+git-apply                               plumbingmanipulators
+git-archimport                          foreignscminterface
+git-archive                             mainporcelain
+git-bisect                              mainporcelain
+git-blame                               ancillaryinterrogators
+git-branch                              mainporcelain
+git-cat-file                            plumbinginterrogators
+git-checkout-index                      plumbingmanipulators
+git-checkout                            mainporcelain
+git-check-ref-format                    purehelpers
+git-cherry                              ancillaryinterrogators
+git-cherry-pick                         mainporcelain
+git-clean                               mainporcelain
+git-clone                               mainporcelain
+git-commit                              mainporcelain
+git-commit-tree                         plumbingmanipulators
+git-convert-objects                     ancillarymanipulators
+git-count-objects                       ancillaryinterrogators
+git-cvsexportcommit                     foreignscminterface
+git-cvsimport                           foreignscminterface
+git-cvsserver                           foreignscminterface
+git-daemon                              synchingrepositories
+git-describe                            mainporcelain
+git-diff-files                          plumbinginterrogators
+git-diff-index                          plumbinginterrogators
+git-diff                                mainporcelain
+git-diff-stages                         plumbinginterrogators
+git-diff-tree                           plumbinginterrogators
+git-fetch                               mainporcelain
+git-fetch-pack                          synchingrepositories
+git-fmt-merge-msg                       purehelpers
+git-for-each-ref                        plumbinginterrogators
+git-format-patch                        mainporcelain
+git-fsck	                        ancillaryinterrogators
+git-gc                                  mainporcelain
+git-get-tar-commit-id                   ancillaryinterrogators
+git-grep                                mainporcelain
+git-hash-object                         plumbingmanipulators
+git-http-fetch                          synchelpers
+git-http-push                           synchelpers
+git-imap-send                           foreignscminterface
+git-index-pack                          plumbingmanipulators
+git-init                                mainporcelain
+git-instaweb                            ancillaryinterrogators
+gitk                                    mainporcelain
+git-local-fetch                         synchingrepositories
+git-log                                 mainporcelain
+git-lost-found                          ancillarymanipulators
+git-ls-files                            plumbinginterrogators
+git-ls-remote                           plumbinginterrogators
+git-ls-tree                             plumbinginterrogators
+git-mailinfo                            purehelpers
+git-mailsplit                           purehelpers
+git-merge-base                          plumbinginterrogators
+git-merge-file                          plumbingmanipulators
+git-merge-index                         plumbingmanipulators
+git-merge                               mainporcelain
+git-merge-one-file                      purehelpers
+git-merge-tree                          ancillaryinterrogators
+git-mktag                               plumbingmanipulators
+git-mktree                              plumbingmanipulators
+git-mv                                  mainporcelain
+git-name-rev                            plumbinginterrogators
+git-pack-objects                        plumbingmanipulators
+git-pack-redundant                      plumbinginterrogators
+git-pack-refs                           ancillarymanipulators
+git-parse-remote                        synchelpers
+git-patch-id                            purehelpers
+git-peek-remote                         purehelpers
+git-prune                               ancillarymanipulators
+git-prune-packed                        plumbingmanipulators
+git-pull                                mainporcelain
+git-push                                mainporcelain
+git-quiltimport                         foreignscminterface
+git-read-tree                           plumbingmanipulators
+git-rebase                              mainporcelain
+git-receive-pack                        synchelpers
+git-reflog                              ancillarymanipulators
+git-relink                              ancillarymanipulators
+git-repack                              ancillarymanipulators
+git-config                              ancillarymanipulators
+git-request-pull                        foreignscminterface
+git-rerere                              ancillaryinterrogators
+git-reset                               mainporcelain
+git-resolve                             mainporcelain
+git-revert                              mainporcelain
+git-rev-list                            plumbinginterrogators
+git-rev-parse                           ancillaryinterrogators
+git-rm                                  mainporcelain
+git-runstatus                           ancillaryinterrogators
+git-send-email                          foreignscminterface
+git-send-pack                           synchingrepositories
+git-shell                               synchelpers
+git-shortlog                            mainporcelain
+git-show                                mainporcelain
+git-show-branch                         ancillaryinterrogators
+git-show-index                          plumbinginterrogators
+git-show-ref                            plumbinginterrogators
+git-sh-setup                            purehelpers
+git-ssh-fetch                           synchingrepositories
+git-ssh-upload                          synchingrepositories
+git-status                              mainporcelain
+git-stripspace                          purehelpers
+git-svn                                 foreignscminterface
+git-svnimport                           foreignscminterface
+git-symbolic-ref                        plumbingmanipulators
+git-tag                                 mainporcelain
+git-tar-tree                            plumbinginterrogators
+git-unpack-file                         plumbinginterrogators
+git-unpack-objects                      plumbingmanipulators
+git-update-index                        plumbingmanipulators
+git-update-ref                          plumbingmanipulators
+git-update-server-info                  synchingrepositories
+git-upload-archive                      synchelpers
+git-upload-pack                         synchelpers
+git-var                                 plumbinginterrogators
+git-verify-pack                         plumbinginterrogators
+git-verify-tag                          ancillaryinterrogators
+git-whatchanged                         ancillaryinterrogators
+git-write-tree                          plumbingmanipulators
diff --git a/Documentation/config.txt b/Documentation/config.txt
index f7dba89..e5e019f 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2,21 +2,84 @@
 ------------------
 
 The git configuration file contains a number of variables that affect
-the git command's behavior. They can be used by both the git plumbing
+the git command's behavior. `.git/config` file for each repository
+is used to store the information for that repository, and
+`$HOME/.gitconfig` is used to store per user information to give
+fallback values for `.git/config` file.
+
+They can be used by both the git plumbing
 and the porcelains. The variables are divided into sections, where
 in the fully qualified variable name the variable itself is the last
 dot-separated segment and the section name is everything before the last
 dot. The variable names are case-insensitive and only alphanumeric
 characters are allowed. Some variables may appear multiple times.
 
+Syntax
+~~~~~~
+
 The syntax is fairly flexible and permissive; whitespaces are mostly
-ignored. The '#' and ';' characters begin comments to the end of line,
-blank lines are ignored, lines containing strings enclosed in square
-brackets start sections and all the other lines are recognized
-as setting variables, in the form 'name = value'. If there is no equal
-sign on the line, the entire line is taken as 'name' and the variable
-is recognized as boolean "true". String values may be entirely or partially
-enclosed in double quotes; some variables may require special value format.
+ignored.  The '#' and ';' characters begin comments to the end of line,
+blank lines are ignored.
+
+The file consists of sections and variables.  A section begins with
+the name of the section in square brackets and continues until the next
+section begins.  Section names are not case sensitive.  Only alphanumeric
+characters, '`-`' and '`.`' are allowed in section names.  Each variable
+must belong to some section, which means that there must be section
+header before first setting of a variable.
+
+Sections can be further divided into subsections.  To begin a subsection
+put its name in double quotes, separated by space from the section name,
+in the section header, like in example below:
+
+--------
+	[section "subsection"]
+
+--------
+
+Subsection names can contain any characters except newline (doublequote
+'`"`' and backslash have to be escaped as '`\"`' and '`\\`',
+respecitvely) and are case sensitive.  Section header cannot span multiple
+lines.  Variables may belong directly to a section or to a given subsection.
+You can have `[section]` if you have `[section "subsection"]`, but you
+don't need to.
+
+There is also (case insensitive) alternative `[section.subsection]` syntax.
+In this syntax subsection names follow the same restrictions as for section
+name.
+
+All the other lines are recognized as setting variables, in the form
+'name = value'.  If there is no equal sign on the line, the entire line
+is taken as 'name' and the variable is recognized as boolean "true".
+The variable names are case-insensitive and only alphanumeric
+characters and '`-`' are allowed.  There can be more than one value
+for a given variable; we say then that variable is multivalued.
+
+Leading and trailing whitespace in a variable value is discarded.
+Internal whitespace within a variable value is retained verbatim.
+
+The values following the equals sign in variable assign are all either
+a string, an integer, or a boolean.  Boolean values may be given as yes/no,
+0/1 or true/false.  Case is not significant in boolean values, when
+converting value to the canonical form using '--bool' type specifier;
+`git-config` will ensure that the output is "true" or "false".
+
+String values may be entirely or partially enclosed in double quotes.
+You need to enclose variable value in double quotes if you want to
+preserve leading or trailing whitespace, or if variable value contains
+beginning of comment characters (if it contains '#' or ';').
+Double quote '`"`' and backslash '`\`' characters in variable value must
+be escaped: use '`\"`' for '`"`' and '`\\`' for '`\`'.
+
+The following escape sequences (beside '`\"`' and '`\\`') are recognized:
+'`\n`' for newline character (NL), '`\t`' for horizontal tabulation (HT, TAB)
+and '`\b`' for backspace (BS).  No other char escape sequence, nor octal
+char sequences are valid.
+
+Variable value ending in a '`\`' is continued on the next line in the
+customary UNIX fashion.
+
+Some variables may require special value format.
 
 Example
 ~~~~~~~
@@ -35,6 +98,10 @@
 		remote = origin
 		merge = refs/heads/devel
 
+	# Proxy settings
+	[core]
+		gitProxy="ssh" for "ssh://kernel.org/"
+		gitProxy=default-proxy ; for the rest
 
 Variables
 ~~~~~~~~~
@@ -183,10 +250,15 @@
 	Use customized color for branch coloration. `<slot>` is one of
 	`current` (the current branch), `local` (a local branch),
 	`remote` (a tracking branch in refs/remotes/), `plain` (other
-	refs), or `reset` (the normal terminal color).  The value for
-	these configuration variables can be one of: `normal`, `bold`,
-	`dim`, `ul`, `blink`, `reverse`, `reset`, `black`, `red`,
-	`green`, `yellow`, `blue`, `magenta`, `cyan`, or `white`.
+	refs).
++
+The value for these configuration variables is a list of colors (at most
+two) and attributes (at most one), separated by spaces.  The colors
+accepted are `normal`, `black`, `red`, `green`, `yellow`, `blue`,
+`magenta`, `cyan` and `white`; the attributes are `bold`, `dim`, `ul`,
+`blink` and `reverse`.  The first color given is the foreground; the
+second is the background.  The position of the attribute, if any,
+doesn't matter.
 
 color.diff::
 	When true (or `always`), always use colors in patch.
@@ -194,12 +266,13 @@
 	colors only when the output is to the terminal.
 
 color.diff.<slot>::
-	Use customized color for diff colorization.  `<slot>`
-	specifies which part of the patch to use the specified
-	color, and is one of `plain` (context text), `meta`
-	(metainformation), `frag` (hunk header), `old` (removed
-	lines), or `new` (added lines).  The values of these
-	variables may be specified as in color.branch.<slot>.
+	Use customized color for diff colorization.  `<slot>` specifies
+	which part of the patch to use the specified color, and is one
+	of `plain` (context text), `meta` (metainformation), `frag`
+	(hunk header), `old` (removed lines), `new` (added lines),
+	`commit` (commit headers), or `whitespace` (highlighting dubious
+	whitespace).  The values of these variables may be specified as
+	in color.branch.<slot>.
 
 color.pager::
 	A boolean to enable/disable colored output when the pager is in
@@ -228,6 +301,16 @@
 	will enable basic rename detection.  If set to "copies" or
 	"copy", it will detect copies, as well.
 
+fetch.unpackLimit::
+	If the number of objects fetched over the git native
+	transfer is below this
+	limit, then the objects will be unpacked into loose object
+	files. However if the number of received objects equals or
+	exceeds this limit then the received pack will be stored as
+	a pack, after adding any missing delta bases.  Storing the
+	pack from a push can make the push operation complete faster,
+	especially on slow filesystems.
+
 format.headers::
 	Additional email headers to include in a patch to be submitted
 	by mail.  See gitlink:git-format-patch[1].
@@ -321,6 +404,13 @@
 	Whether to include summaries of merged commits in newly created
 	merge commit messages. False by default.
 
+merge.verbosity::
+	Controls the amount of output shown by the recursive merge
+	strategy.  Level 0 outputs nothing except a final error
+	message if conflicts were detected. Level 1 outputs only
+	conflicts, 2 outputs conflicts and file changes.  Level 5 and
+	above outputs debugging information.  The default is level 2.
+
 pack.window::
 	The size of the window used by gitlink:git-pack-objects[1] when no
 	window size is given on the command line. Defaults to 10.
@@ -344,6 +434,14 @@
 	The default set of "refspec" for gitlink:git-push[1]. See
 	gitlink:git-push[1].
 
+remote.<name>.receivepack::
+	The default program to execute on the remote side when pushing.  See
+	option \--exec of gitlink:git-push[1].
+
+remote.<name>.uploadpack::
+	The default program to execute on the remote side when fetching.  See
+	option \--exec of gitlink:git-fetch-pack[1].
+
 repack.usedeltabaseoffset::
 	Allow gitlink:git-repack[1] to create packs that uses
 	delta-base offset.  Defaults to false.
@@ -377,6 +475,13 @@
 	Can be overridden by the 'GIT_AUTHOR_NAME' and 'GIT_COMMITTER_NAME'
 	environment variables.  See gitlink:git-commit-tree[1].
 
+user.signingkey::
+	If gitlink:git-tag[1] is not selecting the key you want it to
+	automatically when creating a signed tag, you can override the
+	default selection with this variable.  This option is passed
+	unchanged to gpg's --local-user parameter, so you may specify a key
+	using any method that gpg supports.
+
 whatchanged.difftree::
 	The default gitlink:git-diff-tree[1] arguments to be used
 	for gitlink:git-whatchanged[1].
@@ -400,3 +505,8 @@
 	even if that push is forced. This configuration variable is
 	set when initializing a shared repository.
 
+transfer.unpackLimit::
+	When `fetch.unpackLimit` or `receive.unpackLimit` are
+	not set, the value of this variable is used instead.
+
+
diff --git a/Documentation/core-intro.txt b/Documentation/core-intro.txt
new file mode 100644
index 0000000..abafefc
--- /dev/null
+++ b/Documentation/core-intro.txt
@@ -0,0 +1,590 @@
+////////////////////////////////////////////////////////////////
+
+	GIT - the stupid content tracker
+
+////////////////////////////////////////////////////////////////
+
+"git" can mean anything, depending on your mood.
+
+ - random three-letter combination that is pronounceable, and not
+   actually used by any common UNIX command.  The fact that it is a
+   mispronunciation of "get" may or may not be relevant.
+ - stupid. contemptible and despicable. simple. Take your pick from the
+   dictionary of slang.
+ - "global information tracker": you're in a good mood, and it actually
+   works for you. Angels sing, and a light suddenly fills the room.
+ - "goddamn idiotic truckload of sh*t": when it breaks
+
+This is a (not so) stupid but extremely fast directory content manager.
+It doesn't do a whole lot at its core, but what it 'does' do is track
+directory contents efficiently.
+
+There are two object abstractions: the "object database", and the
+"current directory cache" aka "index".
+
+The Object Database
+~~~~~~~~~~~~~~~~~~~
+The object database is literally just a content-addressable collection
+of objects.  All objects are named by their content, which is
+approximated by the SHA1 hash of the object itself.  Objects may refer
+to other objects (by referencing their SHA1 hash), and so you can
+build up a hierarchy of objects.
+
+All objects have a statically determined "type" aka "tag", which is
+determined at object creation time, and which identifies the format of
+the object (i.e. how it is used, and how it can refer to other
+objects).  There are currently four different object types: "blob",
+"tree", "commit" and "tag".
+
+A "blob" object cannot refer to any other object, and is, like the type
+implies, a pure storage object containing some user data.  It is used to
+actually store the file data, i.e. a blob object is associated with some
+particular version of some file.
+
+A "tree" object is an object that ties one or more "blob" objects into a
+directory structure. In addition, a tree object can refer to other tree
+objects, thus creating a directory hierarchy.
+
+A "commit" object ties such directory hierarchies together into
+a DAG of revisions - each "commit" is associated with exactly one tree
+(the directory hierarchy at the time of the commit). In addition, a
+"commit" refers to one or more "parent" commit objects that describe the
+history of how we arrived at that directory hierarchy.
+
+As a special case, a commit object with no parents is called the "root"
+object, and is the point of an initial project commit.  Each project
+must have at least one root, and while you can tie several different
+root objects together into one project by creating a commit object which
+has two or more separate roots as its ultimate parents, that's probably
+just going to confuse people.  So aim for the notion of "one root object
+per project", even if git itself does not enforce that.
+
+A "tag" object symbolically identifies and can be used to sign other
+objects. It contains the identifier and type of another object, a
+symbolic name (of course!) and, optionally, a signature.
+
+Regardless of object type, all objects share the following
+characteristics: they are all deflated with zlib, and have a header
+that not only specifies their type, but also provides size information
+about the data in the object.  It's worth noting that the SHA1 hash
+that is used to name the object is the hash of the original data
+plus this header, so `sha1sum` 'file' does not match the object name
+for 'file'.
+(Historical note: in the dawn of the age of git the hash
+was the sha1 of the 'compressed' object.)
+
+As a result, the general consistency of an object can always be tested
+independently of the contents or the type of the object: all objects can
+be validated by verifying that (a) their hashes match the content of the
+file and (b) the object successfully inflates to a stream of bytes that
+forms a sequence of <ascii type without space> + <space> + <ascii decimal
+size> + <byte\0> + <binary object data>.
+
+The structured objects can further have their structure and
+connectivity to other objects verified. This is generally done with
+the `git-fsck` program, which generates a full dependency graph
+of all objects, and verifies their internal consistency (in addition
+to just verifying their superficial consistency through the hash).
+
+The object types in some more detail:
+
+Blob Object
+~~~~~~~~~~~
+A "blob" object is nothing but a binary blob of data, and doesn't
+refer to anything else.  There is no signature or any other
+verification of the data, so while the object is consistent (it 'is'
+indexed by its sha1 hash, so the data itself is certainly correct), it
+has absolutely no other attributes.  No name associations, no
+permissions.  It is purely a blob of data (i.e. normally "file
+contents").
+
+In particular, since the blob is entirely defined by its data, if two
+files in a directory tree (or in multiple different versions of the
+repository) have the same contents, they will share the same blob
+object. The object is totally independent of its location in the
+directory tree, and renaming a file does not change the object that
+file is associated with in any way.
+
+A blob is typically created when gitlink:git-update-index[1]
+is run, and its data can be accessed by gitlink:git-cat-file[1].
+
+Tree Object
+~~~~~~~~~~~
+The next hierarchical object type is the "tree" object.  A tree object
+is a list of mode/name/blob data, sorted by name.  Alternatively, the
+mode data may specify a directory mode, in which case instead of
+naming a blob, that name is associated with another TREE object.
+
+Like the "blob" object, a tree object is uniquely determined by the
+set contents, and so two separate but identical trees will always
+share the exact same object. This is true at all levels, i.e. it's
+true for a "leaf" tree (which does not refer to any other trees, only
+blobs) as well as for a whole subdirectory.
+
+For that reason a "tree" object is just a pure data abstraction: it
+has no history, no signatures, no verification of validity, except
+that since the contents are again protected by the hash itself, we can
+trust that the tree is immutable and its contents never change.
+
+So you can trust the contents of a tree to be valid, the same way you
+can trust the contents of a blob, but you don't know where those
+contents 'came' from.
+
+Side note on trees: since a "tree" object is a sorted list of
+"filename+content", you can create a diff between two trees without
+actually having to unpack two trees.  Just ignore all common parts,
+and your diff will look right.  In other words, you can effectively
+(and efficiently) tell the difference between any two random trees by
+O(n) where "n" is the size of the difference, rather than the size of
+the tree.
+
+Side note 2 on trees: since the name of a "blob" depends entirely and
+exclusively on its contents (i.e. there are no names or permissions
+involved), you can see trivial renames or permission changes by
+noticing that the blob stayed the same.  However, renames with data
+changes need a smarter "diff" implementation.
+
+A tree is created with gitlink:git-write-tree[1] and
+its data can be accessed by gitlink:git-ls-tree[1].
+Two trees can be compared with gitlink:git-diff-tree[1].
+
+Commit Object
+~~~~~~~~~~~~~
+The "commit" object is an object that introduces the notion of
+history into the picture.  In contrast to the other objects, it
+doesn't just describe the physical state of a tree, it describes how
+we got there, and why.
+
+A "commit" is defined by the tree-object that it results in, the
+parent commits (zero, one or more) that led up to that point, and a
+comment on what happened.  Again, a commit is not trusted per se:
+the contents are well-defined and "safe" due to the cryptographically
+strong signatures at all levels, but there is no reason to believe
+that the tree is "good" or that the merge information makes sense.
+The parents do not have to actually have any relationship with the
+result, for example.
+
+Note on commits: unlike real SCM's, commits do not contain
+rename information or file mode change information.  All of that is
+implicit in the trees involved (the result tree, and the result trees
+of the parents), and describing that makes no sense in this idiotic
+file manager.
+
+A commit is created with gitlink:git-commit-tree[1] and
+its data can be accessed by gitlink:git-cat-file[1].
+
+Trust
+~~~~~
+An aside on the notion of "trust". Trust is really outside the scope
+of "git", but it's worth noting a few things.  First off, since
+everything is hashed with SHA1, you 'can' trust that an object is
+intact and has not been messed with by external sources.  So the name
+of an object uniquely identifies a known state - just not a state that
+you may want to trust.
+
+Furthermore, since the SHA1 signature of a commit refers to the
+SHA1 signatures of the tree it is associated with and the signatures
+of the parent, a single named commit specifies uniquely a whole set
+of history, with full contents.  You can't later fake any step of the
+way once you have the name of a commit.
+
+So to introduce some real trust in the system, the only thing you need
+to do is to digitally sign just 'one' special note, which includes the
+name of a top-level commit.  Your digital signature shows others
+that you trust that commit, and the immutability of the history of
+commits tells others that they can trust the whole history.
+
+In other words, you can easily validate a whole archive by just
+sending out a single email that tells the people the name (SHA1 hash)
+of the top commit, and digitally sign that email using something
+like GPG/PGP.
+
+To assist in this, git also provides the tag object...
+
+Tag Object
+~~~~~~~~~~
+Git provides the "tag" object to simplify creating, managing and
+exchanging symbolic and signed tokens.  The "tag" object at its
+simplest simply symbolically identifies another object by containing
+the sha1, type and symbolic name.
+
+However it can optionally contain additional signature information
+(which git doesn't care about as long as there's less than 8k of
+it). This can then be verified externally to git.
+
+Note that despite the tag features, "git" itself only handles content
+integrity; the trust framework (and signature provision and
+verification) has to come from outside.
+
+A tag is created with gitlink:git-mktag[1],
+its data can be accessed by gitlink:git-cat-file[1],
+and the signature can be verified by
+gitlink:git-verify-tag[1].
+
+
+The "index" aka "Current Directory Cache"
+-----------------------------------------
+The index is a simple binary file, which contains an efficient
+representation of a virtual directory content at some random time.  It
+does so by a simple array that associates a set of names, dates,
+permissions and content (aka "blob") objects together.  The cache is
+always kept ordered by name, and names are unique (with a few very
+specific rules) at any point in time, but the cache has no long-term
+meaning, and can be partially updated at any time.
+
+In particular, the index certainly does not need to be consistent with
+the current directory contents (in fact, most operations will depend on
+different ways to make the index 'not' be consistent with the directory
+hierarchy), but it has three very important attributes:
+
+'(a) it can re-generate the full state it caches (not just the
+directory structure: it contains pointers to the "blob" objects so
+that it can regenerate the data too)'
+
+As a special case, there is a clear and unambiguous one-way mapping
+from a current directory cache to a "tree object", which can be
+efficiently created from just the current directory cache without
+actually looking at any other data.  So a directory cache at any one
+time uniquely specifies one and only one "tree" object (but has
+additional data to make it easy to match up that tree object with what
+has happened in the directory)
+
+'(b) it has efficient methods for finding inconsistencies between that
+cached state ("tree object waiting to be instantiated") and the
+current state.'
+
+'(c) it can additionally efficiently represent information about merge
+conflicts between different tree objects, allowing each pathname to be
+associated with sufficient information about the trees involved that
+you can create a three-way merge between them.'
+
+Those are the three ONLY things that the directory cache does.  It's a
+cache, and the normal operation is to re-generate it completely from a
+known tree object, or update/compare it with a live tree that is being
+developed.  If you blow the directory cache away entirely, you generally
+haven't lost any information as long as you have the name of the tree
+that it described.
+
+At the same time, the index is at the same time also the
+staging area for creating new trees, and creating a new tree always
+involves a controlled modification of the index file.  In particular,
+the index file can have the representation of an intermediate tree that
+has not yet been instantiated.  So the index can be thought of as a
+write-back cache, which can contain dirty information that has not yet
+been written back to the backing store.
+
+
+
+The Workflow
+------------
+Generally, all "git" operations work on the index file. Some operations
+work *purely* on the index file (showing the current state of the
+index), but most operations move data to and from the index file. Either
+from the database or from the working directory. Thus there are four
+main combinations:
+
+1) working directory -> index
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You update the index with information from the working directory with
+the gitlink:git-update-index[1] command.  You
+generally update the index information by just specifying the filename
+you want to update, like so:
+
+	git-update-index filename
+
+but to avoid common mistakes with filename globbing etc, the command
+will not normally add totally new entries or remove old entries,
+i.e. it will normally just update existing cache entries.
+
+To tell git that yes, you really do realize that certain files no
+longer exist, or that new files should be added, you
+should use the `--remove` and `--add` flags respectively.
+
+NOTE! A `--remove` flag does 'not' mean that subsequent filenames will
+necessarily be removed: if the files still exist in your directory
+structure, the index will be updated with their new status, not
+removed. The only thing `--remove` means is that update-cache will be
+considering a removed file to be a valid thing, and if the file really
+does not exist any more, it will update the index accordingly.
+
+As a special case, you can also do `git-update-index --refresh`, which
+will refresh the "stat" information of each index to match the current
+stat information. It will 'not' update the object status itself, and
+it will only update the fields that are used to quickly test whether
+an object still matches its old backing store object.
+
+2) index -> object database
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You write your current index file to a "tree" object with the program
+
+	git-write-tree
+
+that doesn't come with any options - it will just write out the
+current index into the set of tree objects that describe that state,
+and it will return the name of the resulting top-level tree. You can
+use that tree to re-generate the index at any time by going in the
+other direction:
+
+3) object database -> index
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You read a "tree" file from the object database, and use that to
+populate (and overwrite - don't do this if your index contains any
+unsaved state that you might want to restore later!) your current
+index.  Normal operation is just
+
+		git-read-tree <sha1 of tree>
+
+and your index file will now be equivalent to the tree that you saved
+earlier. However, that is only your 'index' file: your working
+directory contents have not been modified.
+
+4) index -> working directory
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You update your working directory from the index by "checking out"
+files. This is not a very common operation, since normally you'd just
+keep your files updated, and rather than write to your working
+directory, you'd tell the index files about the changes in your
+working directory (i.e. `git-update-index`).
+
+However, if you decide to jump to a new version, or check out somebody
+else's version, or just restore a previous tree, you'd populate your
+index file with read-tree, and then you need to check out the result
+with
+
+		git-checkout-index filename
+
+or, if you want to check out all of the index, use `-a`.
+
+NOTE! git-checkout-index normally refuses to overwrite old files, so
+if you have an old version of the tree already checked out, you will
+need to use the "-f" flag ('before' the "-a" flag or the filename) to
+'force' the checkout.
+
+
+Finally, there are a few odds and ends which are not purely moving
+from one representation to the other:
+
+5) Tying it all together
+~~~~~~~~~~~~~~~~~~~~~~~~
+To commit a tree you have instantiated with "git-write-tree", you'd
+create a "commit" object that refers to that tree and the history
+behind it - most notably the "parent" commits that preceded it in
+history.
+
+Normally a "commit" has one parent: the previous state of the tree
+before a certain change was made. However, sometimes it can have two
+or more parent commits, in which case we call it a "merge", due to the
+fact that such a commit brings together ("merges") two or more
+previous states represented by other commits.
+
+In other words, while a "tree" represents a particular directory state
+of a working directory, a "commit" represents that state in "time",
+and explains how we got there.
+
+You create a commit object by giving it the tree that describes the
+state at the time of the commit, and a list of parents:
+
+	git-commit-tree <tree> -p <parent> [-p <parent2> ..]
+
+and then giving the reason for the commit on stdin (either through
+redirection from a pipe or file, or by just typing it at the tty).
+
+git-commit-tree will return the name of the object that represents
+that commit, and you should save it away for later use. Normally,
+you'd commit a new `HEAD` state, and while git doesn't care where you
+save the note about that state, in practice we tend to just write the
+result to the file pointed at by `.git/HEAD`, so that we can always see
+what the last committed state was.
+
+Here is an ASCII art by Jon Loeliger that illustrates how
+various pieces fit together.
+
+------------
+
+                     commit-tree
+                      commit obj
+                       +----+
+                       |    |
+                       |    |
+                       V    V
+                    +-----------+
+                    | Object DB |
+                    |  Backing  |
+                    |   Store   |
+                    +-----------+
+                       ^
+           write-tree  |     |
+             tree obj  |     |
+                       |     |  read-tree
+                       |     |  tree obj
+                             V
+                    +-----------+
+                    |   Index   |
+                    |  "cache"  |
+                    +-----------+
+         update-index  ^
+             blob obj  |     |
+                       |     |
+    checkout-index -u  |     |  checkout-index
+             stat      |     |  blob obj
+                             V
+                    +-----------+
+                    |  Working  |
+                    | Directory |
+                    +-----------+
+
+------------
+
+
+6) Examining the data
+~~~~~~~~~~~~~~~~~~~~~
+
+You can examine the data represented in the object database and the
+index with various helper tools. For every object, you can use
+gitlink:git-cat-file[1] to examine details about the
+object:
+
+		git-cat-file -t <objectname>
+
+shows the type of the object, and once you have the type (which is
+usually implicit in where you find the object), you can use
+
+		git-cat-file blob|tree|commit|tag <objectname>
+
+to show its contents. NOTE! Trees have binary content, and as a result
+there is a special helper for showing that content, called
+`git-ls-tree`, which turns the binary content into a more easily
+readable form.
+
+It's especially instructive to look at "commit" objects, since those
+tend to be small and fairly self-explanatory. In particular, if you
+follow the convention of having the top commit name in `.git/HEAD`,
+you can do
+
+		git-cat-file commit HEAD
+
+to see what the top commit was.
+
+7) Merging multiple trees
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Git helps you do a three-way merge, which you can expand to n-way by
+repeating the merge procedure arbitrary times until you finally
+"commit" the state.  The normal situation is that you'd only do one
+three-way merge (two parents), and commit it, but if you like to, you
+can do multiple parents in one go.
+
+To do a three-way merge, you need the two sets of "commit" objects
+that you want to merge, use those to find the closest common parent (a
+third "commit" object), and then use those commit objects to find the
+state of the directory ("tree" object) at these points.
+
+To get the "base" for the merge, you first look up the common parent
+of two commits with
+
+		git-merge-base <commit1> <commit2>
+
+which will return you the commit they are both based on.  You should
+now look up the "tree" objects of those commits, which you can easily
+do with (for example)
+
+		git-cat-file commit <commitname> | head -1
+
+since the tree object information is always the first line in a commit
+object.
+
+Once you know the three trees you are going to merge (the one
+"original" tree, aka the common case, and the two "result" trees, aka
+the branches you want to merge), you do a "merge" read into the
+index. This will complain if it has to throw away your old index contents, so you should
+make sure that you've committed those - in fact you would normally
+always do a merge against your last commit (which should thus match
+what you have in your current index anyway).
+
+To do the merge, do
+
+		git-read-tree -m -u <origtree> <yourtree> <targettree>
+
+which will do all trivial merge operations for you directly in the
+index file, and you can just write the result out with
+`git-write-tree`.
+
+Historical note.  We did not have `-u` facility when this
+section was first written, so we used to warn that
+the merge is done in the index file, not in your
+working tree, and your working tree will not match your
+index after this step.
+This is no longer true.  The above command, thanks to `-u`
+option, updates your working tree with the merge results for
+paths that have been trivially merged.
+
+
+8) Merging multiple trees, continued
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sadly, many merges aren't trivial. If there are files that have
+been added.moved or removed, or if both branches have modified the
+same file, you will be left with an index tree that contains "merge
+entries" in it. Such an index tree can 'NOT' be written out to a tree
+object, and you will have to resolve any such merge clashes using
+other tools before you can write out the result.
+
+You can examine such index state with `git-ls-files --unmerged`
+command.  An example:
+
+------------------------------------------------
+$ git-read-tree -m $orig HEAD $target
+$ git-ls-files --unmerged
+100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1	hello.c
+100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2	hello.c
+100644 cc44c73eb783565da5831b4d820c962954019b69 3	hello.c
+------------------------------------------------
+
+Each line of the `git-ls-files --unmerged` output begins with
+the blob mode bits, blob SHA1, 'stage number', and the
+filename.  The 'stage number' is git's way to say which tree it
+came from: stage 1 corresponds to `$orig` tree, stage 2 `HEAD`
+tree, and stage3 `$target` tree.
+
+Earlier we said that trivial merges are done inside
+`git-read-tree -m`.  For example, if the file did not change
+from `$orig` to `HEAD` nor `$target`, or if the file changed
+from `$orig` to `HEAD` and `$orig` to `$target` the same way,
+obviously the final outcome is what is in `HEAD`.  What the
+above example shows is that file `hello.c` was changed from
+`$orig` to `HEAD` and `$orig` to `$target` in a different way.
+You could resolve this by running your favorite 3-way merge
+program, e.g.  `diff3` or `merge`, on the blob objects from
+these three stages yourself, like this:
+
+------------------------------------------------
+$ git-cat-file blob 263414f... >hello.c~1
+$ git-cat-file blob 06fa6a2... >hello.c~2
+$ git-cat-file blob cc44c73... >hello.c~3
+$ merge hello.c~2 hello.c~1 hello.c~3
+------------------------------------------------
+
+This would leave the merge result in `hello.c~2` file, along
+with conflict markers if there are conflicts.  After verifying
+the merge result makes sense, you can tell git what the final
+merge result for this file is by:
+
+	mv -f hello.c~2 hello.c
+	git-update-index hello.c
+
+When a path is in unmerged state, running `git-update-index` for
+that path tells git to mark the path resolved.
+
+The above is the description of a git merge at the lowest level,
+to help you understand what conceptually happens under the hood.
+In practice, nobody, not even git itself, uses three `git-cat-file`
+for this.  There is `git-merge-index` program that extracts the
+stages to temporary files and calls a "merge" script on it:
+
+	git-merge-index git-merge-one-file hello.c
+
+and that is what higher level `git resolve` is implemented with.
diff --git a/Documentation/core-tutorial.txt b/Documentation/core-tutorial.txt
index 0cd33fb..86a9c75 100644
--- a/Documentation/core-tutorial.txt
+++ b/Documentation/core-tutorial.txt
@@ -906,18 +906,13 @@
 file, which had no differences in the `mybranch` branch), and say:
 
 ----------------
-	Trying really trivial in-index merge...
-	fatal: Merge requires file-level merging
-	Nope.
-	...
 	Auto-merging hello 
 	CONFLICT (content): Merge conflict in hello 
 	Automatic merge failed; fix up by hand
 ----------------
 
-which is way too verbose, but it basically tells you that it failed the
-really trivial merge ("Simple merge") and did an "Automatic merge"
-instead, but that too failed due to conflicts in `hello`.
+It tells you that it did an "Automatic merge", which
+failed due to conflicts in `hello`.
 
 Not to worry. It left the (trivial) conflict in `hello` in the same form you
 should already be well used to if you've ever used CVS, so let's just
@@ -1129,46 +1124,26 @@
 course, you will pay the price of more disk usage to hold
 multiple working trees, but disk space is cheap these days.
 
-[NOTE]
-You could even pull from your own repository by
-giving '.' as <remote-repository> parameter to `git pull`.  This
-is useful when you want to merge a local branch (or more, if you
-are making an Octopus) into the current branch.
-
 It is likely that you will be pulling from the same remote
 repository from time to time. As a short hand, you can store
-the remote repository URL in a file under .git/remotes/
-directory, like this:
+the remote repository URL in the local repository's config file
+like this:
 
 ------------------------------------------------
-$ mkdir -p .git/remotes/
-$ cat >.git/remotes/linus <<\EOF
-URL: http://www.kernel.org/pub/scm/git/git.git/
-EOF
+$ git config remote.linus.url http://www.kernel.org/pub/scm/git/git.git/
 ------------------------------------------------
 
-and use the filename to `git pull` instead of the full URL.
-The URL specified in such file can even be a prefix
-of a full URL, like this:
-
-------------------------------------------------
-$ cat >.git/remotes/jgarzik <<\EOF
-URL: http://www.kernel.org/pub/scm/linux/git/jgarzik/
-EOF
-------------------------------------------------
-
+and use the "linus" keyword with `git pull` instead of the full URL.
 
 Examples.
 
 . `git pull linus`
 . `git pull linus tag v0.99.1`
-. `git pull jgarzik/netdev-2.6.git/ e100`
 
 the above are equivalent to:
 
 . `git pull http://www.kernel.org/pub/scm/git/git.git/ HEAD`
 . `git pull http://www.kernel.org/pub/scm/git/git.git/ tag v0.99.1`
-. `git pull http://www.kernel.org/pub/.../jgarzik/netdev-2.6.git e100`
 
 
 How does the merge work?
@@ -1546,7 +1521,8 @@
 
 1. Prepare your work repository, by `git clone` the public
    repository of the "project lead". The URL used for the
-   initial cloning is stored in `.git/remotes/origin`.
+   initial cloning is stored in the remote.origin.url
+   configuration variable.
 
 2. Prepare a public repository accessible to others, just like
    the "project lead" person does.
@@ -1586,14 +1562,15 @@
 1. Prepare your work repository, by `git clone` the public
    repository of the "project lead" (or a "subsystem
    maintainer", if you work on a subsystem). The URL used for
-   the initial cloning is stored in `.git/remotes/origin`.
+   the initial cloning is stored in the remote.origin.url
+   configuration variable.
 
 2. Do your work in your repository on 'master' branch.
 
 3. Run `git fetch origin` from the public repository of your
    upstream every once in a while. This does only the first
    half of `git pull` but does not merge. The head of the
-   public repository is stored in `.git/refs/heads/origin`.
+   public repository is stored in `.git/refs/remotes/origin/master`.
 
 4. Use `git cherry origin` to see which ones of your patches
    were accepted, and/or use `git rebase origin` to port your
@@ -1681,11 +1658,11 @@
 
 You can make sure 'git show-branch' matches the state before
 those two 'git merge' you just did.  Then, instead of running
-two 'git merge' commands in a row, you would pull these two
+two 'git merge' commands in a row, you would merge these two
 branch heads (this is known as 'making an Octopus'):
 
 ------------
-$ git pull . commit-fix diff-fix
+$ git merge commit-fix diff-fix
 $ git show-branch
 ! [commit-fix] Fix commit message normalization.
  ! [diff-fix] Fix rename detection.
@@ -1701,7 +1678,7 @@
 
 Note that you should not do Octopus because you can.  An octopus
 is a valid thing to do and often makes it easier to view the
-commit history if you are pulling more than two independent
+commit history if you are merging more than two independent
 changes at the same time.  However, if you have merge conflicts
 with any of the branches you are merging in and need to hand
 resolve, that is an indication that the development happened in
diff --git a/Documentation/cvs-migration.txt b/Documentation/cvs-migration.txt
index 775bf42..764cc56 100644
--- a/Documentation/cvs-migration.txt
+++ b/Documentation/cvs-migration.txt
@@ -36,7 +36,7 @@
 ================================
 The `pull` command knows where to get updates from because of certain
 configuration variables that were set by the first `git clone`
-command; see `git repo-config -l` and the gitlink:git-repo-config[1] man
+command; see `git config -l` and the gitlink:git-config[1] man
 page for details.
 ================================
 
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index da1cc60..019a39f 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -58,6 +58,10 @@
 	Turn off rename detection, even when the configuration
 	file gives the default to do so.
 
+--check::
+	Warn if changes introduce trailing whitespace
+	or an indent that uses a space before a tab.
+
 --full-index::
 	Instead of the first handful characters, show full
 	object name of pre- and post-image blob on the "index"
diff --git a/Documentation/everyday.txt b/Documentation/everyday.txt
index 4e83994..08c61b1 100644
--- a/Documentation/everyday.txt
+++ b/Documentation/everyday.txt
@@ -28,7 +28,7 @@
   * gitlink:git-init[1] or gitlink:git-clone[1] to create a
     new repository.
 
-  * gitlink:git-fsck-objects[1] to check the repository for errors.
+  * gitlink:git-fsck[1] to check the repository for errors.
 
   * gitlink:git-prune[1] to remove unused objects in the repository.
 
@@ -43,7 +43,7 @@
 Check health and remove cruft.::
 +
 ------------
-$ git fsck-objects <1>
+$ git fsck <1>
 $ git count-objects <2>
 $ git repack <3>
 $ git gc <4>
@@ -148,8 +148,7 @@
 <8> redo the commit undone in the previous step, using the message
 you originally wrote.
 <9> switch to the master branch.
-<10> merge a topic branch into your master branch.  You can also use
-`git pull . alsa-audio`, i.e. pull from the local repository.
+<10> merge a topic branch into your master branch.
 <11> review commit logs; other forms to limit output can be
 combined and include `\--max-count=10` (show 10 commits),
 `\--until=2005-12-10`, etc.
@@ -213,12 +212,12 @@
 ------------
 satellite$ git clone mothership:frotz frotz <1>
 satellite$ cd frotz
-satellite$ git repo-config --get-regexp '^(remote|branch)\.' <2>
+satellite$ git config --get-regexp '^(remote|branch)\.' <2>
 remote.origin.url mothership:frotz
 remote.origin.fetch refs/heads/*:refs/remotes/origin/*
 branch.master.remote origin
 branch.master.merge refs/heads/master
-satellite$ git repo-config remote.origin.push \
+satellite$ git config remote.origin.push \
            master:refs/remotes/satellite/master <3>
 satellite$ edit/compile/test/commit
 satellite$ git push origin <4>
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index 95bea66..b73a99d 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -7,7 +7,7 @@
 
 SYNOPSIS
 --------
-'git-add' [-n] [-v] [-f] [--interactive] [--] <file>...
+'git-add' [-n] [-v] [-f] [--interactive | -i] [--] <file>...
 
 DESCRIPTION
 -----------
@@ -52,7 +52,7 @@
 -f::
 	Allow adding otherwise ignored files.
 
-\--interactive::
+\i, \--interactive::
 	Add modified contents in the working tree interactively to
 	the index.
 
@@ -83,7 +83,7 @@
 Interactive mode
 ----------------
 When the command enters the interactive mode, it shows the
-output of the 'status' subcommand, and then goes into ints
+output of the 'status' subcommand, and then goes into its
 interactive command loop.
 
 The command loop shows the list of subcommands available, and
diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index 53e81cb..aa4ce1d 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-am - Apply a series of patches in a mailbox
+git-am - Apply a series of patches from a mailbox
 
 
 SYNOPSIS
diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
index 33b93db..065ba1b 100644
--- a/Documentation/git-apply.txt
+++ b/Documentation/git-apply.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-apply - Apply patch on a git index file and a work tree
+git-apply - Apply a patch on a git index file and a working tree
 
 
 SYNOPSIS
diff --git a/Documentation/git-applypatch.txt b/Documentation/git-applypatch.txt
index 2b1ff14..451434a 100644
--- a/Documentation/git-applypatch.txt
+++ b/Documentation/git-applypatch.txt
@@ -12,6 +12,9 @@
 
 DESCRIPTION
 -----------
+This is usually not what an end user wants to run directly.  See
+gitlink:git-am[1] instead.
+
 Takes three files <msg>, <patch>, and <info> prepared from an
 e-mail message by 'git-mailinfo', and creates a commit.  It is
 usually not necessary to use this command directly.
diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
index 031fcd5..493474b 100644
--- a/Documentation/git-archive.txt
+++ b/Documentation/git-archive.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-archive - Creates a archive of the files in the named tree
+git-archive - Creates an archive of files from a named tree
 
 
 SYNOPSIS
diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
index ac4b496..16ec726 100644
--- a/Documentation/git-bisect.txt
+++ b/Documentation/git-bisect.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-bisect - Find the change that introduced a bug
+git-bisect - Find the change that introduced a bug by binary search
 
 
 SYNOPSIS
diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
index bdfc666..0ee887d 100644
--- a/Documentation/git-blame.txt
+++ b/Documentation/git-blame.txt
@@ -8,7 +8,7 @@
 SYNOPSIS
 --------
 [verse]
-'git-blame' [-c] [-l] [-t] [-f] [-n] [-p] [-L n,m] [-S <revs-file>]
+'git-blame' [-c] [-l] [-t] [-f] [-n] [-p] [--incremental] [-L n,m] [-S <revs-file>]
             [-M] [-C] [-C] [--since=<date>] [<rev>] [--] <file>
 
 DESCRIPTION
@@ -24,7 +24,7 @@
 interface briefly mentioned in the following paragraph.
 
 Apart from supporting file annotation, git also supports searching the
-development history for when a code snippet occured in a change. This makes it
+development history for when a code snippet occurred in a change. This makes it
 possible to track when a code snippet was added to a file, moved or copied
 between files, and eventually deleted or replaced. It works by searching for
 a text string in the diff. A small example:
@@ -63,6 +63,10 @@
 -p, --porcelain::
 	Show in a format designed for machine consumption.
 
+--incremental::
+	Show the result incrementally in a format designed for
+	machine consumption.
+
 -M::
 	Detect moving lines in the file as well.  When a commit
 	moves a block of lines in a file (e.g. the original file
@@ -89,7 +93,7 @@
 --------------------
 
 In this format, each line is output after a header; the
-header at the minumum has the first line which has:
+header at the minimum has the first line which has:
 
 - 40-byte SHA-1 of the commit the line is attributed to;
 - the line number of the line in the original file;
@@ -112,15 +116,18 @@
 header elements later.
 
 
-SPECIFIYING RANGES
-------------------
+SPECIFYING RANGES
+-----------------
 
 Unlike `git-blame` and `git-annotate` in older git, the extent
 of annotation can be limited to both line ranges and revision
 ranges.  When you are interested in finding the origin for
-ll. 40-60 for file `foo`, you can use `-L` option like this:
+ll. 40-60 for file `foo`, you can use `-L` option like these
+(they mean the same thing -- both ask for 21 lines starting at
+line 40):
 
 	git blame -L 40,60 foo
+	git blame -L 40,+21 foo
 
 Also you can use regular expression to specify the line range.
 
@@ -155,6 +162,47 @@
 	git blame -C -C -f $commit^! -- foo
 
 
+INCREMENTAL OUTPUT
+------------------
+
+When called with `--incremental` option, the command outputs the
+result as it is built.  The output generally will talk about
+lines touched by more recent commits first (i.e. the lines will
+be annotated out of order) and is meant to be used by
+interactive viewers.
+
+The output format is similar to the Porcelain format, but it
+does not contain the actual lines from the file that is being
+annotated.
+
+. Each blame entry always starts with a line of:
+
+	<40-byte hex sha1> <sourceline> <resultline> <num_lines>
++
+Line numbers count from 1.
+
+. The first time that commit shows up in the stream, it has various
+  other information about it printed out with a one-word tag at the
+  beginning of each line about that "extended commit info" (author,
+  email, committer, dates, summary etc).
+
+. Unlike Porcelain format, the filename information is always
+  given and terminates the entry:
+
+	"filename" <whitespace-quoted-filename-goes-here>
++
+and thus it's really quite easy to parse for some line- and word-oriented
+parser (which should be quite natural for most scripting languages).
++
+[NOTE]
+For people who do parsing: to make it more robust, just ignore any
+lines in between the first and last one ("<sha1>" and "filename" lines)
+where you don't recognize the tag-words (or care about that particular
+one) at the beginning of the "extended information" lines. That way, if
+there is ever added information (like the commit encoding or extended
+commit commentary), a blame viewer won't ever care.
+
+
 SEE ALSO
 --------
 gitlink:git-annotate[1]
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index e872fc8..aa1fdd4 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-branch - List, create, or delete branches.
+git-branch - List, create, or delete branches
 
 SYNOPSIS
 --------
@@ -74,7 +74,7 @@
 	List both remote-tracking branches and local branches.
 
 -v::
-	Show sha1 and commit subjectline for each head.
+	Show sha1 and commit subject line for each head.
 
 --abbrev=<length>::
 	Alter minimum display length for sha1 in output listing,
diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
index 5e9cbf8..075c0d0 100644
--- a/Documentation/git-cat-file.txt
+++ b/Documentation/git-cat-file.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-cat-file - Provide content or type information for repository objects
+git-cat-file - Provide content or type/size information for repository objects
 
 
 SYNOPSIS
@@ -19,7 +19,9 @@
 OPTIONS
 -------
 <object>::
-	The sha1 identifier of the object.
+	The name of the object to show.
+	For a more complete list of ways to spell object names, see
+	"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
 
 -t::
 	Instead of the content, show the object type identified by
diff --git a/Documentation/git-checkout-index.txt b/Documentation/git-checkout-index.txt
index 765c173..6dd6db0 100644
--- a/Documentation/git-checkout-index.txt
+++ b/Documentation/git-checkout-index.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-checkout-index - Copy files from the index to the working directory
+git-checkout-index - Copy files from the index to the working tree
 
 
 SYNOPSIS
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index fbdbadc..4ea2b31 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -9,7 +9,7 @@
 --------
 [verse]
 'git-checkout' [-f] [-b <new_branch> [-l]] [-m] [<branch>]
-'git-checkout' [-m] [<branch>] <paths>...
+'git-checkout' [<tree-ish>] <paths>...
 
 DESCRIPTION
 -----------
@@ -22,11 +22,13 @@
 
 When <paths> are given, this command does *not* switch
 branches.  It updates the named paths in the working tree from
-the index file (i.e. it runs `git-checkout-index -f -u`).  In
+the index file (i.e. it runs `git-checkout-index -f -u`), or a
+named commit.  In
 this case, `-f` and `-b` options are meaningless and giving
-either of them results in an error.  <branch> argument can be
-used to specify a specific tree-ish to update the index for the
-given paths before updating the working tree.
+either of them results in an error.  <tree-ish> argument can be
+used to specify a specific tree-ish (i.e. commit, tag or tree)
+to update the index for the given paths before updating the
+working tree.
 
 
 OPTIONS
@@ -63,7 +65,57 @@
 
 <branch>::
 	Branch to checkout; may be any object ID that resolves to a
-	commit. Defaults to HEAD.
+	commit.  Defaults to HEAD.
++
+When this parameter names a non-branch (but still a valid commit object),
+your HEAD becomes 'detached'.
+
+
+Detached HEAD
+-------------
+
+It is sometimes useful to be able to 'checkout' a commit that is
+not at the tip of one of your branches.  The most obvious
+example is to check out the commit at a tagged official release
+point, like this:
+
+------------
+$ git checkout v2.6.18
+------------
+
+Earlier versions of git did not allow this and asked you to
+create a temporary branch using `-b` option, but starting from
+version 1.5.0, the above command 'detaches' your HEAD from the
+current branch and directly point at the commit named by the tag
+(`v2.6.18` in the above example).
+
+You can use usual git commands while in this state.  You can use
+`git-reset --hard $othercommit` to further move around, for
+example.  You can make changes and create a new commit on top of
+a detached HEAD.  You can even create a merge by using `git
+merge $othercommit`.
+
+The state you are in while your HEAD is detached is not recorded
+by any branch (which is natural --- you are not on any branch).
+What this means is that you can discard your temporary commits
+and merges by switching back to an existing branch (e.g. `git
+checkout master`), and a later `git prune` or `git gc` would
+garbage-collect them.
+
+The command would refuse to switch back to make sure that you do
+not discard your temporary state by mistake when your detached
+HEAD is not pointed at by any existing ref.  If you did want to
+save your state (e.g. "I was interested in the fifth commit from
+the top of 'master' branch", or "I made two commits to fix minor
+bugs while on a detached HEAD" -- and if you do not want to lose
+these facts), you can create a new branch and switch to it with
+`git checkout -b newbranch` so that you can keep building on
+that state, or tag it first so that you can come back to it
+later and switch to the branch you wanted to switch to with `git
+tag that_state; git checkout master`.  On the other hand, if you
+did want to discard the temporary state, you can give `-f`
+option (e.g. `git checkout -f master`) to override this
+behaviour.
 
 
 EXAMPLES
diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index 875edb6..3149d08 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -19,6 +19,8 @@
 -------
 <commit>::
 	Commit to cherry-pick.
+	For a more complete list of ways to spell commits, see
+	"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
 
 -e|--edit::
 	With this option, `git-cherry-pick` will let you edit the commit
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index a782074..707376f 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-clone - Clones a repository
+git-clone - Clones a repository into a new directory
 
 
 SYNOPSIS
diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt
index 77ba96e..cf25507 100644
--- a/Documentation/git-commit-tree.txt
+++ b/Documentation/git-commit-tree.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-commit-tree - Creates a new commit object
+git-commit-tree - Create a new commit object
 
 
 SYNOPSIS
@@ -12,6 +12,9 @@
 
 DESCRIPTION
 -----------
+This is usually not what an end user wants to run directly.  See
+gitlink:git-commit[1] instead.
+
 Creates a new commit object based on the provided tree object and
 emits the new commit object id on stdout. If no parent is given then
 it is considered to be an initial tree.
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index b4528d7..2187eee 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -3,13 +3,13 @@
 
 NAME
 ----
-git-commit - Record your changes
+git-commit - Record changes to the repository
 
 SYNOPSIS
 --------
 [verse]
-'git-commit' [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg>]
-	   [--no-verify] [--amend] [-e] [--author <author>]
+'git-commit' [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg> |
+	    --amend] [--no-verify] [-e] [--author <author>]
 	   [--] [[-i | -o ]<file>...]
 
 DESCRIPTION
@@ -111,7 +111,7 @@
 	are concluding a conflicted merge.
 
 -q|--quiet::
-	Supress commit summary message.
+	Suppress commit summary message.
 
 \--::
 	Do not interpret any more arguments as options.
@@ -142,11 +142,6 @@
 $ git commit
 ------------
 
-////////////
-We should fix 'git rm' to remove goodbye.c from both index and
-working tree for the above example.
-////////////
-
 Instead of staging files after each individual change, you can
 tell `git commit` to notice the changes to the files whose
 contents are tracked in
@@ -223,6 +218,12 @@
 DISCUSSION
 ----------
 
+Though not required, it's a good idea to begin the commit message
+with a single short (less than 50 character) line summarizing the
+change, followed by a blank line and then a more thorough description.
+Tools that turn commits into email, for example, use the first line
+on the Subject: line and the rest of the commit in the body.
+
 include::i18n.txt[]
 
 ENVIRONMENT VARIABLES
diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt
new file mode 100644
index 0000000..6624484
--- /dev/null
+++ b/Documentation/git-config.txt
@@ -0,0 +1,227 @@
+git-config(1)
+=============
+
+NAME
+----
+git-config - Get and set repository or global options
+
+
+SYNOPSIS
+--------
+[verse]
+'git-config' [--global] [type] name [value [value_regex]]
+'git-config' [--global] [type] --add name value
+'git-config' [--global] [type] --replace-all name [value [value_regex]]
+'git-config' [--global] [type] --get name [value_regex]
+'git-config' [--global] [type] --get-all name [value_regex]
+'git-config' [--global] [type] --unset name [value_regex]
+'git-config' [--global] [type] --unset-all name [value_regex]
+'git-config' [--global] -l | --list
+
+DESCRIPTION
+-----------
+You can query/set/replace/unset options with this command. The name is
+actually the section and the key separated by a dot, and the value will be
+escaped.
+
+Multiple lines can be added to an option by using the '--add' option.
+If you want to update or unset an option which can occur on multiple
+lines, a POSIX regexp `value_regex` needs to be given.  Only the
+existing values that match the regexp are updated or unset.  If
+you want to handle the lines that do *not* match the regex, just
+prepend a single exclamation mark in front (see EXAMPLES).
+
+The type specifier can be either '--int' or '--bool', which will make
+'git-config' ensure that the variable(s) are of the given type and
+convert the value to the canonical form (simple decimal number for int,
+a "true" or "false" string for bool). If no type specifier is passed,
+no checks or transformations are performed on the value.
+
+This command will fail if:
+
+. The .git/config file is invalid,
+. Can not write to .git/config,
+. no section was provided,
+. the section or key is invalid,
+. you try to unset an option which does not exist,
+. you try to unset/set an option for which multiple lines match, or
+. you use --global option without $HOME being properly set.
+
+
+OPTIONS
+-------
+
+--replace-all::
+	Default behavior is to replace at most one line. This replaces
+	all lines matching the key (and optionally the value_regex).
+
+--add::
+	Adds a new line to the option without altering any existing
+	values.  This is the same as providing '^$' as the value_regex.
+
+--get::
+	Get the value for a given key (optionally filtered by a regex
+	matching the value). Returns error code 1 if the key was not
+	found and error code 2 if multiple key values were found.
+
+--get-all::
+	Like get, but does not fail if the number of values for the key
+	is not exactly one.
+
+--get-regexp::
+	Like --get-all, but interprets the name as a regular expression.
+
+--global::
+	Use global ~/.gitconfig file rather than the repository .git/config.
+
+--unset::
+	Remove the line matching the key from config file.
+
+--unset-all::
+	Remove all matching lines from config file.
+
+-l, --list::
+	List all variables set in config file.
+
+--bool::
+	git-config will ensure that the output is "true" or "false"
+
+--int::
+	git-config will ensure that the output is a simple
+	decimal number.  An optional value suffix of 'k', 'm', or 'g'
+	in the config file will cause the value to be multiplied
+	by 1024, 1048576, or 1073741824 prior to output.
+
+
+ENVIRONMENT
+-----------
+
+GIT_CONFIG::
+	Take the configuration from the given file instead of .git/config.
+	Using the "--global" option forces this to ~/.gitconfig.
+
+GIT_CONFIG_LOCAL::
+	Currently the same as $GIT_CONFIG; when Git will support global
+	configuration files, this will cause it to take the configuration
+	from the global configuration file in addition to the given file.
+
+
+EXAMPLE
+-------
+
+Given a .git/config like this:
+
+	#
+	# This is the config file, and
+	# a '#' or ';' character indicates
+	# a comment
+	#
+
+	; core variables
+	[core]
+		; Don't trust file modes
+		filemode = false
+
+	; Our diff algorithm
+	[diff]
+		external = "/usr/local/bin/gnu-diff -u"
+		renames = true
+
+	; Proxy settings
+	[core]
+		gitproxy="ssh" for "ssh://kernel.org/"
+		gitproxy="proxy-command" for kernel.org
+		gitproxy="myprotocol-command" for "my://"
+		gitproxy=default-proxy ; for all the rest
+
+you can set the filemode to true with
+
+------------
+% git config core.filemode true
+------------
+
+The hypothetical proxy command entries actually have a postfix to discern
+what URL they apply to. Here is how to change the entry for kernel.org
+to "ssh".
+
+------------
+% git config core.gitproxy '"ssh" for kernel.org' 'for kernel.org$'
+------------
+
+This makes sure that only the key/value pair for kernel.org is replaced.
+
+To delete the entry for renames, do
+
+------------
+% git config --unset diff.renames
+------------
+
+If you want to delete an entry for a multivar (like core.gitproxy above),
+you have to provide a regex matching the value of exactly one line.
+
+To query the value for a given key, do
+
+------------
+% git config --get core.filemode
+------------
+
+or
+
+------------
+% git config core.filemode
+------------
+
+or, to query a multivar:
+
+------------
+% git config --get core.gitproxy "for kernel.org$"
+------------
+
+If you want to know all the values for a multivar, do:
+
+------------
+% git config --get-all core.gitproxy
+------------
+
+If you like to live dangerous, you can replace *all* core.gitproxy by a
+new one with
+
+------------
+% git config --replace-all core.gitproxy ssh
+------------
+
+However, if you really only want to replace the line for the default proxy,
+i.e. the one without a "for ..." postfix, do something like this:
+
+------------
+% git config core.gitproxy ssh '! for '
+------------
+
+To actually match only values with an exclamation mark, you have to
+
+------------
+% git config section.key value '[!]'
+------------
+
+To add a new proxy, without altering any of the existing ones, use
+
+------------
+% git config core.gitproxy '"proxy" for example.com'
+------------
+
+
+include::config.txt[]
+
+
+Author
+------
+Written by Johannes Schindelin <Johannes.Schindelin@gmx.de>
+
+Documentation
+--------------
+Documentation by Johannes Schindelin, Petr Baudis and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
diff --git a/Documentation/git-count-objects.txt b/Documentation/git-count-objects.txt
index c59df64..91c8c92 100644
--- a/Documentation/git-count-objects.txt
+++ b/Documentation/git-count-objects.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-count-objects - Reports on unpacked objects
+git-count-objects - Count unpacked number of objects and their disk consumption
 
 SYNOPSIS
 --------
diff --git a/Documentation/git-cvsexportcommit.txt b/Documentation/git-cvsexportcommit.txt
index 092d0d6..347cbce 100644
--- a/Documentation/git-cvsexportcommit.txt
+++ b/Documentation/git-cvsexportcommit.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-cvsexportcommit - Export a commit to a CVS checkout
+git-cvsexportcommit - Export a single commit to a CVS checkout
 
 
 SYNOPSIS
diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt
index 5c402de..f5450de 100644
--- a/Documentation/git-cvsimport.txt
+++ b/Documentation/git-cvsimport.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-cvsimport - Import a CVS repository into git
+git-cvsimport - Salvage your data out of another SCM people love to hate
 
 
 SYNOPSIS
@@ -97,7 +97,7 @@
 	Substitute the character "/" in branch names with <subst>
 
 -A <author-conv-file>::
-	CVS by default uses the unix username when writing its
+	CVS by default uses the Unix username when writing its
 	commit logs. Using this option and an author-conv-file
 	in this format
 
diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
index 993adc7..9ddab71 100644
--- a/Documentation/git-daemon.txt
+++ b/Documentation/git-daemon.txt
@@ -131,14 +131,14 @@
 the facility of inet daemon to achieve the same before spawning
 `git-daemon` if needed.
 
---enable-service, --disable-service::
+--enable=service, --disable=service::
 	Enable/disable the service site-wide per default.  Note
 	that a service disabled site-wide can still be enabled
 	per repository if it is marked overridable and the
 	repository enables the service with an configuration
 	item.
 
---allow-override, --forbid-override::
+--allow-override=service, --forbid-override=service::
 	Allow/forbid overriding the site-wide default with per
 	repository configuration.  By default, all the services
 	are overridable.
diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt
index 2700f35..47a583d 100644
--- a/Documentation/git-describe.txt
+++ b/Documentation/git-describe.txt
@@ -14,8 +14,8 @@
 -----------
 The command finds the most recent tag that is reachable from a
 commit, and if the commit itself is pointed at by the tag, shows
-the tag.  Otherwise, it suffixes the tag name with abbreviated
-object name of the commit.
+the tag.  Otherwise, it suffixes the tag name with the number of
+additional commits and the abbreviated object name of the commit.
 
 
 OPTIONS
@@ -35,6 +35,16 @@
 	Instead of using the default 8 hexadecimal digits as the
 	abbreviated object name, use <n> digits.
 
+--candidates=<n>::
+	Instead of considering only the 10 most recent tags as
+	candidates to describe the input committish consider
+	up to <n> candidates.  Increasing <n> above 10 will take
+	slightly longer but may produce a more accurate result.
+
+--debug::
+	Verbosely display information about the searching strategy
+	being employed to standard error.  The tag name will still
+	be printed to standard out.
 
 EXAMPLES
 --------
@@ -42,12 +52,18 @@
 With something like git.git current tree, I get:
 
 	[torvalds@g5 git]$ git-describe parent
-	v1.0.4-g2414721b
+	v1.0.4-14-g2414721
 
 i.e. the current head of my "parent" branch is based on v1.0.4,
-but since it has a few commits on top of that, it has added the
-git hash of the thing to the end: "-g" + 8-char shorthand for
-the commit `2414721b194453f058079d897d13c4e377f92dc6`.
+but since it has a handful commits on top of that,
+describe has added the number of additional commits ("14") and
+an abbreviated object name for the commit itself ("2414721")
+at the end.
+
+The number of additional commits is the number
+of commits which would be displayed by "git log v1.0.4..parent".
+The hash suffix is "-g" + 7-char abbreviation for the tip commit
+of parent (which was `2414721b194453f058079d897d13c4e377f92dc6`).
 
 Doing a "git-describe" on a tag-name will just show the tag name:
 
@@ -58,16 +74,43 @@
 the output shows the reference path as well:
 
 	[torvalds@g5 git]$ git describe --all --abbrev=4 v1.0.5^2
-	tags/v1.0.0-g975b
+	tags/v1.0.0-21-g975b
 
 	[torvalds@g5 git]$ git describe --all HEAD^
-	heads/lt/describe-g975b
+	heads/lt/describe-7-g975b
+
+With --abbrev set to 0, the command can be used to find the
+closest tagname without any suffix:
+
+	[torvalds@g5 git]$ git describe --abbrev=0 v1.0.5^2
+	tags/v1.0.0
+
+SEARCH STRATEGY
+---------------
+
+For each committish supplied "git describe" will first look for
+a tag which tags exactly that commit.  Annotated tags will always
+be preferred over lightweight tags, and tags with newer dates will
+always be preferred over tags with older dates.  If an exact match
+is found, its name will be output and searching will stop.
+
+If an exact match was not found "git describe" will walk back
+through the commit history to locate an ancestor commit which
+has been tagged.  The ancestor's tag will be output along with an
+abbreviation of the input committish's SHA1.
+
+If multiple tags were found during the walk then the tag which
+has the fewest commits different from the input committish will be
+selected and output.  Here fewest commits different is defined as
+the number of commits which would be shown by "git log tag..input"
+will be the smallest number of commits possible.
 
 
 Author
 ------
 Written by Linus Torvalds <torvalds@osdl.org>, but somewhat
-butchered by Junio C Hamano <junkio@cox.net>
+butchered by Junio C Hamano <junkio@cox.net>.  Later significantly
+updated by Shawn Pearce <spearce@spearce.org>.
 
 Documentation
 --------------
diff --git a/Documentation/git-diff-stages.txt b/Documentation/git-diff-stages.txt
index 3273918..120d14e 100644
--- a/Documentation/git-diff-stages.txt
+++ b/Documentation/git-diff-stages.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-diff-stages - Compares content and mode of blobs between stages in an unmerged index file
+git-diff-stages - Compares two merge stages in the index
 
 
 SYNOPSIS
diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index 8977877..6a098df 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -47,6 +47,9 @@
 noted that all of the <commit> in the above description can be
 any <tree-ish>.
 
+For a more complete list of ways to spell <commit>, see
+"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
+
 
 OPTIONS
 -------
diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt
index 3e6cd88..105d76b 100644
--- a/Documentation/git-fetch-pack.txt
+++ b/Documentation/git-fetch-pack.txt
@@ -8,10 +8,13 @@
 
 SYNOPSIS
 --------
-'git-fetch-pack' [-q] [-k] [--exec=<git-upload-pack>] [<host>:]<directory> [<refs>...]
+'git-fetch-pack' [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=<git-upload-pack>] [--depth=<n>] [-v] [<host>:]<directory> [<refs>...]
 
 DESCRIPTION
 -----------
+Usually you would want to use gitlink:git-fetch[1] which is a
+higher level wrapper of this command instead.
+
 Invokes 'git-upload-pack' on a potentially remote repository,
 and asks it to send objects missing from this repository, to
 update the named heads.  The list of commits available locally
@@ -25,17 +28,24 @@
 
 OPTIONS
 -------
--q::
+\--all::
+	Fetch all remote refs.
+
+\--quiet, \-q::
 	Pass '-q' flag to 'git-unpack-objects'; this makes the
 	cloning process less verbose.
 
--k::
+\--keep, \-k::
 	Do not invoke 'git-unpack-objects' on received data, but
 	create a single packfile out of it instead, and store it
 	in the object database. If provided twice then the pack is
 	locked against repacking.
 
---exec=<git-upload-pack>::
+\--thin::
+	Spend extra cycles to minimize the number of objects to be sent.
+	Use it on slower connection.
+
+\--upload-pack=<git-upload-pack>::
 	Use this to specify the path to 'git-upload-pack' on the
 	remote side, if is not found on your $PATH.
 	Installations of sshd ignores the user's environment
@@ -47,6 +57,15 @@
 	shells by having a lean .bashrc file (they set most of
 	the things up in .bash_profile).
 
+\--exec=<git-upload-pack>::
+	Same as \--upload-pack=<git-upload-pack>.
+
+\--depth=<n>::
+	Limit fetching to ancestor-chains not longer than n.
+
+\-v::
+	Run verbosely.
+
 <host>::
 	A remote host that houses the repository.  When this
 	part is specified, 'git-upload-pack' is invoked via
diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt
index a9e86fd..7ecf240 100644
--- a/Documentation/git-fetch.txt
+++ b/Documentation/git-fetch.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-fetch - Download objects and a head from another repository
+git-fetch - Download objects and refs from another repository
 
 
 SYNOPSIS
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index 2bf6aef..da52eba 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -7,7 +7,7 @@
 
 SYNOPSIS
 --------
-'git-for-each-ref' [--count=<count>]\* [--shell|--perl|--python] [--sort=<key>]\* [--format=<format>] [<pattern>]
+'git-for-each-ref' [--count=<count>]\* [--shell|--perl|--python|--tcl] [--sort=<key>]\* [--format=<format>] [<pattern>]
 
 DESCRIPTION
 -----------
@@ -15,7 +15,7 @@
 Iterate over all refs that match `<pattern>` and show them
 according to the given `<format>`, after sorting them according
 to the given set of `<key>`.  If `<max>` is given, stop after
-showing that many refs.  The interporated values in `<format>`
+showing that many refs.  The interpolated values in `<format>`
 can optionally be quoted as string literals in the specified
 host language allowing their direct evaluation in that language.
 
@@ -49,7 +49,7 @@
 	using fnmatch(3).  Refs that do not match the pattern
 	are not shown.
 
---shell, --perl, --python::
+--shell, --perl, --python, --tcl::
 	If given, strings that substitute `%(fieldname)`
 	placeholders are quoted as string literals suitable for
 	the specified host language.  This is meant to produce
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 67425dc..59f34b9 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -11,7 +11,8 @@
 [verse]
 'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--attach] [--thread]
 	           [-s | --signoff] [--diff-options] [--start-number <n>]
-		   [--in-reply-to=Message-Id]
+		   [--in-reply-to=Message-Id] [--suffix=.<sfx>]
+		   [--ignore-if-in-upstream]
 		   <since>[..<until>]
 
 DESCRIPTION
@@ -20,7 +21,9 @@
 Prepare each commit between <since> and <until> with its patch in
 one file per commit, formatted to resemble UNIX mailbox format.
 If ..<until> is not specified, the head of the current working
-tree is implied.
+tree is implied.  For a more complete list of ways to spell
+<since> and <until>, see "SPECIFYING REVISIONS" section in
+gitlink:git-rev-parse[1].
 
 The output of this command is convenient for e-mail submission or
 for use with gitlink:git-am[1].
@@ -78,13 +81,34 @@
 	reply to the given Message-Id, which avoids breaking threads to
 	provide a new patch series.
 
+--ignore-if-in-upstream::
+	Do not include a patch that matches a commit in
+	<until>..<since>.  This will examine all patches reachable
+	from <since> but not from <until> and compare them with the
+	patches being generated, and any patch that matches is
+	ignored.
+
+--suffix=.<sfx>::
+	Instead of using `.patch` as the suffix for generated
+	filenames, use specifed suffix.  A common alternative is
+	`--suffix=.txt`.
++
+Note that you would need to include the leading dot `.` if you
+want a filename like `0001-description-of-my-change.patch`, and
+the first letter does not have to be a dot.  Leaving it empty would
+not add any suffix.
+
 CONFIGURATION
 -------------
 You can specify extra mail header lines to be added to each
-message in the repository configuration as follows:
+message in the repository configuration.  Also you can specify
+the default suffix different from the built-in one:
 
+------------
 [format]
         headers = "Organization: git-foo\n"
+        suffix = .txt
+------------
 
 
 EXAMPLES
@@ -109,6 +133,9 @@
 	understand renaming patches, so use it only when you know
 	the recipient uses git to apply your patch.
 
+git-format-patch -3::
+	Extract three topmost commits from the current branch
+	and format them as e-mailable patches.
 
 See Also
 --------
diff --git a/Documentation/git-fsck-objects.txt b/Documentation/git-fsck-objects.txt
index d0af99d..f21061e 100644
--- a/Documentation/git-fsck-objects.txt
+++ b/Documentation/git-fsck-objects.txt
@@ -8,132 +8,10 @@
 
 SYNOPSIS
 --------
-[verse]
-'git-fsck-objects' [--tags] [--root] [--unreachable] [--cache]
-		 [--full] [--strict] [<object>*]
+'git-fsck-objects' ...
 
 DESCRIPTION
 -----------
-Verifies the connectivity and validity of the objects in the database.
 
-OPTIONS
--------
-<object>::
-	An object to treat as the head of an unreachability trace.
-+
-If no objects are given, git-fsck-objects defaults to using the
-index file and all SHA1 references in .git/refs/* as heads.
-
---unreachable::
-	Print out objects that exist but that aren't readable from any
-	of the reference nodes.
-
---root::
-	Report root nodes.
-
---tags::
-	Report tags.
-
---cache::
-	Consider any object recorded in the index also as a head node for
-	an unreachability trace.
-
---full::
-	Check not just objects in GIT_OBJECT_DIRECTORY
-	($GIT_DIR/objects), but also the ones found in alternate
-	object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES
-	or $GIT_DIR/objects/info/alternates,
-	and in packed git archives found in $GIT_DIR/objects/pack
-	and corresponding pack subdirectories in alternate
-	object pools.
-
---strict::
-	Enable more strict checking, namely to catch a file mode
-	recorded with g+w bit set, which was created by older
-	versions of git.  Existing repositories, including the
-	Linux kernel, git itself, and sparse repository have old
-	objects that triggers this check, but it is recommended
-	to check new projects with this flag.
-
-It tests SHA1 and general object sanity, and it does full tracking of
-the resulting reachability and everything else. It prints out any
-corruption it finds (missing or bad objects), and if you use the
-'--unreachable' flag it will also print out objects that exist but
-that aren't readable from any of the specified head nodes.
-
-So for example
-
-	git-fsck-objects --unreachable HEAD $(cat .git/refs/heads/*)
-
-will do quite a _lot_ of verification on the tree. There are a few
-extra validity tests to be added (make sure that tree objects are
-sorted properly etc), but on the whole if "git-fsck-objects" is happy, you
-do have a valid tree.
-
-Any corrupt objects you will have to find in backups or other archives
-(i.e., you can just remove them and do an "rsync" with some other site in
-the hopes that somebody else has the object you have corrupted).
-
-Of course, "valid tree" doesn't mean that it wasn't generated by some
-evil person, and the end result might be crap. git is a revision
-tracking system, not a quality assurance system ;)
-
-Extracted Diagnostics
----------------------
-
-expect dangling commits - potential heads - due to lack of head information::
-	You haven't specified any nodes as heads so it won't be
-	possible to differentiate between un-parented commits and
-	root nodes.
-
-missing sha1 directory '<dir>'::
-	The directory holding the sha1 objects is missing.
-
-unreachable <type> <object>::
-	The <type> object <object>, isn't actually referred to directly
-	or indirectly in any of the trees or commits seen. This can
-	mean that there's another root node that you're not specifying
-	or that the tree is corrupt. If you haven't missed a root node
-	then you might as well delete unreachable nodes since they
-	can't be used.
-
-missing <type> <object>::
-	The <type> object <object>, is referred to but isn't present in
-	the database.
-
-dangling <type> <object>::
-	The <type> object <object>, is present in the database but never
-	'directly' used. A dangling commit could be a root node.
-
-warning: git-fsck-objects: tree <tree> has full pathnames in it::
-	And it shouldn't...
-
-sha1 mismatch <object>::
-	The database has an object who's sha1 doesn't match the
-	database value.
-	This indicates a serious data integrity problem.
-
-Environment Variables
----------------------
-
-GIT_OBJECT_DIRECTORY::
-	used to specify the object database root (usually $GIT_DIR/objects)
-
-GIT_INDEX_FILE::
-	used to specify the index file of the index
-
-GIT_ALTERNATE_OBJECT_DIRECTORIES::
-	used to specify additional object database roots (usually unset)
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
-GIT
----
-Part of the gitlink:git[7] suite
-
+This is a synonym for gitlink:git-fsck[1].  Please refer to the
+documentation of that command.
diff --git a/Documentation/git-fsck.txt b/Documentation/git-fsck.txt
new file mode 100644
index 0000000..058009d
--- /dev/null
+++ b/Documentation/git-fsck.txt
@@ -0,0 +1,139 @@
+git-fsck(1)
+===========
+
+NAME
+----
+git-fsck - Verifies the connectivity and validity of the objects in the database
+
+
+SYNOPSIS
+--------
+[verse]
+'git-fsck' [--tags] [--root] [--unreachable] [--cache]
+		 [--full] [--strict] [<object>*]
+
+DESCRIPTION
+-----------
+Verifies the connectivity and validity of the objects in the database.
+
+OPTIONS
+-------
+<object>::
+	An object to treat as the head of an unreachability trace.
++
+If no objects are given, git-fsck defaults to using the
+index file and all SHA1 references in .git/refs/* as heads.
+
+--unreachable::
+	Print out objects that exist but that aren't readable from any
+	of the reference nodes.
+
+--root::
+	Report root nodes.
+
+--tags::
+	Report tags.
+
+--cache::
+	Consider any object recorded in the index also as a head node for
+	an unreachability trace.
+
+--full::
+	Check not just objects in GIT_OBJECT_DIRECTORY
+	($GIT_DIR/objects), but also the ones found in alternate
+	object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES
+	or $GIT_DIR/objects/info/alternates,
+	and in packed git archives found in $GIT_DIR/objects/pack
+	and corresponding pack subdirectories in alternate
+	object pools.
+
+--strict::
+	Enable more strict checking, namely to catch a file mode
+	recorded with g+w bit set, which was created by older
+	versions of git.  Existing repositories, including the
+	Linux kernel, git itself, and sparse repository have old
+	objects that triggers this check, but it is recommended
+	to check new projects with this flag.
+
+It tests SHA1 and general object sanity, and it does full tracking of
+the resulting reachability and everything else. It prints out any
+corruption it finds (missing or bad objects), and if you use the
+'--unreachable' flag it will also print out objects that exist but
+that aren't readable from any of the specified head nodes.
+
+So for example
+
+	git-fsck --unreachable HEAD $(cat .git/refs/heads/*)
+
+will do quite a _lot_ of verification on the tree. There are a few
+extra validity tests to be added (make sure that tree objects are
+sorted properly etc), but on the whole if "git-fsck" is happy, you
+do have a valid tree.
+
+Any corrupt objects you will have to find in backups or other archives
+(i.e., you can just remove them and do an "rsync" with some other site in
+the hopes that somebody else has the object you have corrupted).
+
+Of course, "valid tree" doesn't mean that it wasn't generated by some
+evil person, and the end result might be crap. git is a revision
+tracking system, not a quality assurance system ;)
+
+Extracted Diagnostics
+---------------------
+
+expect dangling commits - potential heads - due to lack of head information::
+	You haven't specified any nodes as heads so it won't be
+	possible to differentiate between un-parented commits and
+	root nodes.
+
+missing sha1 directory '<dir>'::
+	The directory holding the sha1 objects is missing.
+
+unreachable <type> <object>::
+	The <type> object <object>, isn't actually referred to directly
+	or indirectly in any of the trees or commits seen. This can
+	mean that there's another root node that you're not specifying
+	or that the tree is corrupt. If you haven't missed a root node
+	then you might as well delete unreachable nodes since they
+	can't be used.
+
+missing <type> <object>::
+	The <type> object <object>, is referred to but isn't present in
+	the database.
+
+dangling <type> <object>::
+	The <type> object <object>, is present in the database but never
+	'directly' used. A dangling commit could be a root node.
+
+warning: git-fsck: tree <tree> has full pathnames in it::
+	And it shouldn't...
+
+sha1 mismatch <object>::
+	The database has an object who's sha1 doesn't match the
+	database value.
+	This indicates a serious data integrity problem.
+
+Environment Variables
+---------------------
+
+GIT_OBJECT_DIRECTORY::
+	used to specify the object database root (usually $GIT_DIR/objects)
+
+GIT_INDEX_FILE::
+	used to specify the index file of the index
+
+GIT_ALTERNATE_OBJECT_DIRECTORIES::
+	used to specify additional object database roots (usually unset)
+
+Author
+------
+Written by Linus Torvalds <torvalds@osdl.org>
+
+Documentation
+--------------
+Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 73d78c1..e37758a 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -8,7 +8,7 @@
 
 SYNOPSIS
 --------
-'git-gc'
+'git-gc' [--prune]
 
 DESCRIPTION
 -----------
@@ -21,6 +21,21 @@
 each repository to maintain good disk space utilization and good
 operating performance.
 
+OPTIONS
+-------
+
+--prune::
+	Usually `git-gc` packs refs, expires old reflog entries,
+	packs loose objects,
+	and removes old 'rerere' records.  Removal
+	of unreferenced loose objects is an unsafe operation
+	while other git operations are in progress, so it is not
+	done by default.  Pass this option if you want it, and only
+	when you know nobody else is creating new objects in the
+	repository at the same time (e.g. never use this option
+	in a cron script).
+
+
 Configuration
 -------------
 
@@ -35,7 +50,7 @@
 are not part of the current branch should remain available in
 this repository.  These types of entries are generally created as
 a result of using `git commit \--amend` or `git rebase` and are the
-commits prior to the amend or rebase occuring.  Since these changes
+commits prior to the amend or rebase occurring.  Since these changes
 are not part of the current project most users will want to expire
 them sooner.  This option defaults to '30 days'.
 
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index bfbece9..0140c8e 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -91,7 +91,7 @@
 	combined by 'or'.
 
 --and | --or | --not | ( | )::
-	Specify how multiple patterns are combined using boolean
+	Specify how multiple patterns are combined using Boolean
 	expressions.  `--or` is the default operator.  `--and` has
 	higher precedence than `--or`.  `-e` has to be used for all
 	patterns.
diff --git a/Documentation/git-hash-object.txt b/Documentation/git-hash-object.txt
index 04e8d00..5edc36f 100644
--- a/Documentation/git-hash-object.txt
+++ b/Documentation/git-hash-object.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-hash-object - Computes object ID and optionally creates a blob from a file
+git-hash-object - Compute object ID and optionally creates a blob from a file
 
 
 SYNOPSIS
diff --git a/Documentation/git-http-fetch.txt b/Documentation/git-http-fetch.txt
index 3d50809..7dc2df3 100644
--- a/Documentation/git-http-fetch.txt
+++ b/Documentation/git-http-fetch.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-http-fetch - downloads a remote git repository via HTTP
+git-http-fetch - Download from a remote git repository via HTTP
 
 
 SYNOPSIS
diff --git a/Documentation/git-http-push.txt b/Documentation/git-http-push.txt
index c2485c6..4b4a461 100644
--- a/Documentation/git-http-push.txt
+++ b/Documentation/git-http-push.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-http-push - Push missing objects using HTTP/DAV
+git-http-push - Push objects over HTTP/DAV to another repository
 
 
 SYNOPSIS
diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt
index 596b567..1b64d3a 100644
--- a/Documentation/git-init.txt
+++ b/Documentation/git-init.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-init - Creates an empty git repository
+git-init - Create an empty git repository or reinitialize an existing one
 
 
 SYNOPSIS
diff --git a/Documentation/git-instaweb.txt b/Documentation/git-instaweb.txt
index 7dd393b..52a6aa6 100644
--- a/Documentation/git-instaweb.txt
+++ b/Documentation/git-instaweb.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-instaweb - instantly browse your working repository in gitweb
+git-instaweb - Instantly browse your working repository in gitweb
 
 SYNOPSIS
 --------
diff --git a/Documentation/git-local-fetch.txt b/Documentation/git-local-fetch.txt
index 2fbdfe0..22048d8 100644
--- a/Documentation/git-local-fetch.txt
+++ b/Documentation/git-local-fetch.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-local-fetch - Duplicates another git repository on a local system
+git-local-fetch - Duplicate another git repository on a local system
 
 
 SYNOPSIS
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index e9f746b..b802946 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -27,13 +27,16 @@
 
 include::pretty-formats.txt[]
 
---max-count=<n>::
+-<n>::
 	Limits the number of commits to show.
 
 <since>..<until>::
 	Show only commits between the named two commits.  When
 	either <since> or <until> is omitted, it defaults to
 	`HEAD`, i.e. the tip of the current branch.
+	For a more complete list of ways to spell <since>
+	and <until>, see "SPECIFYING REVISIONS" section in
+	gitlink:git-rev-parse[1].
 
 -p::
 	Show the change the commit introduces in a patch form.
diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt
index 8520b97..79e0b7b 100644
--- a/Documentation/git-ls-files.txt
+++ b/Documentation/git-ls-files.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-ls-files - Information about files in the index/working directory
+git-ls-files - Show information about files in the index and the working tree
 
 
 SYNOPSIS
diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
index c8a4c5a..c254005 100644
--- a/Documentation/git-ls-remote.txt
+++ b/Documentation/git-ls-remote.txt
@@ -29,7 +29,7 @@
 -u <exec>, --upload-pack=<exec>::
 	Specify the full path of gitlink:git-upload-pack[1] on the remote
 	host. This allows listing references from repositories accessed via
-	SSH and where the SSH deamon does not use the PATH configured by the
+	SSH and where the SSH daemon does not use the PATH configured by the
 	user. Also see the '--exec' option for gitlink:git-peek-remote[1].
 
 <repository>::
diff --git a/Documentation/git-ls-tree.txt b/Documentation/git-ls-tree.txt
index f283bac..7899394 100644
--- a/Documentation/git-ls-tree.txt
+++ b/Documentation/git-ls-tree.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-ls-tree - Lists the contents of a tree object
+git-ls-tree - List the contents of a tree object
 
 
 SYNOPSIS
diff --git a/Documentation/git-mailinfo.txt b/Documentation/git-mailinfo.txt
index 5088bbe..ba18133 100644
--- a/Documentation/git-mailinfo.txt
+++ b/Documentation/git-mailinfo.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-mailinfo - Extracts patch from a single e-mail message
+git-mailinfo - Extracts patch and authorship from a single e-mail message
 
 
 SYNOPSIS
@@ -18,7 +18,7 @@
 <patch> file.  The author name, e-mail and e-mail subject are
 written out to the standard output to be used by git-applypatch
 to create a commit.  It is usually not necessary to use this
-command directly.
+command directly.  See gitlink:git-am[1] instead.
 
 
 OPTIONS
diff --git a/Documentation/git-mailsplit.txt b/Documentation/git-mailsplit.txt
index 5a17801..c11d6a5 100644
--- a/Documentation/git-mailsplit.txt
+++ b/Documentation/git-mailsplit.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-mailsplit - Totally braindamaged mbox splitter program
+git-mailsplit - Simple UNIX mbox splitter program
 
 SYNOPSIS
 --------
diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt
index 6099be2..3190aed 100644
--- a/Documentation/git-merge-base.txt
+++ b/Documentation/git-merge-base.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-merge-base - Finds as good a common ancestor as possible for a merge
+git-merge-base - Find as good common ancestors as possible for a merge
 
 
 SYNOPSIS
diff --git a/Documentation/git-merge-file.txt b/Documentation/git-merge-file.txt
index 29d3faa..31882ab 100644
--- a/Documentation/git-merge-file.txt
+++ b/Documentation/git-merge-file.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-merge-file - three-way file merge
+git-merge-file - Run a three-way file merge
 
 
 SYNOPSIS
diff --git a/Documentation/git-merge-index.txt b/Documentation/git-merge-index.txt
index 0cf505e..b8ee1ff 100644
--- a/Documentation/git-merge-index.txt
+++ b/Documentation/git-merge-index.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-merge-index - Runs a merge for files needing merging
+git-merge-index - Run a merge for files needing merging
 
 
 SYNOPSIS
diff --git a/Documentation/git-merge-one-file.txt b/Documentation/git-merge-one-file.txt
index 86aad37..f80ab3b 100644
--- a/Documentation/git-merge-one-file.txt
+++ b/Documentation/git-merge-one-file.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-merge-one-file - The standard helper program to use with "git-merge-index"
+git-merge-one-file - The standard helper program to use with git-merge-index
 
 
 SYNOPSIS
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index 0f79665..3c08a6f 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-merge - Grand Unified Merge Driver
+git-merge - Join two or more development histories together
 
 
 SYNOPSIS
diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt
index 207c43a..6756b76 100644
--- a/Documentation/git-mv.txt
+++ b/Documentation/git-mv.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-mv - Move or rename a file, directory or symlink
+git-mv - Move or rename a file, a directory, or a symlink
 
 
 SYNOPSIS
diff --git a/Documentation/git-pack-redundant.txt b/Documentation/git-pack-redundant.txt
index 7d54b17..94bbea0 100644
--- a/Documentation/git-pack-redundant.txt
+++ b/Documentation/git-pack-redundant.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-pack-redundant - Program used to find redundant pack files
+git-pack-redundant - Find redundant pack files
 
 
 SYNOPSIS
@@ -21,7 +21,7 @@
 following command useful when wanting to remove packs which contain unreachable
 objects.
 
-git-fsck-objects --full --unreachable | cut -d ' ' -f3 | \
+git-fsck --full --unreachable | cut -d ' ' -f3 | \
 git-pack-redundant --all | xargs rm
 
 OPTIONS
diff --git a/Documentation/git-pack-refs.txt b/Documentation/git-pack-refs.txt
index 464269f..a20fc7d 100644
--- a/Documentation/git-pack-refs.txt
+++ b/Documentation/git-pack-refs.txt
@@ -29,12 +29,23 @@
 Subsequent updates to branches always creates new file under
 `$GIT_DIR/refs` hierarchy.
 
+A recommended practice to deal with a repository with too many
+refs is to pack its refs with `--all --prune` once, and
+occasionally run `git-pack-refs \--prune`.  Tags are by
+definition stationary and are not expected to change.  Branch
+heads will be packed with the initial `pack-refs --all`, but
+only the currently active branch heads will become unpacked,
+and next `pack-refs` (without `--all`) will leave them
+unpacked.
+
+
 OPTIONS
 -------
 
 \--all::
 
-The command by default packs all tags and leaves branch tips
+The command by default packs all tags and refs that are already
+packed, and leaves other refs
 alone.  This is because branches are expected to be actively
 developed and packing their tips does not help performance.
 This option causes branch tips to be packed as well.  Useful for
diff --git a/Documentation/git-parse-remote.txt b/Documentation/git-parse-remote.txt
index fc27afe..11b1f4d 100644
--- a/Documentation/git-parse-remote.txt
+++ b/Documentation/git-parse-remote.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-parse-remote - Routines to help parsing $GIT_DIR/remotes/
+git-parse-remote - Routines to help parsing remote repository access parameters
 
 
 SYNOPSIS
@@ -14,7 +14,8 @@
 -----------
 This script is included in various scripts to supply
 routines to parse files under $GIT_DIR/remotes/ and
-$GIT_DIR/branches/.
+$GIT_DIR/branches/ and configuration variables that are related
+to fetching, pulling and pushing.
 
 The primary entry points are:
 
@@ -25,7 +26,8 @@
 	(e.g. `refs/heads/foo`).  When `<refspec>...` is empty
 	the returned list of refs consists of the defaults
 	for the given `<repo>`, if specified in
-	`$GIT_DIR/remotes/` or `$GIT_DIR/branches/`.
+	`$GIT_DIR/remotes/`, `$GIT_DIR/branches/`, or `remote.*.fetch`
+	configuration.
 
 get_remote_refs_for_push::
 	Given the list of user-supplied `<repo> <refspec>...`,
diff --git a/Documentation/git-patch-id.txt b/Documentation/git-patch-id.txt
index 5389097..a7e9fd0 100644
--- a/Documentation/git-patch-id.txt
+++ b/Documentation/git-patch-id.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-patch-id - Generate a patch ID
+git-patch-id - Compute unique ID for a patch
 
 SYNOPSIS
 --------
diff --git a/Documentation/git-peek-remote.txt b/Documentation/git-peek-remote.txt
index a00060c..74f37bd 100644
--- a/Documentation/git-peek-remote.txt
+++ b/Documentation/git-peek-remote.txt
@@ -3,12 +3,12 @@
 
 NAME
 ----
-git-peek-remote - Lists the references in a remote repository
+git-peek-remote - List the references in a remote repository
 
 
 SYNOPSIS
 --------
-'git-peek-remote' [--exec=<git-upload-pack>] [<host>:]<directory>
+'git-peek-remote' [--upload-pack=<git-upload-pack>] [<host>:]<directory>
 
 DESCRIPTION
 -----------
@@ -17,7 +17,7 @@
 
 OPTIONS
 -------
---exec=<git-upload-pack>::
+\--upload-pack=<git-upload-pack>::
 	Use this to specify the path to 'git-upload-pack' on the
 	remote side, if it is not found on your $PATH. Some
 	installations of sshd ignores the user's environment
@@ -29,6 +29,9 @@
 	shells, but prefer having a lean .bashrc file (they set most of
 	the things up in .bash_profile).
 
+\--exec=<git-upload-pack>::
+	Same \--upload-pack=<git-upload-pack>.
+
 <host>::
 	A remote host that houses the repository.  When this
 	part is specified, 'git-upload-pack' is invoked via
diff --git a/Documentation/git-prune-packed.txt b/Documentation/git-prune-packed.txt
index a79193f..310033e 100644
--- a/Documentation/git-prune-packed.txt
+++ b/Documentation/git-prune-packed.txt
@@ -3,8 +3,7 @@
 
 NAME
 ----
-git-prune-packed - Program used to remove the extra object files that are now
-residing in a pack file.
+git-prune-packed - Remove extra objects that are already in pack files
 
 
 SYNOPSIS
diff --git a/Documentation/git-prune.txt b/Documentation/git-prune.txt
index a11e303..0b44f30 100644
--- a/Documentation/git-prune.txt
+++ b/Documentation/git-prune.txt
@@ -13,7 +13,7 @@
 DESCRIPTION
 -----------
 
-This runs `git-fsck-objects --unreachable` using all the refs
+This runs `git-fsck --unreachable` using all the refs
 available in `$GIT_DIR/refs`, optionally with additional set of
 objects specified on the command line, and prunes all
 objects unreachable from any of these head objects from the object database.
diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt
index 13be992..a81d68c 100644
--- a/Documentation/git-pull.txt
+++ b/Documentation/git-pull.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-pull - Pull and merge from another repository or a local branch
+git-pull - Fetch from and merge with another repository or a local branch
 
 
 SYNOPSIS
@@ -42,7 +42,7 @@
 	current branch.  Normally the branch merged in is
 	the HEAD of the remote repository, but the choice is
 	determined by the branch.<name>.remote and
-	branch.<name>.merge options; see gitlink:git-repo-config[1]
+	branch.<name>.merge options; see gitlink:git-config[1]
 	for details.
 
 git pull origin next::
@@ -52,7 +52,8 @@
 
 git pull . fixes enhancements::
 	Bundle local branch `fixes` and `enhancements` on top of
-	the current branch, making an Octopus merge.
+	the current branch, making an Octopus merge.  This `git pull .`
+	syntax is equivalent to `git merge`.
 
 git pull -s ours . obsolete::
 	Merge local branch `obsolete` into the current branch,
@@ -93,7 +94,7 @@
 
 SEE ALSO
 --------
-gitlink:git-fetch[1], gitlink:git-merge[1], gitlink:git-repo-config[1]
+gitlink:git-fetch[1], gitlink:git-merge[1], gitlink:git-config[1]
 
 
 Author
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 197f4b5..f8cc2b5 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -8,7 +8,7 @@
 
 SYNOPSIS
 --------
-'git-push' [--all] [--tags] [-f | --force] <repository> <refspec>...
+'git-push' [--all] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]
 
 DESCRIPTION
 -----------
@@ -67,12 +67,33 @@
 	addition to refspecs explicitly listed on the command
 	line.
 
+\--receive-pack=<git-receive-pack>::
+	Path to the 'git-receive-pack' program on the remote
+	end.  Sometimes useful when pushing to a remote
+	repository over ssh, and you do not have the program in
+	a directory on the default $PATH.
+
+\--exec=<git-receive-pack>::
+	Same as \--receive-pack=<git-receive-pack>.
+
 -f, \--force::
 	Usually, the command refuses to update a remote ref that is
 	not a descendant of the local ref used to overwrite it.
 	This flag disables the check.  This can cause the
 	remote repository to lose commits; use it with care.
 
+\--repo=<repo>::
+	When no repository is specified the command defaults to
+	"origin"; this overrides it.
+
+\--thin, \--no-thin::
+	These options are passed to `git-send-pack`.  Thin
+	transfer spends extra cycles to minimize the number of
+	objects to be sent and meant to be used on slower connection.
+
+-v::
+	Run verbosely.
+
 include::urls.txt[]
 
 Author
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 03e867a..0cb9e1f 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-rebase - Rebase local commits to a new head
+git-rebase - Forward-port local commits to the updated upstream head
 
 SYNOPSIS
 --------
diff --git a/Documentation/git-receive-pack.txt b/Documentation/git-receive-pack.txt
index 0dfadc2..10e8c46 100644
--- a/Documentation/git-receive-pack.txt
+++ b/Documentation/git-receive-pack.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-receive-pack - Receive what is pushed into it
+git-receive-pack - Receive what is pushed into the repository
 
 
 SYNOPSIS
diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt
index 55a24d3..1138865 100644
--- a/Documentation/git-reflog.txt
+++ b/Documentation/git-reflog.txt
@@ -9,7 +9,7 @@
 SYNOPSIS
 --------
 [verse]
-'git-reflog' expire [--dry-run]
+'git-reflog' expire [--dry-run] [--stale-fix]
 	[--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...
 
 
diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 5b93a8c..358c1ac 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -28,7 +28,7 @@
 
 The remote configuration is achieved using the `remote.origin.url` and
 `remote.origin.fetch` configuration variables.  (See
-gitlink:git-repo-config[1]).
+gitlink:git-config[1]).
 
 Examples
 --------
@@ -58,7 +58,7 @@
 --------
 gitlink:git-fetch[1]
 gitlink:git-branch[1]
-gitlink:git-repo-config[1]
+gitlink:git-config[1]
 
 Author
 ------
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index 0fa47e3..4a57ce8 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -3,8 +3,7 @@
 
 NAME
 ----
-git-repack - Script used to pack a repository from a collection of
-objects into pack files.
+git-repack - Pack unpacked objects in a repository
 
 
 SYNOPSIS
diff --git a/Documentation/git-repo-config.txt b/Documentation/git-repo-config.txt
index c55a8ba..2deba31 100644
--- a/Documentation/git-repo-config.txt
+++ b/Documentation/git-repo-config.txt
@@ -3,225 +3,16 @@
 
 NAME
 ----
-git-repo-config - Get and set repository or global options.
+git-repo-config - Get and set repository or global options
 
 
 SYNOPSIS
 --------
-[verse]
-'git-repo-config' [--global] [type] name [value [value_regex]]
-'git-repo-config' [--global] [type] --add name value
-'git-repo-config' [--global] [type] --replace-all name [value [value_regex]]
-'git-repo-config' [--global] [type] --get name [value_regex]
-'git-repo-config' [--global] [type] --get-all name [value_regex]
-'git-repo-config' [--global] [type] --unset name [value_regex]
-'git-repo-config' [--global] [type] --unset-all name [value_regex]
-'git-repo-config' [--global] -l | --list
+'git-repo-config' ...
+
 
 DESCRIPTION
 -----------
-You can query/set/replace/unset options with this command. The name is
-actually the section and the key separated by a dot, and the value will be
-escaped.
 
-Multiple lines can be added to an option by using the '--add' option.
-If you want to update or unset an option which can occur on multiple
-lines, a POSIX regexp `value_regex` needs to be given.  Only the
-existing values that match the regexp are updated or unset.  If
-you want to handle the lines that do *not* match the regex, just
-prepend a single exclamation mark in front (see EXAMPLES).
-
-The type specifier can be either '--int' or '--bool', which will make
-'git-repo-config' ensure that the variable(s) are of the given type and
-convert the value to the canonical form (simple decimal number for int,
-a "true" or "false" string for bool). If no type specifier is passed,
-no checks or transformations are performed on the value.
-
-This command will fail if:
-
-. The .git/config file is invalid,
-. Can not write to .git/config,
-. no section was provided,
-. the section or key is invalid,
-. you try to unset an option which does not exist,
-. you try to unset/set an option for which multiple lines match, or
-. you use --global option without $HOME being properly set.
-
-
-OPTIONS
--------
-
---replace-all::
-	Default behavior is to replace at most one line. This replaces
-	all lines matching the key (and optionally the value_regex).
-
---add::
-	Adds a new line to the option without altering any existing
-	values.  This is the same as providing '^$' as the value_regex.
-
---get::
-	Get the value for a given key (optionally filtered by a regex
-	matching the value). Returns error code 1 if the key was not
-	found and error code 2 if multiple key values were found.
-
---get-all::
-	Like get, but does not fail if the number of values for the key
-	is not exactly one.
-
---get-regexp::
-	Like --get-all, but interprets the name as a regular expression.
-
---global::
-	Use global ~/.gitconfig file rather than the repository .git/config.
-
---unset::
-	Remove the line matching the key from config file.
-
---unset-all::
-	Remove all matching lines from config file.
-
--l, --list::
-	List all variables set in config file.
-
---bool::
-	git-repo-config will ensure that the output is "true" or "false"
-
---int::
-	git-repo-config will ensure that the output is a simple
-	decimal number.  An optional value suffix of 'k', 'm', or 'g'
-	in the config file will cause the value to be multiplied
-	by 1024, 1048576, or 1073741824 prior to output.
-
-
-ENVIRONMENT
------------
-
-GIT_CONFIG::
-	Take the configuration from the given file instead of .git/config.
-	Using the "--global" option forces this to ~/.gitconfig.
-
-GIT_CONFIG_LOCAL::
-	Currently the same as $GIT_CONFIG; when Git will support global
-	configuration files, this will cause it to take the configuration
-	from the global configuration file in addition to the given file.
-
-
-EXAMPLE
--------
-
-Given a .git/config like this:
-
-	#
-	# This is the config file, and
-	# a '#' or ';' character indicates
-	# a comment
-	#
-
-	; core variables
-	[core]
-		; Don't trust file modes
-		filemode = false
-
-	; Our diff algorithm
-	[diff]
-		external = "/usr/local/bin/gnu-diff -u"
-		renames = true
-
-	; Proxy settings
-	[core]
-		gitproxy="ssh" for "ssh://kernel.org/"
-		gitproxy="proxy-command" for kernel.org
-		gitproxy="myprotocol-command" for "my://"
-		gitproxy=default-proxy ; for all the rest
-
-you can set the filemode to true with
-
-------------
-% git repo-config core.filemode true
-------------
-
-The hypothetical proxy command entries actually have a postfix to discern
-what URL they apply to. Here is how to change the entry for kernel.org
-to "ssh".
-
-------------
-% git repo-config core.gitproxy '"ssh" for kernel.org' 'for kernel.org$'
-------------
-
-This makes sure that only the key/value pair for kernel.org is replaced.
-
-To delete the entry for renames, do
-
-------------
-% git repo-config --unset diff.renames
-------------
-
-If you want to delete an entry for a multivar (like core.gitproxy above),
-you have to provide a regex matching the value of exactly one line.
-
-To query the value for a given key, do
-
-------------
-% git repo-config --get core.filemode
-------------
-
-or
-
-------------
-% git repo-config core.filemode
-------------
-
-or, to query a multivar:
-
-------------
-% git repo-config --get core.gitproxy "for kernel.org$"
-------------
-
-If you want to know all the values for a multivar, do:
-
-------------
-% git repo-config --get-all core.gitproxy
-------------
-
-If you like to live dangerous, you can replace *all* core.gitproxy by a
-new one with
-
-------------
-% git repo-config --replace-all core.gitproxy ssh
-------------
-
-However, if you really only want to replace the line for the default proxy,
-i.e. the one without a "for ..." postfix, do something like this:
-
-------------
-% git repo-config core.gitproxy ssh '! for '
-------------
-
-To actually match only values with an exclamation mark, you have to
-
-------------
-% git repo-config section.key value '[!]'
-------------
-
-To add a new proxy, without altering any of the existing ones, use
-
-------------
-% git repo-config core.gitproxy '"proxy" for example.com'
-------------
-
-
-include::config.txt[]
-
-
-Author
-------
-Written by Johannes Schindelin <Johannes.Schindelin@gmx.de>
-
-Documentation
---------------
-Documentation by Johannes Schindelin, Petr Baudis and the git-list <git@vger.kernel.org>.
-
-GIT
----
-Part of the gitlink:git[7] suite
-
+This is a synonym for gitlink:git-config[1].  Please refer to the
+documentation of that command.
diff --git a/Documentation/git-rerere.txt b/Documentation/git-rerere.txt
index b57a72b..139b6eb 100644
--- a/Documentation/git-rerere.txt
+++ b/Documentation/git-rerere.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-rerere - Reuse recorded resolve
+git-rerere - Reuse recorded resolution of conflicted merges
 
 SYNOPSIS
 --------
@@ -38,7 +38,7 @@
 
 This resets the metadata used by rerere if a merge resolution is to be
 is aborted.  Calling gitlink:git-am[1] --skip or gitlink:git-rebase[1]
-[--skip|--abort] will automatcally invoke this command.
+[--skip|--abort] will automatically invoke this command.
 
 'diff'::
 
@@ -81,7 +81,7 @@
 
 ------------
 	$ git checkout topic
-	$ git pull . master
+	$ git merge master
 
               o---*---o---+ topic
              /           /
@@ -103,10 +103,10 @@
 
 ------------
 	$ git checkout topic
-	$ git pull . master
+	$ git merge master
 	$ ... work on both topic and master branches
 	$ git checkout master
-	$ git pull . topic
+	$ git merge topic
 
               o---*---o---+---o---o topic
              /           /         \
@@ -126,11 +126,11 @@
 
 ------------
 	$ git checkout topic
-	$ git pull . master
+	$ git merge master
 	$ git reset --hard HEAD^ ;# rewind the test merge
 	$ ... work on both topic and master branches
 	$ git checkout master
-	$ git pull . topic
+	$ git merge topic
 
               o---*---o-------o---o topic
              /                     \
diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index 4f42478..04475a9 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -121,10 +121,6 @@
 +
 ------------
 $ git pull                         <1>
-Trying really trivial in-index merge...
-fatal: Merge requires file-level merging
-Nope.
-...
 Auto-merging nitfol
 CONFLICT (content): Merge conflict in nitfol
 Automatic merge failed/prevented; fix up by hand
diff --git a/Documentation/git-resolve.txt b/Documentation/git-resolve.txt
index 4e57c2b..0925973 100644
--- a/Documentation/git-resolve.txt
+++ b/Documentation/git-resolve.txt
@@ -12,6 +12,8 @@
 
 DESCRIPTION
 -----------
+DEPRECATED.  Use `git-merge` instead.
+
 Given two commits and a merge message, merge the <merged> commit
 into <current> commit, with the commit log message <message>.
 
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index 86c94e7..c742117 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -27,6 +27,7 @@
 	     [ \--pretty | \--header ]
 	     [ \--bisect ]
 	     [ \--merge ]
+	     [ \--walk-reflogs ]
 	     <commit>... [ \-- <paths>... ]
 
 DESCRIPTION
@@ -190,6 +191,22 @@
 	In addition to the '<commit>' listed on the command
 	line, read them from the standard input.
 
+-g, --walk-reflogs::
+
+	Instead of walking the commit ancestry chain, walk
+	reflog entries from the most recent one to older ones.
+	When this option is used you cannot specify commits to
+	exclude (that is, '{caret}commit', 'commit1..commit2',
+	nor 'commit1...commit2' notations cannot be used).
++
+With '\--pretty' format other than oneline (for obvious reasons),
+this causes the output to have two extra lines of information
+taken from the reflog.  By default, 'commit@{Nth}' notation is
+used in the output.  When the starting commit is specified as
+'commit@{now}', output also uses 'commit@{timestamp}' notation
+instead.  Under '\--pretty=oneline', the commit message is
+prefixed with this information on the same line.
+
 --merge::
 
 	After a failed merge, show refs that touch files having a
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 4eaf5a0..aeb37b6 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -152,6 +152,14 @@
   used immediately following a ref name and the ref must have an
   existing log ($GIT_DIR/logs/<ref>).
 
+* A ref followed by the suffix '@' with an ordinal specification
+  enclosed in a brace pair (e.g. '\{1\}', '\{15\}') to specify
+  the n-th prior value of that ref.  For example 'master@\{1\}'
+  is the immediate prior value of 'master' while 'master@\{5\}'
+  is the 5th prior value of 'master'. This suffix may only be used
+  immediately following a ref name and the ref must have an existing
+  log ($GIT_DIR/logs/<ref>).
+
 * A suffix '{caret}' to a revision parameter means the first parent of
   that commit object.  '{caret}<n>' means the <n>th parent (i.e.
   'rev{caret}'
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index 71f7815..8081bba 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -19,6 +19,8 @@
 -------
 <commit>::
 	Commit to revert.
+	For a more complete list of ways to spell commit names, see
+	"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
 
 -e|--edit::
 	With this option, `git-revert` will let you edit the commit
diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt
index 3a8f279..6feebc0 100644
--- a/Documentation/git-rm.txt
+++ b/Documentation/git-rm.txt
@@ -60,21 +60,17 @@
 EXAMPLES
 --------
 git-rm Documentation/\\*.txt::
-
 	Removes all `\*.txt` files from the index that are under the
-	`Documentation` directory and any of its subdirectories. The
-	files are not removed from the working tree.
+	`Documentation` directory and any of its subdirectories.
 +
 Note that the asterisk `\*` is quoted from the shell in this
 example; this lets the command include the files from
 subdirectories of `Documentation/` directory.
 
 git-rm -f git-*.sh::
-
-	Remove all git-*.sh scripts that are in the index. The files
-	are removed from the index, and from the working
-	tree. Because this example lets the shell expand the
-	asterisk (i.e. you are listing the files explicitly), it
+	Remove all git-*.sh scripts that are in the index.
+	Because this example lets the shell expand the asterisk
+	(i.e. you are listing the files explicitly), it
 	does not remove `subdir/git-foo.sh`.
 
 See Also
diff --git a/Documentation/git-send-pack.txt b/Documentation/git-send-pack.txt
index 5376f68..2f6267c 100644
--- a/Documentation/git-send-pack.txt
+++ b/Documentation/git-send-pack.txt
@@ -3,38 +3,51 @@
 
 NAME
 ----
-git-send-pack - Push missing objects packed
+git-send-pack - Push objects over git protocol to another reposiotory
 
 
 SYNOPSIS
 --------
-'git-send-pack' [--all] [--force] [--exec=<git-receive-pack>] [<host>:]<directory> [<ref>...]
+'git-send-pack' [--all] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]
 
 DESCRIPTION
 -----------
+Usually you would want to use gitlink:git-push[1] which is a
+higher level wrapper of this command instead.
+
 Invokes 'git-receive-pack' on a possibly remote repository, and
 updates it from the current repository, sending named refs.
 
 
 OPTIONS
 -------
---exec=<git-receive-pack>::
+\--receive-pack=<git-receive-pack>::
 	Path to the 'git-receive-pack' program on the remote
 	end.  Sometimes useful when pushing to a remote
 	repository over ssh, and you do not have the program in
 	a directory on the default $PATH.
 
---all::
+\--exec=<git-receive-pack>::
+	Same as \--receive-pack=<git-receive-pack>.
+
+\--all::
 	Instead of explicitly specifying which refs to update,
 	update all refs that locally exist.
 
---force::
+\--force::
 	Usually, the command refuses to update a remote ref that
 	is not an ancestor of the local ref used to overwrite it.
 	This flag disables the check.  What this means is that
 	the remote repository can lose commits; use it with
 	care.
 
+\--verbose::
+	Run verbosely.
+
+\--thin::
+	Spend extra cycles to minimize the number of objects to be sent.
+	Use it on slower connection.
+
 <host>::
 	A remote host to house the repository.  When this
 	part is specified, 'git-receive-pack' is invoked via
diff --git a/Documentation/git-sh-setup.txt b/Documentation/git-sh-setup.txt
index 79217d8..2b2abeb 100644
--- a/Documentation/git-sh-setup.txt
+++ b/Documentation/git-sh-setup.txt
@@ -12,14 +12,51 @@
 DESCRIPTION
 -----------
 
-Sets up the normal git environment variables and a few helper functions
-(currently just "die()"), and returns OK if it all looks like a git archive.
-So, to make the rest of the git scripts more careful and readable,
-use it as follows:
+This is not a command the end user would want to run.  Ever.
+This documentation is meant for people who are studying the
+Porcelain-ish scripts and/or are writing new ones.
 
--------------------------------------------------
-. git-sh-setup || die "Not a git archive"
--------------------------------------------------
+The `git-sh-setup` scriptlet is designed to be sourced (using
+`.`) by other shell scripts to set up some variables pointing at
+the normal git directories and a few helper shell functions.
+
+Before sourcing it, your script should set up a few variables;
+`USAGE` (and `LONG_USAGE`, if any) is used to define message
+given by `usage()` shell function.  `SUBDIRECTORY_OK` can be set
+if the script can run from a subdirectory of the working tree
+(some commands do not).
+
+The scriptlet sets `GIT_DIR` and `GIT_OBJECT_DIRECTORY` shell
+variables, but does *not* export them to the environment.
+
+FUNCTIONS
+---------
+
+die::
+	exit after emitting the supplied error message to the
+	standard error stream.
+
+usage::
+	die with the usage message.
+
+set_reflog_action::
+	set the message that will be recorded to describe the
+	end-user action in the reflog, when the script updates a
+	ref.
+
+is_bare_repository::
+	outputs `true` or `false` to the standard output stream
+	to indicate if the repository is a bare repository
+	(i.e. without an associated working tree).
+
+cd_to_toplevel::
+	runs chdir to the toplevel of the working tree.
+
+require_work_tree::
+	checks if the repository is a bare repository, and dies
+	if so.  Used by scripts that require working tree
+	(e.g. `checkout`).
+
 
 Author
 ------
diff --git a/Documentation/git-shell.txt b/Documentation/git-shell.txt
index cc4266d..228b9f1 100644
--- a/Documentation/git-shell.txt
+++ b/Documentation/git-shell.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-shell - Restricted login shell for GIT over SSH only
+git-shell - Restricted login shell for GIT-only SSH access
 
 
 SYNOPSIS
diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
index 95fa901..b0df92e 100644
--- a/Documentation/git-shortlog.txt
+++ b/Documentation/git-shortlog.txt
@@ -29,7 +29,7 @@
 	of author alphabetic order.
 
 -s::
-	Supress commit description and provide a commit count summary only.
+	Suppress commit description and provide a commit count summary only.
 
 FILES
 -----
diff --git a/Documentation/git-show-branch.txt b/Documentation/git-show-branch.txt
index 912e15b..b38633c 100644
--- a/Documentation/git-show-branch.txt
+++ b/Documentation/git-show-branch.txt
@@ -11,7 +11,7 @@
 'git-show-branch' [--all] [--remotes] [--topo-order] [--current]
 		[--more=<n> | --list | --independent | --merge-base]
 		[--no-name | --sha1-name] [--topics] [<rev> | <glob>]...
-'git-show-branch' --reflog[=<n>] <ref>
+'git-show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] <ref>
 
 DESCRIPTION
 -----------
@@ -97,9 +97,11 @@
 	will show the revisions given by "git rev-list {caret}master
 	topic1 topic2"
 
---reflog[=<n>] <ref>::
-	Shows <n> most recent ref-log entries for the given ref.
-
+--reflog[=<n>[,<base>]] <ref>::
+	Shows <n> most recent ref-log entries for the given
+	ref.  If <base> is given, <n> entries going back from
+	that entry.  <base> can be specified as count or date.
+	`-g` can be used as a short-hand for this option.
 
 Note that --more, --list, --independent and --merge-base options
 are mutually exclusive.
@@ -165,6 +167,13 @@
 only the primary branches.  In addition, if you happen to be on
 your topic branch, it is shown as well.
 
+------------
+$ git show-branch --reflog='10,1 hour ago' --list master
+------------
+
+shows 10 reflog entries going back from the tip as of 1 hour ago.
+Without `--list`, the output also shows how these tips are
+topologically related with each other.
 
 
 Author
diff --git a/Documentation/git-show.txt b/Documentation/git-show.txt
index c210b9a..9051951 100644
--- a/Documentation/git-show.txt
+++ b/Documentation/git-show.txt
@@ -32,6 +32,8 @@
 -------
 <object>::
 	The name of the object to show.
+	For a more complete list of ways to spell object names, see
+	"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
 
 include::pretty-formats.txt[]
 
diff --git a/Documentation/git-ssh-fetch.txt b/Documentation/git-ssh-fetch.txt
index b7116b3..192b1f1 100644
--- a/Documentation/git-ssh-fetch.txt
+++ b/Documentation/git-ssh-fetch.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-ssh-fetch - Pulls from a remote repository over ssh connection
+git-ssh-fetch - Fetch from a remote repository over ssh connection
 
 
 
diff --git a/Documentation/git-ssh-upload.txt b/Documentation/git-ssh-upload.txt
index 702674e..a9b7e9f 100644
--- a/Documentation/git-ssh-upload.txt
+++ b/Documentation/git-ssh-upload.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-ssh-upload - Pushes to a remote repository over ssh connection
+git-ssh-upload - Push to a remote repository over ssh connection
 
 
 SYNOPSIS
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index ce7857e..03871e5 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-status - Show working tree status
+git-status - Show the working tree status
 
 
 SYNOPSIS
@@ -34,6 +34,15 @@
 template comments, and all the output lines are prefixed with '#'.
 
 
+CONFIGURATION
+-------------
+
+The command honors `color.status` (or `status.color` -- they
+mean the same thing and the latter is kept for backward
+compatibility) and `color.status.<slot>` configuration variables
+to colorize its output.
+
+
 Author
 ------
 Written by Linus Torvalds <torvalds@osdl.org> and
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 9ed7211..aea4a6b 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-svn - bidirectional operation between Subversion and git
+git-svn - Bidirectional operation between a single Subversion branch and git
 
 SYNOPSIS
 --------
@@ -113,7 +113,7 @@
 
 'commit-diff'::
 	Commits the diff of two tree-ish arguments from the
-	command-line.  This command is intended for interopability with
+	command-line.  This command is intended for interoperability with
 	git-svnimport and does not rely on being inside an git-svn
 	init-ed repository.  This command takes three arguments, (a) the
 	original tree to diff against, (b) the new tree result, (c) the
@@ -204,7 +204,7 @@
 cannot version empty directories.  Enabling this flag will make
 the commit to SVN act like git.
 
-repo-config key: svn.rmdir
+config key: svn.rmdir
 
 -e::
 --edit::
@@ -215,7 +215,7 @@
 default for objects that are commits, and forced on when committing
 tree objects.
 
-repo-config key: svn.edit
+config key: svn.edit
 
 -l<num>::
 --find-copies-harder::
@@ -226,8 +226,8 @@
 gitlink:git-diff-tree[1] for more information.
 
 [verse]
-repo-config key: svn.l
-repo-config key: svn.findcopiesharder
+config key: svn.l
+config key: svn.findcopiesharder
 
 -A<filename>::
 --authors-file=<filename>::
@@ -245,7 +245,7 @@
 appropriate entry.  Re-running the previous git-svn command
 after the authors-file is modified should continue operation.
 
-repo-config key: svn.authorsfile
+config key: svn.authorsfile
 
 -q::
 --quiet::
@@ -262,8 +262,8 @@
 
 	--repack-flags are passed directly to gitlink:git-repack[1].
 
-repo-config key: svn.repack
-repo-config key: svn.repackflags
+config key: svn.repack
+config key: svn.repackflags
 
 -m::
 --merge::
@@ -304,7 +304,7 @@
 This option may be specified multiple times, once for each
 branch.
 
-repo-config key: svn.branch
+config key: svn.branch
 
 -i<GIT_SVN_ID>::
 --id <GIT_SVN_ID>::
@@ -320,7 +320,7 @@
 	started tracking a branch and never tracked the trunk it was
 	descended from.
 
-repo-config key: svn.followparent
+config key: svn.followparent
 
 --no-metadata::
 	This gets rid of the git-svn-id: lines at the end of every commit.
@@ -332,7 +332,7 @@
 	The 'git-svn log' command will not work on repositories using this,
 	either.
 
-repo-config key: svn.nometadata
+config key: svn.nometadata
 
 --
 
diff --git a/Documentation/git-symbolic-ref.txt b/Documentation/git-symbolic-ref.txt
index 4bc35a1..f93b79a 100644
--- a/Documentation/git-symbolic-ref.txt
+++ b/Documentation/git-symbolic-ref.txt
@@ -3,11 +3,11 @@
 
 NAME
 ----
-git-symbolic-ref - read and modify symbolic refs
+git-symbolic-ref - Read and modify symbolic refs
 
 SYNOPSIS
 --------
-'git-symbolic-ref' <name> [<ref>]
+'git-symbolic-ref' [-q] <name> [<ref>]
 
 DESCRIPTION
 -----------
@@ -23,6 +23,14 @@
 begins with `ref: refs/`.  For example, your `.git/HEAD` is
 a regular file whose contents is `ref: refs/heads/master`.
 
+OPTIONS
+-------
+
+-q::
+	Do not issue an error message if the <name> is not a
+	symbolic ref but a detached HEAD; instead exit with
+	non-zero status silently.
+
 NOTES
 -----
 In the past, `.git/HEAD` was a symbolic link pointing at
@@ -36,6 +44,10 @@
 advertised (horrors).  Therefore symbolic links are now deprecated
 and symbolic refs are used by default.
 
+git-symbolic-ref will exit with status 0 if the contents of the
+symbolic ref were printed correctly, with status 1 if the requested
+name is not a symbolic ref, or 128 if another error occurs.
+
 Author
 ------
 Written by Junio C Hamano <junkio@cox.net>
diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
index 80bece0..3f01e0b 100644
--- a/Documentation/git-tag.txt
+++ b/Documentation/git-tag.txt
@@ -3,14 +3,14 @@
 
 NAME
 ----
-git-tag - Create a tag object signed with GPG
+git-tag - Create, list, delete or verify a tag object signed with GPG
 
 
 SYNOPSIS
 --------
 [verse]
-'git-tag' [-a | -s | -u <key-id>] [-f | -d | -v] [-m <msg> | -F <file>]
-	 <name> [<head>]
+'git-tag' [-a | -s | -u <key-id>] [-f | -v] [-m <msg> | -F <file>]  <name> [<head>]
+'git-tag' -d <name>...
 'git-tag' -l [<pattern>]
 
 DESCRIPTION
@@ -55,7 +55,7 @@
 	Replace an existing tag with the given name (instead of failing)
 
 -d::
-	Delete an existing tag with the given name
+	Delete existing tags with the given names.
 
 -v::
 	Verify the gpg signature of given the tag
@@ -70,6 +70,16 @@
 	Take the tag message from the given file.  Use '-' to
 	read the message from the standard input.
 
+CONFIGURATION
+-------------
+By default, git-tag in sign-with-default mode (-s) will use your
+committer identity (of the form "Your Name <your@email.address>") to
+find a key.  If you want to use a different default key, you can specify
+it in the repository configuration as follows:
+
+[user]
+    signingkey = <gpg-key-id>
+
 Author
 ------
 Written by Linus Torvalds <torvalds@osdl.org>,
diff --git a/Documentation/git-tar-tree.txt b/Documentation/git-tar-tree.txt
index 74a6fdd..5959405 100644
--- a/Documentation/git-tar-tree.txt
+++ b/Documentation/git-tar-tree.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-tar-tree - Creates a tar archive of the files in the named tree
+git-tar-tree - Create a tar archive of the files in the named tree object
 
 
 SYNOPSIS
@@ -50,7 +50,7 @@
         umask = 002	;# group friendly
 
 The special umask value "user" indicates that the user's current umask
-will be used instead. The default value remains 0, which means world
+will be used instead.  The default value is 002, which means group
 readable/writable files and directories.
 
 EXAMPLES
diff --git a/Documentation/git-tools.txt b/Documentation/git-tools.txt
index 0914cbb..6b407f9 100644
--- a/Documentation/git-tools.txt
+++ b/Documentation/git-tools.txt
@@ -50,7 +50,7 @@
    gitview is a GTK based repository browser for git
 
 
-   - *gitweb* (ftp://ftp.kernel.org/pub/software/scm/gitweb/)
+   - *gitweb* (shipped with git-core)
 
    GITweb provides full-fledged web interface for GIT repositories.
 
@@ -63,12 +63,18 @@
    Currently it is the fastest and most feature rich among the git
    viewers and commit tools.
 
+   - *tig* (http://jonas.nitro.dk/tig/)
+
+   tig by Jonas Fonseca is a simple git repository browser
+   written using ncurses. Basically, it just acts as a front-end
+   for git-log and git-show/git-diff. Additionally, you can also
+   use it as a pager for git commands.
 
 
 Foreign SCM interface
 ---------------------
 
-   - *git-svn* (contrib/)
+   - *git-svn* (shipped with git-core)
 
    git-svn is a simple conduit for changesets between a single Subversion
    branch and git.
@@ -95,3 +101,7 @@
    This is an Emacs interface for git. The user interface is modeled on
    pcl-cvs. It has been developed on Emacs 21 and will probably need some
    tweaking to work on XEmacs.
+
+
+http://git.or.cz/gitwiki/InterfacesFrontendsAndTools has more
+comprehensive list.
diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
index 0e0a3af..b161c8b 100644
--- a/Documentation/git-update-index.txt
+++ b/Documentation/git-update-index.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-update-index - Modifies the index or directory cache
+git-update-index - Register file contents in the working tree to the index
 
 
 SYNOPSIS
@@ -289,7 +289,7 @@
 
 The command honors `core.filemode` configuration variable.  If
 your repository is on an filesystem whose executable bits are
-unreliable, this should be set to 'false' (see gitlink:git-repo-config[1]).
+unreliable, this should be set to 'false' (see gitlink:git-config[1]).
 This causes the command to ignore differences in file modes recorded
 in the index and the file mode on the filesystem if they differ only on
 executable bit.   On such an unfortunate filesystem, you may
@@ -301,7 +301,7 @@
 
 See Also
 --------
-gitlink:git-repo-config[1]
+gitlink:git-config[1]
 
 
 Author
diff --git a/Documentation/git-update-ref.txt b/Documentation/git-update-ref.txt
index 71bcb79..9424fea 100644
--- a/Documentation/git-update-ref.txt
+++ b/Documentation/git-update-ref.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-update-ref - update the object name stored in a ref safely
+git-update-ref - Update the object name stored in a ref safely
 
 SYNOPSIS
 --------
diff --git a/Documentation/git-upload-archive.txt b/Documentation/git-upload-archive.txt
index 388bb53..403871d 100644
--- a/Documentation/git-upload-archive.txt
+++ b/Documentation/git-upload-archive.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-upload-archive - Send archive
+git-upload-archive - Send archive back to git-archive
 
 
 SYNOPSIS
diff --git a/Documentation/git-upload-pack.txt b/Documentation/git-upload-pack.txt
index b2c9307..9da062d 100644
--- a/Documentation/git-upload-pack.txt
+++ b/Documentation/git-upload-pack.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-upload-pack - Send missing objects packed
+git-upload-pack - Send objects packed back to git-fetch-pack
 
 
 SYNOPSIS
diff --git a/Documentation/git-var.txt b/Documentation/git-var.txt
index a5b1a0d..9b0de1c 100644
--- a/Documentation/git-var.txt
+++ b/Documentation/git-var.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-var - Print the git users identity
+git-var - Show a git logical variable
 
 
 SYNOPSIS
@@ -20,7 +20,7 @@
 	Cause the logical variables to be listed. In addition, all the
 	variables of the git configuration file .git/config are listed
 	as well. (However, the configuration variables listing functionality
-	is deprecated in favor of `git-repo-config -l`.)
+	is deprecated in favor of `git-config -l`.)
 
 EXAMPLE
 --------
@@ -49,7 +49,7 @@
 --------
 gitlink:git-commit-tree[1]
 gitlink:git-tag[1]
-gitlink:git-repo-config[1]
+gitlink:git-config[1]
 
 Author
 ------
diff --git a/Documentation/git-whatchanged.txt b/Documentation/git-whatchanged.txt
index e8f21d0..399bff3 100644
--- a/Documentation/git-whatchanged.txt
+++ b/Documentation/git-whatchanged.txt
@@ -27,7 +27,7 @@
 	output format that is useful only to tell the changed
 	paths and their nature of changes.
 
---max-count=<n>::
+-<n>::
 	Limit output to <n> commits.
 
 <since>..<until>::
diff --git a/Documentation/git-write-tree.txt b/Documentation/git-write-tree.txt
index c85fa89..96d5e07 100644
--- a/Documentation/git-write-tree.txt
+++ b/Documentation/git-write-tree.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-git-write-tree - Creates a tree object from the current index
+git-write-tree - Create a tree object from the current index
 
 
 SYNOPSIS
diff --git a/Documentation/git.txt b/Documentation/git.txt
index f89d745..7cd3467 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -24,7 +24,7 @@
 also want to read link:cvs-migration.html[CVS migration].
 
 The COMMAND is either a name of a Git command (see below) or an alias
-as defined in the configuration file (see gitlink:git-repo-config[1]).
+as defined in the configuration file (see gitlink:git-config[1]).
 
 OPTIONS
 -------
@@ -81,244 +81,26 @@
 Main porcelain commands
 ~~~~~~~~~~~~~~~~~~~~~~~
 
-gitlink:git-add[1]::
-	Add paths to the index.
-
-gitlink:git-am[1]::
-	Apply patches from a mailbox, but cooler.
-
-gitlink:git-applymbox[1]::
-	Apply patches from a mailbox, original version by Linus.
-
-gitlink:git-archive[1]::
-	Creates an archive of files from a named tree.
-
-gitlink:git-bisect[1]::
-	Find the change that introduced a bug by binary search.
-
-gitlink:git-branch[1]::
-	Create and Show branches.
-
-gitlink:git-checkout[1]::
-	Checkout and switch to a branch.
-
-gitlink:git-cherry-pick[1]::
-	Cherry-pick the effect of an existing commit.
-
-gitlink:git-clean[1]::
-	Remove untracked files from the working tree.
-
-gitlink:git-clone[1]::
-	Clones a repository into a new directory.
-
-gitlink:git-commit[1]::
-	Record changes to the repository.
-
-gitlink:git-diff[1]::
-	Show changes between commits, commit and working tree, etc.
-
-gitlink:git-fetch[1]::
-	Download from a remote repository via various protocols.
-
-gitlink:git-format-patch[1]::
-	Prepare patches for e-mail submission.
-
-gitlink:git-grep[1]::
-	Print lines matching a pattern.
-
-gitlink:gitk[1]::
-	The git repository browser.
-
-gitlink:git-log[1]::
-	Shows commit logs.
-
-gitlink:git-ls-remote[1]::
-	Shows references in a remote or local repository.
-
-gitlink:git-merge[1]::
-	Grand unified merge driver.
-
-gitlink:git-mv[1]::
-	Move or rename a file, a directory, or a symlink.
-
-gitlink:git-pack-refs[1]::
-	Pack heads and tags for efficient repository access.
-
-gitlink:git-pull[1]::
-	Fetch from and merge with a remote repository or a local branch.
-
-gitlink:git-push[1]::
-	Update remote refs along with associated objects.
-
-gitlink:git-rebase[1]::
-	Rebase local commits to the updated upstream head.
-
-gitlink:git-repack[1]::
-	Pack unpacked objects in a repository.
-
-gitlink:git-rerere[1]::
-	Reuse recorded resolution of conflicted merges.
-
-gitlink:git-reset[1]::
-	Reset current HEAD to the specified state.
-
-gitlink:git-resolve[1]::
-	Merge two commits.
-
-gitlink:git-revert[1]::
-	Revert an existing commit.
-
-gitlink:git-rm[1]::
-	Remove files from the working tree and from the index.
-
-gitlink:git-shortlog[1]::
-	Summarizes 'git log' output.
-
-gitlink:git-show[1]::
-	Show one commit log and its diff.
-
-gitlink:git-show-branch[1]::
-	Show branches and their commits.
-
-gitlink:git-status[1]::
-	Shows the working tree status.
-
-gitlink:git-verify-tag[1]::
-	Check the GPG signature of tag.
-
-gitlink:git-whatchanged[1]::
-	Shows commit logs and differences they introduce.
-
+include::cmds-mainporcelain.txt[]
 
 Ancillary Commands
 ~~~~~~~~~~~~~~~~~~
 Manipulators:
 
-gitlink:git-applypatch[1]::
-	Apply one patch extracted from an e-mail.
-
-gitlink:git-archimport[1]::
-	Import an arch repository into git.
-
-gitlink:git-convert-objects[1]::
-	Converts old-style git repository.
-
-gitlink:git-cvsimport[1]::
-	Salvage your data out of another SCM people love to hate.
-
-gitlink:git-cvsexportcommit[1]::
-	Export a single commit to a CVS checkout.
-
-gitlink:git-cvsserver[1]::
-	A CVS server emulator for git.
-
-gitlink:git-gc[1]::
-	Cleanup unnecessary files and optimize the local repository.
-
-gitlink:git-lost-found[1]::
-	Recover lost refs that luckily have not yet been pruned.
-
-gitlink:git-merge-one-file[1]::
-	The standard helper program to use with `git-merge-index`.
-
-gitlink:git-prune[1]::
-	Prunes all unreachable objects from the object database.
-
-gitlink:git-quiltimport[1]::
-	Applies a quilt patchset onto the current branch.
-
-gitlink:git-reflog[1]::
-	Manage reflog information.
-
-gitlink:git-relink[1]::
-	Hardlink common objects in local repositories.
-
-gitlink:git-svn[1]::
-	Bidirectional operation between a single Subversion branch and git.
-
-gitlink:git-svnimport[1]::
-	Import a SVN repository into git.
-
-gitlink:git-sh-setup[1]::
-	Common git shell script setup code.
-
-gitlink:git-symbolic-ref[1]::
-	Read and modify symbolic refs.
-
-gitlink:git-tag[1]::
-	An example script to create a tag object signed with GPG.
-
-gitlink:git-update-ref[1]::
-	Update the object name stored in a ref safely.
-
+include::cmds-ancillarymanipulators.txt[]
 
 Interrogators:
 
-gitlink:git-annotate[1]::
-	Annotate file lines with commit info.
+include::cmds-ancillaryinterrogators.txt[]
 
-gitlink:git-blame[1]::
-	Find out where each line in a file came from.
 
-gitlink:git-check-ref-format[1]::
-	Make sure ref name is well formed.
+Interacting with Others
+~~~~~~~~~~~~~~~~~~~~~~~
 
-gitlink:git-cherry[1]::
-	Find commits not merged upstream.
+These commands are to interact with foreign SCM and with other
+people via patch over e-mail.
 
-gitlink:git-count-objects[1]::
-	Count unpacked number of objects and their disk consumption.
-
-gitlink:git-daemon[1]::
-	A really simple server for git repositories.
-
-gitlink:git-fmt-merge-msg[1]::
-	Produce a merge commit message.
-
-gitlink:git-get-tar-commit-id[1]::
-	Extract commit ID from an archive created using git-tar-tree.
-
-gitlink:git-imap-send[1]::
-	Dump a mailbox from stdin into an imap folder.
-
-gitlink:git-instaweb[1]::
-	Instantly browse your working repository in gitweb.
-
-gitlink:git-mailinfo[1]::
-	Extracts patch and authorship information from a single
-	e-mail message, optionally transliterating the commit
-	message into utf-8.
-
-gitlink:git-mailsplit[1]::
-	A stupid program to split UNIX mbox format mailbox into
-	individual pieces of e-mail.
-
-gitlink:git-merge-tree[1]::
-	Show three-way merge without touching index.
-
-gitlink:git-patch-id[1]::
-	Compute unique ID for a patch.
-
-gitlink:git-parse-remote[1]::
-	Routines to help parsing `$GIT_DIR/remotes/` files.
-
-gitlink:git-request-pull[1]::
-	git-request-pull.
-
-gitlink:git-rev-parse[1]::
-	Pick out and massage parameters.
-
-gitlink:git-runstatus[1]::
-	A helper for git-status and git-commit.
-
-gitlink:git-send-email[1]::
-	Send patch e-mails out of "format-patch --mbox" output.
-
-gitlink:git-symbolic-ref[1]::
-	Read and modify symbolic refs.
-
-gitlink:git-stripspace[1]::
-	Filter out empty lines.
+include::cmds-foreignscminterface.txt[]
 
 
 Low-level commands (plumbing)
@@ -330,129 +112,30 @@
 might start by reading about gitlink:git-update-index[1] and
 gitlink:git-read-tree[1].
 
-We divide the low-level commands into commands that manipulate objects (in
+The interface (input, output, set of options and the semantics)
+to these low-level commands are meant to be a lot more stable
+than Porcelain level commands, because these commands are
+primarily for scripted use.  The interface to Porcelain commands
+on the other hand are subject to change in order to improve the
+end user experience.
+
+The following description divides
+the low-level commands into commands that manipulate objects (in
 the repository, index, and working tree), commands that interrogate and
 compare objects, and commands that move objects and references between
 repositories.
 
+
 Manipulation commands
 ~~~~~~~~~~~~~~~~~~~~~
-gitlink:git-apply[1]::
-	Reads a "diff -up1" or git generated patch file and
-	applies it to the working tree.
 
-gitlink:git-checkout-index[1]::
-	Copy files from the index to the working tree.
-
-gitlink:git-commit-tree[1]::
-	Creates a new commit object.
-
-gitlink:git-hash-object[1]::
-	Computes the object ID from a file.
-
-gitlink:git-index-pack[1]::
-	Build pack idx file for an existing packed archive.
-
-gitlink:git-init[1]::
-	Creates an empty git repository, or reinitialize an
-	existing one.
-
-gitlink:git-merge-file[1]::
-	Runs a threeway merge.
-
-gitlink:git-merge-index[1]::
-	Runs a merge for files needing merging.
-
-gitlink:git-mktag[1]::
-	Creates a tag object.
-
-gitlink:git-mktree[1]::
-	Build a tree-object from ls-tree formatted text.
-
-gitlink:git-pack-objects[1]::
-	Creates a packed archive of objects.
-
-gitlink:git-prune-packed[1]::
-	Remove extra objects that are already in pack files.
-
-gitlink:git-read-tree[1]::
-	Reads tree information into the index.
-
-gitlink:git-repo-config[1]::
-	Get and set options in .git/config.
-
-gitlink:git-unpack-objects[1]::
-	Unpacks objects out of a packed archive.
-
-gitlink:git-update-index[1]::
-	Registers files in the working tree to the index.
-
-gitlink:git-write-tree[1]::
-	Creates a tree from the index.
+include::cmds-plumbingmanipulators.txt[]
 
 
 Interrogation commands
 ~~~~~~~~~~~~~~~~~~~~~~
 
-gitlink:git-cat-file[1]::
-	Provide content or type/size information for repository objects.
-
-gitlink:git-describe[1]::
-	Show the most recent tag that is reachable from a commit.
-
-gitlink:git-diff-index[1]::
-	Compares content and mode of blobs between the index and repository.
-
-gitlink:git-diff-files[1]::
-	Compares files in the working tree and the index.
-
-gitlink:git-diff-stages[1]::
-	Compares two "merge stages" in the index.
-
-gitlink:git-diff-tree[1]::
-	Compares the content and mode of blobs found via two tree objects.
-
-gitlink:git-for-each-ref[1]::
-	Output information on each ref.
-
-gitlink:git-fsck-objects[1]::
-	Verifies the connectivity and validity of the objects in the database.
-
-gitlink:git-ls-files[1]::
-	Information about files in the index and the working tree.
-
-gitlink:git-ls-tree[1]::
-	Displays a tree object in human readable form.
-
-gitlink:git-merge-base[1]::
-	Finds as good common ancestors as possible for a merge.
-
-gitlink:git-name-rev[1]::
-	Find symbolic names for given revs.
-
-gitlink:git-pack-redundant[1]::
-	Find redundant pack files.
-
-gitlink:git-rev-list[1]::
-	Lists commit objects in reverse chronological order.
-
-gitlink:git-show-index[1]::
-	Displays contents of a pack idx file.
-
-gitlink:git-show-ref[1]::
-	List references in a local repository.
-
-gitlink:git-tar-tree[1]::
-	Creates a tar archive of the files in the named tree object.
-
-gitlink:git-unpack-file[1]::
-	Creates a temporary file with a blob's contents.
-
-gitlink:git-var[1]::
-	Displays a git logical variable.
-
-gitlink:git-verify-pack[1]::
-	Validates packed git archive files.
+include::cmds-plumbinginterrogators.txt[]
 
 In general, the interrogate commands do not touch the files in
 the working tree.
@@ -461,52 +144,21 @@
 Synching repositories
 ~~~~~~~~~~~~~~~~~~~~~
 
-gitlink:git-fetch-pack[1]::
-	Updates from a remote repository (engine for ssh and
-	local transport).
+include::cmds-synchingrepositories.txt[]
 
-gitlink:git-http-fetch[1]::
-	Downloads a remote git repository via HTTP by walking
-	commit chain.
+The following are helper programs used by the above; end users
+typically do not use them directly.
 
-gitlink:git-local-fetch[1]::
-	Duplicates another git repository on a local system by
-	walking commit chain.
+include::cmds-synchelpers.txt[]
 
-gitlink:git-peek-remote[1]::
-	Lists references on a remote repository using
-	upload-pack protocol (engine for ssh and local
-	transport).
 
-gitlink:git-receive-pack[1]::
-	Invoked by 'git-send-pack' to receive what is pushed to it.
+Internal helper commands
+~~~~~~~~~~~~~~~~~~~~~~~~
 
-gitlink:git-send-pack[1]::
-	Pushes to a remote repository, intelligently.
+These are internal helper commands used by other commands; end
+users typically do not use them directly.
 
-gitlink:git-http-push[1]::
-	Push missing objects using HTTP/DAV.
-
-gitlink:git-shell[1]::
-	Restricted shell for GIT-only SSH access.
-
-gitlink:git-ssh-fetch[1]::
-	Pulls from a remote repository over ssh connection by
-	walking commit chain.
-
-gitlink:git-ssh-upload[1]::
-	Helper "server-side" program used by git-ssh-fetch.
-
-gitlink:git-update-server-info[1]::
-	Updates auxiliary information on a dumb server to help
-	clients discover references and packs on it.
-
-gitlink:git-upload-archive[1]::
-	Invoked by 'git-archive' to send a generated archive.
-
-gitlink:git-upload-pack[1]::
-	Invoked by 'git-fetch-pack' to push
-	what are asked for.
+include::cmds-purehelpers.txt[]
 
 
 Configuration Mechanism
@@ -699,7 +351,7 @@
 
 Discussion[[Discussion]]
 ------------------------
-include::README[]
+include::core-intro.txt[]
 
 Authors
 -------
diff --git a/Documentation/gitk.txt b/Documentation/gitk.txt
index f1aeb07..5bdaa60 100644
--- a/Documentation/gitk.txt
+++ b/Documentation/gitk.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-gitk - git repository browser
+gitk - The git repository browser
 
 SYNOPSIS
 --------
@@ -47,6 +47,8 @@
 	meaning show from the given revision and back, or it can be a range in
 	the form "'<from>'..'<to>'" to show all revisions between '<from>' and
 	back to '<to>'. Note, more advanced revision selection can be applied.
+	For a more complete list of ways to spell object names, see
+	"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
 
 <path>::
 
diff --git a/Documentation/glossary.txt b/Documentation/glossary.txt
index bc917bb..d20eb62 100644
--- a/Documentation/glossary.txt
+++ b/Documentation/glossary.txt
@@ -286,6 +286,18 @@
 SHA1::
 	Synonym for object name.
 
+shallow repository::
+	A shallow repository has an incomplete history some of
+	whose commits have parents cauterized away (in other
+	words, git is told to pretend that these commits do not
+	have the parents, even though they are recorded in the
+	commit object).  This is sometimes useful when you are
+	interested only in the recent history of a project even
+	though the real history recorded in the upstream is
+	much larger.  A shallow repository is created by giving
+	`--depth` option to gitlink:git-clone[1], and its
+	history can be later deepened with gitlink:git-fetch[1].
+
 symref::
 	Symbolic reference: instead of containing the SHA1 id itself, it
 	is of the format 'ref: refs/some/thing' and when referenced, it
diff --git a/Documentation/howto/dangling-objects.txt b/Documentation/howto/dangling-objects.txt
new file mode 100644
index 0000000..e82ddae
--- /dev/null
+++ b/Documentation/howto/dangling-objects.txt
@@ -0,0 +1,109 @@
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Subject: Re: Question about fsck-objects output
+Date: Thu, 25 Jan 2007 12:01:06 -0800 (PST)
+Message-ID: <Pine.LNX.4.64.0701251144290.25027@woody.linux-foundation.org>
+Archived-At: <http://permalink.gmane.org/gmane.comp.version-control.git/37754>
+Abstract: Linus describes what dangling objects are, when they
+ are left behind, and how to view their relationship with branch
+ heads in gitk
+
+On Thu, 25 Jan 2007, Larry Streepy wrote:
+
+> Sorry to ask such a basic question, but I can't quite decipher the output of
+> fsck-objects.  When I run it, I get this:
+>
+>  git fsck-objects
+> dangling commit 2213f6d4dd39ca8baebd0427723723e63208521b
+> dangling commit f0d4e00196bd5ee54463e9ea7a0f0e8303da767f
+> dangling blob 6a6d0b01b3e96d49a8f2c7addd4ef8c3bd1f5761
+>
+>
+> Even after a "repack -a -d" they still exist.  The man page has a short
+> explanation, but, at least for me, it wasn't fully enlightening. :-)
+>
+> The man page says that dangling commits could be "root" commits, but since my
+> repo started as a clone of another repo, I don't see how I could have any root
+> commits.  Also, the page doesn't really describe what a dangling blob is.
+>
+> So, can someone explain what these artifacts are and if they are a problem
+> that I should be worried about?
+
+The most common situation is that you've rebased a branch (or you have
+pulled from somebody else who rebased a branch, like the "pu" branch in
+the git.git archive itself).
+
+What happens is that the old head of the original branch still exists, as
+does obviously everything it pointed to. The branch pointer itself just
+doesn't, since you replaced it with another one.
+
+However, there are certainly other situations too that cause dangling
+objects. For example, the "dangling blob" situation you have tends to be
+because you did a "git add" of a file, but then, before you actually
+committed it and made it part of the bigger picture, you changed something
+else in that file and committed that *updated* thing - the old state that
+you added originally ends up not being pointed to by any commit/tree, so
+it's now a dangling blob object.
+
+Similarly, when the "recursive" merge strategy runs, and finds that there
+are criss-cross merges and thus more than one merge base (which is fairly
+unusual, but it does happen), it will generate one temporary midway tree
+(or possibly even more, if you had lots of criss-crossing merges and
+more than two merge bases) as a temporary internal merge base, and again,
+those are real objects, but the end result will not end up pointing to
+them, so they end up "dangling" in your repository.
+
+Generally, dangling objects aren't anything to worry about. They can even
+be very useful: if you screw something up, the dangling objects can be how
+you recover your old tree (say, you did a rebase, and realized that you
+really didn't want to - you can look at what dangling objects you have,
+and decide to reset your head to some old dangling state).
+
+For commits, the most useful thing to do with dangling objects tends to be
+to do a simple
+
+	gitk <dangling-commit-sha-goes-here> --not --all
+
+which means exactly what it sounds like: it says that you want to see the
+commit history that is described by the dangling commit(s), but you do NOT
+want to see the history that is described by all your branches and tags
+(which are the things you normally reach). That basically shows you in a
+nice way what the danglign commit was (and notice that it might not be
+just one commit: we only report the "tip of the line" as being dangling,
+but there might be a whole deep and complex commit history that has gotten
+dropped - rebasing will do that).
+
+For blobs and trees, you can't do the same, but you can examine them. You
+can just do
+
+	git show <dangling-blob/tree-sha-goes-here>
+
+to show what the contents of the blob were (or, for a tree, basically what
+the "ls" for that directory was), and that may give you some idea of what
+the operation was that left that dangling object.
+
+Usually, dangling blobs and trees aren't very interesting. They're almost
+always the result of either being a half-way mergebase (the blob will
+often even have the conflict markers from a merge in it, if you have had
+conflicting merges that you fixed up by hand), or simply because you
+interrupted a "git fetch" with ^C or something like that, leaving _some_
+of the new objects in the object database, but just dangling and useless.
+
+Anyway, once you are sure that you're not interested in any dangling
+state, you can just prune all unreachable objects:
+
+	git prune
+
+and they'll be gone. But you should only run "git prune" on a quiescent
+repository - it's kind of like doing a filesystem fsck recovery: you don't
+want to do that while the filesystem is mounted.
+
+(The same is true of "git-fsck-objects" itself, btw - but since
+git-fsck-objects never actually *changes* the repository, it just reports
+on what it found, git-fsck-objects itself is never "dangerous" to run.
+Running it while somebody is actually changing the repository can cause
+confusing and scary messages, but it won't actually do anything bad. In
+contrast, running "git prune" while somebody is actively changing the
+repository is a *BAD* idea).
+
+			Linus
+
diff --git a/Documentation/howto/rebase-from-internal-branch.txt b/Documentation/howto/rebase-from-internal-branch.txt
index fcd64e9..3b3a5c2 100644
--- a/Documentation/howto/rebase-from-internal-branch.txt
+++ b/Documentation/howto/rebase-from-internal-branch.txt
@@ -106,7 +106,7 @@
 
     $ git format-patch master^^ master
 
-This creates two files, 0001-XXXX.txt and 0002-XXXX.txt.  Send
+This creates two files, 0001-XXXX.patch and 0002-XXXX.patch.  Send
 them out "To: " your project maintainer and "Cc: " your mailing
 list.  You could use contributed script git-send-email if
 your host has necessary perl modules for this, but your usual
diff --git a/Documentation/howto/setup-git-server-over-http.txt b/Documentation/howto/setup-git-server-over-http.txt
index a202f3a..8eadc20 100644
--- a/Documentation/howto/setup-git-server-over-http.txt
+++ b/Documentation/howto/setup-git-server-over-http.txt
@@ -205,7 +205,7 @@
 Now, add the remote in your existing repository which contains the project
 you want to export:
 
-   $ git-repo-config remote.upload.url \
+   $ git-config remote.upload.url \
        http://<username>@<servername>/my-new-repo.git/
 
 It is important to put the last '/'; Without it, the server will send
@@ -222,7 +222,7 @@
 
 This pushes branch 'master' (which is assumed to be the branch you
 want to export) to repository called 'upload', which we previously
-defined with git-repo-config.
+defined with git-config.
 
 
 Troubleshooting:
diff --git a/Documentation/repository-layout.txt b/Documentation/repository-layout.txt
index 0fdd366..863cb67 100644
--- a/Documentation/repository-layout.txt
+++ b/Documentation/repository-layout.txt
@@ -18,6 +18,8 @@
 trees this way, for example.  A repository with this kind of
 incomplete object store is not suitable to be published to the
 outside world but sometimes useful for private repository.
+. You also could have an incomplete but locally usable repository
+by cloning shallowly.  See gitlink:git-clone[1].
 . You can be using `objects/info/alternates` mechanism, or
 `$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanism to 'borrow'
 objects from other object stores.  A repository with this kind
@@ -32,7 +34,7 @@
 	two letters from its object name to keep the number of
 	directory entries `objects` directory itself needs to
 	hold.  Objects found here are often called 'unpacked'
-	objects.
+	(or 'loose') objects.
 
 objects/pack::
 	Packs (files that store many object in compressed form,
@@ -80,6 +82,15 @@
 	records any object name (not necessarily a commit
 	object, or a tag object that points at a commit object).
 
+refs/remotes/`name`::
+	records tip-of-the-tree commit objects of branches copied
+	from a remote repository.
+
+packed-refs::
+	records the same information as refs/heads/, refs/tags/,
+	and friends record in a more efficient way.  See
+	gitlink:git-pack-refs[1].
+
 HEAD::
 	A symref (see glossary) to the `refs/heads/` namespace
 	describing the currently active branch.  It does not mean
@@ -91,6 +102,12 @@
 	'name' does not (yet) exist.  In some legacy setups, it is
 	a symbolic link instead of a symref that points at the current
 	branch.
++
+HEAD can also record a specific commit directly, instead of
+being a symref to point at the current branch.  Such a state
+is often called 'detached HEAD', and almost all commands work
+identically as normal.  See gitlink:git-checkout[1] for
+details.
 
 branches::
 	A slightly deprecated way to store shorthands to be used
@@ -156,3 +173,9 @@
 
 logs/refs/tags/`name`::
 	Records all changes made to the tag named `name`.
+
+shallow::
+	This is similar to `info/grafts` but is internally used
+	and maintained by shallow clone mechanism.  See `--depth`
+	option to gitlink:git-clone[1] and gitlink:git-fetch[1].
+
diff --git a/Documentation/tutorial-2.txt b/Documentation/tutorial-2.txt
index f48894c..f363d17 100644
--- a/Documentation/tutorial-2.txt
+++ b/Documentation/tutorial-2.txt
@@ -343,8 +343,8 @@
 current contents of the file:
 
 ------------------------------------------------
-$ git cat-file blob a6b11f7a
-goodbye, word
+$ git cat-file blob 8b9743b2
+goodbye, world
 ------------------------------------------------
 
 The "status" command is a useful way to get a quick summary of the
diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt
index d2bf0b9..adb1e32 100644
--- a/Documentation/tutorial.txt
+++ b/Documentation/tutorial.txt
@@ -11,15 +11,13 @@
 $ man git-diff
 ------------------------------------------------
 
-It is a good idea to introduce yourself to git before doing any
-operation.  The easiest way to do so is:
+It is a good idea to introduce yourself to git with your name and
+public email address before doing any operation.  The easiest
+way to do so is:
 
 ------------------------------------------------
-$ cat >~/.gitconfig <<\EOF
-[user]
-	name = Your Name Comes Here
-	email = you@yourdomain.example.com
-EOF
+$ git config --global user.name "Your Name Comes Here"
+$ git config --global user.email you@yourdomain.example.com
 ------------------------------------------------
 
 
@@ -211,7 +209,7 @@
 made in each.  To merge the changes made in experimental into master, run
 
 ------------------------------------------------
-$ git pull . experimental
+$ git merge experimental
 ------------------------------------------------
 
 If the changes don't conflict, you're done.  If there are conflicts,
@@ -297,46 +295,51 @@
 The "pull" command thus performs two operations: it fetches changes
 from a remote branch, then merges them into the current branch.
 
-You can perform the first operation alone using the "git fetch"
-command.  For example, Alice could create a temporary branch just to
-track Bob's changes, without merging them with her own, using:
+When you are working in a small closely knit group, it is not
+unusual to interact with the same repository over and over
+again.  By defining 'remote' repository shorthand, you can make
+it easier:
+
+------------------------------------------------
+$ git remote add bob /home/bob/myrepo
+------------------------------------------------
+
+With this, you can perform the first operation alone using the
+"git fetch" command without merging them with her own branch,
+using:
 
 -------------------------------------
-$ git fetch /home/bob/myrepo master:bob-incoming
+$ git fetch bob
 -------------------------------------
 
-which fetches the changes from Bob's master branch into a new branch
-named bob-incoming.  Then
+Unlike the longhand form, when Alice fetches from Bob using a
+remote repository shorthand set up with `git remote`, what was
+fetched is stored in a remote tracking branch, in this case
+`bob/master`.  So after this:
 
 -------------------------------------
-$ git log -p master..bob-incoming
+$ git log -p master..bob/master
 -------------------------------------
 
 shows a list of all the changes that Bob made since he branched from
 Alice's master branch.
 
-After examining those changes, and possibly fixing things, Alice
-could pull the changes into her master branch:
+After examining those changes, Alice
+could merge the changes into her master branch:
 
 -------------------------------------
-$ git checkout master
-$ git pull . bob-incoming
+$ git merge bob/master
 -------------------------------------
 
-The last command is a pull from the "bob-incoming" branch in Alice's
-own repository.
-
-Alice could also perform both steps at once with:
+This `merge` can also be done by 'pulling from her own remote
+tracking branch', like this:
 
 -------------------------------------
-$ git pull /home/bob/myrepo master:bob-incoming
+$ git pull . remotes/bob/master
 -------------------------------------
 
-This is just like the "git pull /home/bob/myrepo master" that we saw
-before, except that it also stores the unmerged changes from bob's
-master branch in bob-incoming before merging them into Alice's
-current branch.  Note that git pull always merges into the current
-branch, regardless of what else is given on the commandline.
+Note that git pull always merges into the current branch,
+regardless of what else is given on the commandline.
 
 Later, Bob can update his repo with Alice's latest changes using
 
@@ -350,12 +353,12 @@
 used for pulls:
 
 -------------------------------------
-$ git repo-config --get remote.origin.url
+$ git config --get remote.origin.url
 /home/bob/myrepo
 -------------------------------------
 
 (The complete configuration created by git-clone is visible using
-"git repo-config -l", and the gitlink:git-repo-config[1] man page
+"git config -l", and the gitlink:git-config[1] man page
 explains the meaning of each option.)
 
 Git also keeps a pristine copy of Alice's master branch under the
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 8502e4c..e0adc34 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.5.0-rc1.GIT
+DEF_VER=v1.5.0-rc2.GIT
 
 LF='
 '
diff --git a/Makefile b/Makefile
index 8432ab8..91bd665 100644
--- a/Makefile
+++ b/Makefile
@@ -192,7 +192,7 @@
 
 # ... and all the rest that could be moved out of bindir to gitexecdir
 PROGRAMS = \
-	git-convert-objects$X git-fetch-pack$X git-fsck-objects$X \
+	git-convert-objects$X git-fetch-pack$X git-fsck$X \
 	git-hash-object$X git-index-pack$X git-local-fetch$X \
 	git-merge-base$X \
 	git-daemon$X \
@@ -213,7 +213,8 @@
 
 BUILT_INS = \
 	git-format-patch$X git-show$X git-whatchanged$X git-cherry$X \
-	git-get-tar-commit-id$X git-init$X \
+	git-get-tar-commit-id$X git-init$X git-repo-config$X \
+	git-fsck-objects$X \
 	$(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
 
 # what 'all' will build and 'install' will install, in gitexecdir
@@ -241,7 +242,7 @@
 	diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \
 	run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
 	tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \
-	utf8.h
+	utf8.h reflog-walk.h
 
 DIFF_OBJS = \
 	diff.o diff-lib.o diffcore-break.o diffcore-order.o \
@@ -254,7 +255,7 @@
 	interpolate.o \
 	lockfile.o \
 	object.o pack-check.o patch-delta.o path.o pkt-line.o sideband.o \
-	reachable.o \
+	reachable.o reflog-walk.o \
 	quote.o read-cache.o refs.o run-command.o dir.o object-refs.o \
 	server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
 	tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
@@ -283,6 +284,7 @@
 	builtin-diff-tree.o \
 	builtin-fmt-merge-msg.o \
 	builtin-for-each-ref.o \
+	builtin-fsck.o \
 	builtin-grep.o \
 	builtin-init-db.o \
 	builtin-log.o \
@@ -299,7 +301,7 @@
 	builtin-push.o \
 	builtin-read-tree.o \
 	builtin-reflog.o \
-	builtin-repo-config.o \
+	builtin-config.o \
 	builtin-rerere.o \
 	builtin-rev-list.o \
 	builtin-rev-parse.o \
diff --git a/README b/README
index cee7e43..441167c 100644
--- a/README
+++ b/README
@@ -3,6 +3,7 @@
 	GIT - the stupid content tracker
 
 ////////////////////////////////////////////////////////////////
+
 "git" can mean anything, depending on your mood.
 
  - random three-letter combination that is pronounceable, and not
@@ -11,579 +12,29 @@
  - stupid. contemptible and despicable. simple. Take your pick from the
    dictionary of slang.
  - "global information tracker": you're in a good mood, and it actually
-   works for you. Angels sing, and a light suddenly fills the room. 
+   works for you. Angels sing, and a light suddenly fills the room.
  - "goddamn idiotic truckload of sh*t": when it breaks
 
-This is a stupid (but extremely fast) directory content manager.  It
-doesn't do a whole lot, but what it 'does' do is track directory
-contents efficiently. 
+Git is a fast, scalable, distributed revision control system with an
+unusually rich command set that provides both high-level operations
+and full access to internals.
 
-There are two object abstractions: the "object database", and the
-"current directory cache" aka "index".
+Git is an Open Source project covered by the GNU General Public License.
+It was originally written by Linus Torvalds with help of a group of
+hackers around the net. It is currently maintained by Junio C Hamano.
 
-The Object Database
-~~~~~~~~~~~~~~~~~~~
-The object database is literally just a content-addressable collection
-of objects.  All objects are named by their content, which is
-approximated by the SHA1 hash of the object itself.  Objects may refer
-to other objects (by referencing their SHA1 hash), and so you can
-build up a hierarchy of objects.
+Please read the file INSTALL for installation instructions.
+See Documentation/tutorial.txt to get started, then see
+Documentation/everyday.txt for a useful minimum set of commands,
+and "man git-commandname" for documentation of each command.
+CVS users may also want to read Documentation/cvs-migration.txt.
 
-All objects have a statically determined "type" aka "tag", which is
-determined at object creation time, and which identifies the format of
-the object (i.e. how it is used, and how it can refer to other
-objects).  There are currently four different object types: "blob",
-"tree", "commit" and "tag".
+Many Git online resources are accessible from http://git.or.cz/
+including full documentation and Git related tools.
 
-A "blob" object cannot refer to any other object, and is, like the type
-implies, a pure storage object containing some user data.  It is used to
-actually store the file data, i.e. a blob object is associated with some
-particular version of some file. 
-
-A "tree" object is an object that ties one or more "blob" objects into a
-directory structure. In addition, a tree object can refer to other tree
-objects, thus creating a directory hierarchy. 
-
-A "commit" object ties such directory hierarchies together into
-a DAG of revisions - each "commit" is associated with exactly one tree
-(the directory hierarchy at the time of the commit). In addition, a
-"commit" refers to one or more "parent" commit objects that describe the
-history of how we arrived at that directory hierarchy.
-
-As a special case, a commit object with no parents is called the "root"
-object, and is the point of an initial project commit.  Each project
-must have at least one root, and while you can tie several different
-root objects together into one project by creating a commit object which
-has two or more separate roots as its ultimate parents, that's probably
-just going to confuse people.  So aim for the notion of "one root object
-per project", even if git itself does not enforce that. 
-
-A "tag" object symbolically identifies and can be used to sign other
-objects. It contains the identifier and type of another object, a
-symbolic name (of course!) and, optionally, a signature.
-
-Regardless of object type, all objects share the following
-characteristics: they are all deflated with zlib, and have a header
-that not only specifies their type, but also provides size information
-about the data in the object.  It's worth noting that the SHA1 hash
-that is used to name the object is the hash of the original data
-plus this header, so `sha1sum` 'file' does not match the object name
-for 'file'.
-(Historical note: in the dawn of the age of git the hash
-was the sha1 of the 'compressed' object.)
-
-As a result, the general consistency of an object can always be tested
-independently of the contents or the type of the object: all objects can
-be validated by verifying that (a) their hashes match the content of the
-file and (b) the object successfully inflates to a stream of bytes that
-forms a sequence of <ascii type without space> + <space> + <ascii decimal
-size> + <byte\0> + <binary object data>. 
-
-The structured objects can further have their structure and
-connectivity to other objects verified. This is generally done with
-the `git-fsck-objects` program, which generates a full dependency graph
-of all objects, and verifies their internal consistency (in addition
-to just verifying their superficial consistency through the hash).
-
-The object types in some more detail:
-
-Blob Object
-~~~~~~~~~~~
-A "blob" object is nothing but a binary blob of data, and doesn't
-refer to anything else.  There is no signature or any other
-verification of the data, so while the object is consistent (it 'is'
-indexed by its sha1 hash, so the data itself is certainly correct), it
-has absolutely no other attributes.  No name associations, no
-permissions.  It is purely a blob of data (i.e. normally "file
-contents").
-
-In particular, since the blob is entirely defined by its data, if two
-files in a directory tree (or in multiple different versions of the
-repository) have the same contents, they will share the same blob
-object. The object is totally independent of its location in the
-directory tree, and renaming a file does not change the object that
-file is associated with in any way.
-
-A blob is typically created when gitlink:git-update-index[1]
-is run, and its data can be accessed by gitlink:git-cat-file[1].
-
-Tree Object
-~~~~~~~~~~~
-The next hierarchical object type is the "tree" object.  A tree object
-is a list of mode/name/blob data, sorted by name.  Alternatively, the
-mode data may specify a directory mode, in which case instead of
-naming a blob, that name is associated with another TREE object.
-
-Like the "blob" object, a tree object is uniquely determined by the
-set contents, and so two separate but identical trees will always
-share the exact same object. This is true at all levels, i.e. it's
-true for a "leaf" tree (which does not refer to any other trees, only
-blobs) as well as for a whole subdirectory.
-
-For that reason a "tree" object is just a pure data abstraction: it
-has no history, no signatures, no verification of validity, except
-that since the contents are again protected by the hash itself, we can
-trust that the tree is immutable and its contents never change.
-
-So you can trust the contents of a tree to be valid, the same way you
-can trust the contents of a blob, but you don't know where those
-contents 'came' from.
-
-Side note on trees: since a "tree" object is a sorted list of
-"filename+content", you can create a diff between two trees without
-actually having to unpack two trees.  Just ignore all common parts,
-and your diff will look right.  In other words, you can effectively
-(and efficiently) tell the difference between any two random trees by
-O(n) where "n" is the size of the difference, rather than the size of
-the tree.
-
-Side note 2 on trees: since the name of a "blob" depends entirely and
-exclusively on its contents (i.e. there are no names or permissions
-involved), you can see trivial renames or permission changes by
-noticing that the blob stayed the same.  However, renames with data
-changes need a smarter "diff" implementation.
-
-A tree is created with gitlink:git-write-tree[1] and
-its data can be accessed by gitlink:git-ls-tree[1].
-Two trees can be compared with gitlink:git-diff-tree[1].
-
-Commit Object
-~~~~~~~~~~~~~
-The "commit" object is an object that introduces the notion of
-history into the picture.  In contrast to the other objects, it
-doesn't just describe the physical state of a tree, it describes how
-we got there, and why.
-
-A "commit" is defined by the tree-object that it results in, the
-parent commits (zero, one or more) that led up to that point, and a
-comment on what happened.  Again, a commit is not trusted per se:
-the contents are well-defined and "safe" due to the cryptographically
-strong signatures at all levels, but there is no reason to believe
-that the tree is "good" or that the merge information makes sense.
-The parents do not have to actually have any relationship with the
-result, for example.
-
-Note on commits: unlike real SCM's, commits do not contain
-rename information or file mode change information.  All of that is
-implicit in the trees involved (the result tree, and the result trees
-of the parents), and describing that makes no sense in this idiotic
-file manager.
-
-A commit is created with gitlink:git-commit-tree[1] and
-its data can be accessed by gitlink:git-cat-file[1].
-
-Trust
-~~~~~
-An aside on the notion of "trust". Trust is really outside the scope
-of "git", but it's worth noting a few things.  First off, since
-everything is hashed with SHA1, you 'can' trust that an object is
-intact and has not been messed with by external sources.  So the name
-of an object uniquely identifies a known state - just not a state that
-you may want to trust.
-
-Furthermore, since the SHA1 signature of a commit refers to the
-SHA1 signatures of the tree it is associated with and the signatures
-of the parent, a single named commit specifies uniquely a whole set
-of history, with full contents.  You can't later fake any step of the
-way once you have the name of a commit.
-
-So to introduce some real trust in the system, the only thing you need
-to do is to digitally sign just 'one' special note, which includes the
-name of a top-level commit.  Your digital signature shows others
-that you trust that commit, and the immutability of the history of
-commits tells others that they can trust the whole history.
-
-In other words, you can easily validate a whole archive by just
-sending out a single email that tells the people the name (SHA1 hash)
-of the top commit, and digitally sign that email using something
-like GPG/PGP.
-
-To assist in this, git also provides the tag object...
-
-Tag Object
-~~~~~~~~~~
-Git provides the "tag" object to simplify creating, managing and
-exchanging symbolic and signed tokens.  The "tag" object at its
-simplest simply symbolically identifies another object by containing
-the sha1, type and symbolic name.
-
-However it can optionally contain additional signature information
-(which git doesn't care about as long as there's less than 8k of
-it). This can then be verified externally to git.
-
-Note that despite the tag features, "git" itself only handles content
-integrity; the trust framework (and signature provision and
-verification) has to come from outside.
-
-A tag is created with gitlink:git-mktag[1],
-its data can be accessed by gitlink:git-cat-file[1],
-and the signature can be verified by
-gitlink:git-verify-tag[1].
-
-
-The "index" aka "Current Directory Cache"
------------------------------------------
-The index is a simple binary file, which contains an efficient
-representation of a virtual directory content at some random time.  It
-does so by a simple array that associates a set of names, dates,
-permissions and content (aka "blob") objects together.  The cache is
-always kept ordered by name, and names are unique (with a few very
-specific rules) at any point in time, but the cache has no long-term
-meaning, and can be partially updated at any time.
-
-In particular, the index certainly does not need to be consistent with
-the current directory contents (in fact, most operations will depend on
-different ways to make the index 'not' be consistent with the directory
-hierarchy), but it has three very important attributes:
-
-'(a) it can re-generate the full state it caches (not just the
-directory structure: it contains pointers to the "blob" objects so
-that it can regenerate the data too)'
-
-As a special case, there is a clear and unambiguous one-way mapping
-from a current directory cache to a "tree object", which can be
-efficiently created from just the current directory cache without
-actually looking at any other data.  So a directory cache at any one
-time uniquely specifies one and only one "tree" object (but has
-additional data to make it easy to match up that tree object with what
-has happened in the directory)
-
-'(b) it has efficient methods for finding inconsistencies between that
-cached state ("tree object waiting to be instantiated") and the
-current state.'
-
-'(c) it can additionally efficiently represent information about merge
-conflicts between different tree objects, allowing each pathname to be
-associated with sufficient information about the trees involved that
-you can create a three-way merge between them.'
-
-Those are the three ONLY things that the directory cache does.  It's a
-cache, and the normal operation is to re-generate it completely from a
-known tree object, or update/compare it with a live tree that is being
-developed.  If you blow the directory cache away entirely, you generally
-haven't lost any information as long as you have the name of the tree
-that it described. 
-
-At the same time, the index is at the same time also the
-staging area for creating new trees, and creating a new tree always
-involves a controlled modification of the index file.  In particular,
-the index file can have the representation of an intermediate tree that
-has not yet been instantiated.  So the index can be thought of as a
-write-back cache, which can contain dirty information that has not yet
-been written back to the backing store.
-
-
-
-The Workflow
-------------
-Generally, all "git" operations work on the index file. Some operations
-work *purely* on the index file (showing the current state of the
-index), but most operations move data to and from the index file. Either
-from the database or from the working directory. Thus there are four
-main combinations: 
-
-1) working directory -> index
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-You update the index with information from the working directory with
-the gitlink:git-update-index[1] command.  You
-generally update the index information by just specifying the filename
-you want to update, like so:
-
-	git-update-index filename
-
-but to avoid common mistakes with filename globbing etc, the command
-will not normally add totally new entries or remove old entries,
-i.e. it will normally just update existing cache entries.
-
-To tell git that yes, you really do realize that certain files no
-longer exist, or that new files should be added, you
-should use the `--remove` and `--add` flags respectively.
-
-NOTE! A `--remove` flag does 'not' mean that subsequent filenames will
-necessarily be removed: if the files still exist in your directory
-structure, the index will be updated with their new status, not
-removed. The only thing `--remove` means is that update-cache will be
-considering a removed file to be a valid thing, and if the file really
-does not exist any more, it will update the index accordingly.
-
-As a special case, you can also do `git-update-index --refresh`, which
-will refresh the "stat" information of each index to match the current
-stat information. It will 'not' update the object status itself, and
-it will only update the fields that are used to quickly test whether
-an object still matches its old backing store object.
-
-2) index -> object database
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-You write your current index file to a "tree" object with the program
-
-	git-write-tree
-
-that doesn't come with any options - it will just write out the
-current index into the set of tree objects that describe that state,
-and it will return the name of the resulting top-level tree. You can
-use that tree to re-generate the index at any time by going in the
-other direction:
-
-3) object database -> index
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-You read a "tree" file from the object database, and use that to
-populate (and overwrite - don't do this if your index contains any
-unsaved state that you might want to restore later!) your current
-index.  Normal operation is just
-
-		git-read-tree <sha1 of tree>
-
-and your index file will now be equivalent to the tree that you saved
-earlier. However, that is only your 'index' file: your working
-directory contents have not been modified.
-
-4) index -> working directory
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-You update your working directory from the index by "checking out"
-files. This is not a very common operation, since normally you'd just
-keep your files updated, and rather than write to your working
-directory, you'd tell the index files about the changes in your
-working directory (i.e. `git-update-index`).
-
-However, if you decide to jump to a new version, or check out somebody
-else's version, or just restore a previous tree, you'd populate your
-index file with read-tree, and then you need to check out the result
-with
-
-		git-checkout-index filename
-
-or, if you want to check out all of the index, use `-a`.
-
-NOTE! git-checkout-index normally refuses to overwrite old files, so
-if you have an old version of the tree already checked out, you will
-need to use the "-f" flag ('before' the "-a" flag or the filename) to
-'force' the checkout.
-
-
-Finally, there are a few odds and ends which are not purely moving
-from one representation to the other:
-
-5) Tying it all together
-~~~~~~~~~~~~~~~~~~~~~~~~
-To commit a tree you have instantiated with "git-write-tree", you'd
-create a "commit" object that refers to that tree and the history
-behind it - most notably the "parent" commits that preceded it in
-history.
-
-Normally a "commit" has one parent: the previous state of the tree
-before a certain change was made. However, sometimes it can have two
-or more parent commits, in which case we call it a "merge", due to the
-fact that such a commit brings together ("merges") two or more
-previous states represented by other commits.
-
-In other words, while a "tree" represents a particular directory state
-of a working directory, a "commit" represents that state in "time",
-and explains how we got there.
-
-You create a commit object by giving it the tree that describes the
-state at the time of the commit, and a list of parents:
-
-	git-commit-tree <tree> -p <parent> [-p <parent2> ..]
-
-and then giving the reason for the commit on stdin (either through
-redirection from a pipe or file, or by just typing it at the tty).
-
-git-commit-tree will return the name of the object that represents
-that commit, and you should save it away for later use. Normally,
-you'd commit a new `HEAD` state, and while git doesn't care where you
-save the note about that state, in practice we tend to just write the
-result to the file pointed at by `.git/HEAD`, so that we can always see
-what the last committed state was.
-
-Here is an ASCII art by Jon Loeliger that illustrates how
-various pieces fit together.
-
-------------
-
-                     commit-tree
-                      commit obj
-                       +----+
-                       |    |
-                       |    |
-                       V    V
-                    +-----------+
-                    | Object DB |
-                    |  Backing  |
-                    |   Store   |
-                    +-----------+
-                       ^
-           write-tree  |     |
-             tree obj  |     |
-                       |     |  read-tree
-                       |     |  tree obj
-                             V
-                    +-----------+
-                    |   Index   |
-                    |  "cache"  |
-                    +-----------+
-         update-index  ^
-             blob obj  |     |
-                       |     |
-    checkout-index -u  |     |  checkout-index
-             stat      |     |  blob obj
-                             V
-                    +-----------+
-                    |  Working  |
-                    | Directory |
-                    +-----------+
-
-------------
-
-
-6) Examining the data
-~~~~~~~~~~~~~~~~~~~~~
-
-You can examine the data represented in the object database and the
-index with various helper tools. For every object, you can use
-gitlink:git-cat-file[1] to examine details about the
-object:
-
-		git-cat-file -t <objectname>
-
-shows the type of the object, and once you have the type (which is
-usually implicit in where you find the object), you can use
-
-		git-cat-file blob|tree|commit|tag <objectname>
-
-to show its contents. NOTE! Trees have binary content, and as a result
-there is a special helper for showing that content, called
-`git-ls-tree`, which turns the binary content into a more easily
-readable form.
-
-It's especially instructive to look at "commit" objects, since those
-tend to be small and fairly self-explanatory. In particular, if you
-follow the convention of having the top commit name in `.git/HEAD`,
-you can do
-
-		git-cat-file commit HEAD
-
-to see what the top commit was.
-
-7) Merging multiple trees
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Git helps you do a three-way merge, which you can expand to n-way by
-repeating the merge procedure arbitrary times until you finally
-"commit" the state.  The normal situation is that you'd only do one
-three-way merge (two parents), and commit it, but if you like to, you
-can do multiple parents in one go.
-
-To do a three-way merge, you need the two sets of "commit" objects
-that you want to merge, use those to find the closest common parent (a
-third "commit" object), and then use those commit objects to find the
-state of the directory ("tree" object) at these points.
-
-To get the "base" for the merge, you first look up the common parent
-of two commits with
-
-		git-merge-base <commit1> <commit2>
-
-which will return you the commit they are both based on.  You should
-now look up the "tree" objects of those commits, which you can easily
-do with (for example)
-
-		git-cat-file commit <commitname> | head -1
-
-since the tree object information is always the first line in a commit
-object.
-
-Once you know the three trees you are going to merge (the one
-"original" tree, aka the common case, and the two "result" trees, aka
-the branches you want to merge), you do a "merge" read into the
-index. This will complain if it has to throw away your old index contents, so you should
-make sure that you've committed those - in fact you would normally
-always do a merge against your last commit (which should thus match
-what you have in your current index anyway).
-
-To do the merge, do
-
-		git-read-tree -m -u <origtree> <yourtree> <targettree>
-
-which will do all trivial merge operations for you directly in the
-index file, and you can just write the result out with
-`git-write-tree`.
-
-Historical note.  We did not have `-u` facility when this
-section was first written, so we used to warn that
-the merge is done in the index file, not in your
-working tree, and your working tree will not match your
-index after this step.
-This is no longer true.  The above command, thanks to `-u`
-option, updates your working tree with the merge results for
-paths that have been trivially merged.
-
-
-8) Merging multiple trees, continued
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Sadly, many merges aren't trivial. If there are files that have
-been added.moved or removed, or if both branches have modified the
-same file, you will be left with an index tree that contains "merge
-entries" in it. Such an index tree can 'NOT' be written out to a tree
-object, and you will have to resolve any such merge clashes using
-other tools before you can write out the result.
-
-You can examine such index state with `git-ls-files --unmerged`
-command.  An example:
-
-------------------------------------------------
-$ git-read-tree -m $orig HEAD $target
-$ git-ls-files --unmerged
-100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1	hello.c
-100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2	hello.c
-100644 cc44c73eb783565da5831b4d820c962954019b69 3	hello.c
-------------------------------------------------
-
-Each line of the `git-ls-files --unmerged` output begins with
-the blob mode bits, blob SHA1, 'stage number', and the
-filename.  The 'stage number' is git's way to say which tree it
-came from: stage 1 corresponds to `$orig` tree, stage 2 `HEAD`
-tree, and stage3 `$target` tree.
-
-Earlier we said that trivial merges are done inside
-`git-read-tree -m`.  For example, if the file did not change
-from `$orig` to `HEAD` nor `$target`, or if the file changed
-from `$orig` to `HEAD` and `$orig` to `$target` the same way,
-obviously the final outcome is what is in `HEAD`.  What the
-above example shows is that file `hello.c` was changed from
-`$orig` to `HEAD` and `$orig` to `$target` in a different way.
-You could resolve this by running your favorite 3-way merge
-program, e.g.  `diff3` or `merge`, on the blob objects from
-these three stages yourself, like this:
-
-------------------------------------------------
-$ git-cat-file blob 263414f... >hello.c~1
-$ git-cat-file blob 06fa6a2... >hello.c~2
-$ git-cat-file blob cc44c73... >hello.c~3
-$ merge hello.c~2 hello.c~1 hello.c~3
-------------------------------------------------
-
-This would leave the merge result in `hello.c~2` file, along
-with conflict markers if there are conflicts.  After verifying
-the merge result makes sense, you can tell git what the final
-merge result for this file is by:
-
-	mv -f hello.c~2 hello.c
-	git-update-index hello.c
-
-When a path is in unmerged state, running `git-update-index` for
-that path tells git to mark the path resolved.
-
-The above is the description of a git merge at the lowest level,
-to help you understand what conceptually happens under the hood.
-In practice, nobody, not even git itself, uses three `git-cat-file`
-for this.  There is `git-merge-index` program that extracts the
-stages to temporary files and calls a "merge" script on it:
-
-	git-merge-index git-merge-one-file hello.c
-
-and that is what higher level `git resolve` is implemented with.
+The user discussion and development of Git take place on the Git
+mailing list -- everyone is welcome to post bug reports, feature
+requests, comments and patches to git@vger.kernel.org. To subscribe
+to the list, send an email with just "subscribe git" in the body to
+majordomo@vger.kernel.org. The mailing list archives are available at
+http://marc.theaimsgroup.com/?l=git and other archival sites.
diff --git a/builtin-add.c b/builtin-add.c
index e7a1b4d..87e16aa 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -10,7 +10,7 @@
 #include "cache-tree.h"
 
 static const char builtin_add_usage[] =
-"git-add [-n] [-v] [-f] [--interactive] [--] <filepattern>...";
+"git-add [-n] [-v] [-f] [--interactive | -i] [--] <filepattern>...";
 
 static void prune_directory(struct dir_struct *dir, const char **pathspec, int prefix)
 {
@@ -102,7 +102,8 @@
 	int add_interactive = 0;
 
 	for (i = 1; i < argc; i++) {
-		if (!strcmp("--interactive", argv[i]))
+		if (!strcmp("--interactive", argv[i]) ||
+		    !strcmp("-i", argv[i]))
 			add_interactive++;
 	}
 	if (add_interactive) {
diff --git a/builtin-apply.c b/builtin-apply.c
index 54fd2cb..3fefdac 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2589,7 +2589,7 @@
 }
 
 
-int cmd_apply(int argc, const char **argv, const char *prefix)
+int cmd_apply(int argc, const char **argv, const char *unused_prefix)
 {
 	int i;
 	int read_stdin = 1;
diff --git a/builtin-archive.c b/builtin-archive.c
index 32737d3..f613ac2 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -74,6 +74,7 @@
 	/* Now, start reading from fd[0] and spit it out to stdout */
 	rv = recv_sideband("archive", fd[0], 1, 2);
 	close(fd[0]);
+	close(fd[1]);
 	rv |= finish_connect(pid);
 
 	return !!rv;
diff --git a/builtin-blame.c b/builtin-blame.c
index 4a1accf..3033e9b 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -13,6 +13,7 @@
 #include "diff.h"
 #include "diffcore.h"
 #include "revision.h"
+#include "quote.h"
 #include "xdiff-interface.h"
 
 static char blame_usage[] =
@@ -27,6 +28,7 @@
 "  -p, --porcelain     Show in a format designed for machine consumption\n"
 "  -L n,m              Process only line range n,m, counting from 1\n"
 "  -M, -C              Find line movements within and across files\n"
+"  --incremental       Show blame entries as we find them, incrementally\n"
 "  -S revs-file        Use revisions from revs-file instead of calling git-rev-list\n";
 
 static int longest_file;
@@ -36,6 +38,7 @@
 static int max_score_digits;
 static int show_root;
 static int blank_boundary;
+static int incremental;
 
 #ifndef DEBUG
 #define DEBUG 0
@@ -74,6 +77,10 @@
 	char path[FLEX_ARRAY];
 };
 
+/*
+ * Given an origin, prepare mmfile_t structure to be used by the
+ * diff machinery
+ */
 static char *fill_origin_blob(struct origin *o, mmfile_t *file)
 {
 	if (!o->file.ptr) {
@@ -88,6 +95,10 @@
 	return file->ptr;
 }
 
+/*
+ * Origin is refcounted and usually we keep the blob contents to be
+ * reused.
+ */
 static inline struct origin *origin_incref(struct origin *o)
 {
 	if (o)
@@ -105,6 +116,11 @@
 	}
 }
 
+/*
+ * Each group of lines is described by a blame_entry; it can be split
+ * as we pass blame to the parents.  They form a linked list in the
+ * scoreboard structure, sorted by the target line number.
+ */
 struct blame_entry {
 	struct blame_entry *prev;
 	struct blame_entry *next;
@@ -131,19 +147,24 @@
 	int s_lno;
 
 	/* how significant this entry is -- cached to avoid
-	 * scanning the lines over and over
+	 * scanning the lines over and over.
 	 */
 	unsigned score;
 };
 
+/*
+ * The current state of the blame assignment.
+ */
 struct scoreboard {
 	/* the final commit (i.e. where we started digging from) */
 	struct commit *final;
 
 	const char *path;
 
-	/* the contents in the final; pointed into by buf pointers of
-	 * blame_entries
+	/*
+	 * The contents in the final image.
+	 * Used by many functions to obtain contents of the nth line,
+	 * indexed with scoreboard.lineno[blame_entry.lno].
 	 */
 	const char *final_buf;
 	unsigned long final_buf_size;
@@ -168,6 +189,11 @@
 
 static void sanity_check_refcnt(struct scoreboard *);
 
+/*
+ * If two blame entries that are next to each other came from
+ * contiguous lines in the same origin (i.e. <commit, path> pair),
+ * merge them together.
+ */
 static void coalesce(struct scoreboard *sb)
 {
 	struct blame_entry *ent, *next;
@@ -191,6 +217,12 @@
 		sanity_check_refcnt(sb);
 }
 
+/*
+ * Given a commit and a path in it, create a new origin structure.
+ * The callers that add blame to the scoreboard should use
+ * get_origin() to obtain shared, refcounted copy instead of calling
+ * this function directly.
+ */
 static struct origin *make_origin(struct commit *commit, const char *path)
 {
 	struct origin *o;
@@ -201,6 +233,9 @@
 	return o;
 }
 
+/*
+ * Locate an existing origin or create a new one.
+ */
 static struct origin *get_origin(struct scoreboard *sb,
 				 struct commit *commit,
 				 const char *path)
@@ -215,6 +250,13 @@
 	return make_origin(commit, path);
 }
 
+/*
+ * Fill the blob_sha1 field of an origin if it hasn't, so that later
+ * call to fill_origin_blob() can use it to locate the data.  blob_sha1
+ * for an origin is also used to pass the blame for the entire file to
+ * the parent to detect the case where a child's blob is identical to
+ * that of its parent's.
+ */
 static int fill_blob_sha1(struct origin *origin)
 {
 	unsigned mode;
@@ -235,6 +277,10 @@
 	return -1;
 }
 
+/*
+ * We have an origin -- check if the same path exists in the
+ * parent and return an origin structure to represent it.
+ */
 static struct origin *find_origin(struct scoreboard *sb,
 				  struct commit *parent,
 				  struct origin *origin)
@@ -244,12 +290,26 @@
 	const char *paths[2];
 
 	if (parent->util) {
-		/* This is a freestanding copy of origin and not
-		 * refcounted.
+		/*
+		 * Each commit object can cache one origin in that
+		 * commit.  This is a freestanding copy of origin and
+		 * not refcounted.
 		 */
 		struct origin *cached = parent->util;
 		if (!strcmp(cached->path, origin->path)) {
+			/*
+			 * The same path between origin and its parent
+			 * without renaming -- the most common case.
+			 */
 			porigin = get_origin(sb, parent, cached->path);
+
+			/*
+			 * If the origin was newly created (i.e. get_origin
+			 * would call make_origin if none is found in the
+			 * scoreboard), it does not know the blob_sha1,
+			 * so copy it.  Otherwise porigin was in the
+			 * scoreboard and already knows blob_sha1.
+			 */
 			if (porigin->refcnt == 1)
 				hashcpy(porigin->blob_sha1, cached->blob_sha1);
 			return porigin;
@@ -306,7 +366,13 @@
 	}
 	diff_flush(&diff_opts);
 	if (porigin) {
+		/*
+		 * Create a freestanding copy that is not part of
+		 * the refcounted origin found in the scoreboard, and
+		 * cache it in the commit.
+		 */
 		struct origin *cached;
+
 		cached = make_origin(porigin->commit, porigin->path);
 		hashcpy(cached->blob_sha1, porigin->blob_sha1);
 		parent->util = cached;
@@ -314,6 +380,10 @@
 	return porigin;
 }
 
+/*
+ * We have an origin -- find the path that corresponds to it in its
+ * parent and return an origin structure to represent it.
+ */
 static struct origin *find_rename(struct scoreboard *sb,
 				  struct commit *parent,
 				  struct origin *origin)
@@ -350,6 +420,9 @@
 	return porigin;
 }
 
+/*
+ * Parsing of patch chunks...
+ */
 struct chunk {
 	/* line number in postimage; up to but not including this
 	 * line is the same as preimage
@@ -451,6 +524,11 @@
 	return state.ret;
 }
 
+/*
+ * Run diff between two origins and grab the patch output, so that
+ * we can pass blame for lines origin is currently suspected for
+ * to its parent.
+ */
 static struct patch *get_patch(struct origin *parent, struct origin *origin)
 {
 	mmfile_t file_p, file_o;
@@ -471,6 +549,10 @@
 	free(p);
 }
 
+/*
+ * Link in a new blame entry to the scorebord.  Entries that cover the
+ * same line range have been removed from the scoreboard previously.
+ */
 static void add_blame_entry(struct scoreboard *sb, struct blame_entry *e)
 {
 	struct blame_entry *ent, *prev = NULL;
@@ -494,6 +576,12 @@
 		e->next->prev = e;
 }
 
+/*
+ * src typically is on-stack; we want to copy the information in it to
+ * an malloced blame_entry that is already on the linked list of the
+ * scoreboard.  The origin of dst loses a refcnt while the origin of src
+ * gains one.
+ */
 static void dup_entry(struct blame_entry *dst, struct blame_entry *src)
 {
 	struct blame_entry *p, *n;
@@ -513,25 +601,25 @@
 	return sb->final_buf + sb->lineno[lno];
 }
 
+/*
+ * It is known that lines between tlno to same came from parent, and e
+ * has an overlap with that range.  it also is known that parent's
+ * line plno corresponds to e's line tlno.
+ *
+ *                <---- e ----->
+ *                   <------>
+ *                   <------------>
+ *             <------------>
+ *             <------------------>
+ *
+ * Split e into potentially three parts; before this chunk, the chunk
+ * to be blamed for the parent, and after that portion.
+ */
 static void split_overlap(struct blame_entry *split,
 			  struct blame_entry *e,
 			  int tlno, int plno, int same,
 			  struct origin *parent)
 {
-	/* it is known that lines between tlno to same came from
-	 * parent, and e has an overlap with that range.  it also is
-	 * known that parent's line plno corresponds to e's line tlno.
-	 *
-	 *                <---- e ----->
-	 *                   <------>
-	 *                   <------------>
-	 *             <------------>
-	 *             <------------------>
-	 *
-	 * Potentially we need to split e into three parts; before
-	 * this chunk, the chunk to be blamed for parent, and after
-	 * that portion.
-	 */
 	int chunk_end_lno;
 	memset(split, 0, sizeof(struct blame_entry [3]));
 
@@ -561,11 +649,20 @@
 		chunk_end_lno = e->lno + e->num_lines;
 	split[1].num_lines = chunk_end_lno - split[1].lno;
 
+	/*
+	 * if it turns out there is nothing to blame the parent for,
+	 * forget about the splitting.  !split[1].suspect signals this.
+	 */
 	if (split[1].num_lines < 1)
 		return;
 	split[1].suspect = origin_incref(parent);
 }
 
+/*
+ * split_overlap() divided an existing blame e into up to three parts
+ * in split.  Adjust the linked list of blames in the scoreboard to
+ * reflect the split.
+ */
 static void split_blame(struct scoreboard *sb,
 			struct blame_entry *split,
 			struct blame_entry *e)
@@ -573,21 +670,27 @@
 	struct blame_entry *new_entry;
 
 	if (split[0].suspect && split[2].suspect) {
-		/* we need to split e into two and add another for parent */
+		/* The first part (reuse storage for the existing entry e) */
 		dup_entry(e, &split[0]);
 
+		/* The last part -- me */
 		new_entry = xmalloc(sizeof(*new_entry));
 		memcpy(new_entry, &(split[2]), sizeof(struct blame_entry));
 		add_blame_entry(sb, new_entry);
 
+		/* ... and the middle part -- parent */
 		new_entry = xmalloc(sizeof(*new_entry));
 		memcpy(new_entry, &(split[1]), sizeof(struct blame_entry));
 		add_blame_entry(sb, new_entry);
 	}
 	else if (!split[0].suspect && !split[2].suspect)
-		/* parent covers the entire area */
+		/*
+		 * The parent covers the entire area; reuse storage for
+		 * e and replace it with the parent.
+		 */
 		dup_entry(e, &split[1]);
 	else if (split[0].suspect) {
+		/* me and then parent */
 		dup_entry(e, &split[0]);
 
 		new_entry = xmalloc(sizeof(*new_entry));
@@ -595,6 +698,7 @@
 		add_blame_entry(sb, new_entry);
 	}
 	else {
+		/* parent and then me */
 		dup_entry(e, &split[1]);
 
 		new_entry = xmalloc(sizeof(*new_entry));
@@ -625,6 +729,10 @@
 	}
 }
 
+/*
+ * After splitting the blame, the origins used by the
+ * on-stack blame_entry should lose one refcnt each.
+ */
 static void decref_split(struct blame_entry *split)
 {
 	int i;
@@ -633,6 +741,10 @@
 		origin_decref(split[i].suspect);
 }
 
+/*
+ * Helper for blame_chunk().  blame_entry e is known to overlap with
+ * the patch hunk; split it and pass blame to the parent.
+ */
 static void blame_overlap(struct scoreboard *sb, struct blame_entry *e,
 			  int tlno, int plno, int same,
 			  struct origin *parent)
@@ -645,6 +757,9 @@
 	decref_split(split);
 }
 
+/*
+ * Find the line number of the last line the target is suspected for.
+ */
 static int find_last_in_target(struct scoreboard *sb, struct origin *target)
 {
 	struct blame_entry *e;
@@ -659,6 +774,11 @@
 	return last_in_target;
 }
 
+/*
+ * Process one hunk from the patch between the current suspect for
+ * blame_entry e and its parent.  Find and split the overlap, and
+ * pass blame to the overlapping part to the parent.
+ */
 static void blame_chunk(struct scoreboard *sb,
 			int tlno, int plno, int same,
 			struct origin *target, struct origin *parent)
@@ -675,6 +795,11 @@
 	}
 }
 
+/*
+ * We are looking at the origin 'target' and aiming to pass blame
+ * for the lines it is suspected to its parent.  Run diff to find
+ * which lines came from parent and pass blame for them.
+ */
 static int pass_blame_to_parent(struct scoreboard *sb,
 				struct origin *target,
 				struct origin *parent)
@@ -695,13 +820,22 @@
 		plno = chunk->p_next;
 		tlno = chunk->t_next;
 	}
-	/* rest (i.e. anything above tlno) are the same as parent */
+	/* The rest (i.e. anything after tlno) are the same as the parent */
 	blame_chunk(sb, tlno, plno, last_in_target, target, parent);
 
 	free_patch(patch);
 	return 0;
 }
 
+/*
+ * The lines in blame_entry after splitting blames many times can become
+ * very small and trivial, and at some point it becomes pointless to
+ * blame the parents.  E.g. "\t\t}\n\t}\n\n" appears everywhere in any
+ * ordinary C program, and it is not worth to say it was copied from
+ * totally unrelated file in the parent.
+ *
+ * Compute how trivial the lines in the blame_entry are.
+ */
 static unsigned ent_score(struct scoreboard *sb, struct blame_entry *e)
 {
 	unsigned score;
@@ -723,6 +857,12 @@
 	return score;
 }
 
+/*
+ * best_so_far[] and this[] are both a split of an existing blame_entry
+ * that passes blame to the parent.  Maintain best_so_far the best split
+ * so far, by comparing this and best_so_far and copying this into
+ * bst_so_far as needed.
+ */
 static void copy_split_if_better(struct scoreboard *sb,
 				 struct blame_entry *best_so_far,
 				 struct blame_entry *this)
@@ -742,6 +882,11 @@
 	memcpy(best_so_far, this, sizeof(struct blame_entry [3]));
 }
 
+/*
+ * Find the lines from parent that are the same as ent so that
+ * we can pass blames to it.  file_p has the blob contents for
+ * the parent.
+ */
 static void find_copy_in_blob(struct scoreboard *sb,
 			      struct blame_entry *ent,
 			      struct origin *parent,
@@ -754,6 +899,9 @@
 	struct patch *patch;
 	int i, plno, tlno;
 
+	/*
+	 * Prepare mmfile that contains only the lines in ent.
+	 */
 	cp = nth_line(sb, ent->lno);
 	file_o.ptr = (char*) cp;
 	cnt = ent->num_lines;
@@ -789,6 +937,10 @@
 	free_patch(patch);
 }
 
+/*
+ * See if lines currently target is suspected for can be attributed to
+ * parent.
+ */
 static int find_move_in_parent(struct scoreboard *sb,
 			       struct origin *target,
 			       struct origin *parent)
@@ -823,12 +975,15 @@
 	return 0;
 }
 
-
 struct blame_list {
 	struct blame_entry *ent;
 	struct blame_entry split[3];
 };
 
+/*
+ * Count the number of entries the target is suspected for,
+ * and prepare a list of entry and the best split.
+ */
 static struct blame_list *setup_blame_list(struct scoreboard *sb,
 					   struct origin *target,
 					   int *num_ents_p)
@@ -837,9 +992,6 @@
 	int num_ents, i;
 	struct blame_list *blame_list = NULL;
 
-	/* Count the number of entries the target is suspected for,
-	 * and prepare a list of entry and the best split.
-	 */
 	for (e = sb->ent, num_ents = 0; e; e = e->next)
 		if (!e->guilty && !cmp_suspect(e->suspect, target))
 			num_ents++;
@@ -853,6 +1005,11 @@
 	return blame_list;
 }
 
+/*
+ * For lines target is suspected for, see if we can find code movement
+ * across file boundary from the parent commit.  porigin is the path
+ * in the parent we already tried.
+ */
 static int find_copy_in_parent(struct scoreboard *sb,
 			       struct origin *target,
 			       struct commit *parent,
@@ -953,7 +1110,8 @@
 	return retval;
 }
 
-/* The blobs of origin and porigin exactly match, so everything
+/*
+ * The blobs of origin and porigin exactly match, so everything
  * origin is suspected for can be blamed on the parent.
  */
 static void pass_whole_blame(struct scoreboard *sb,
@@ -1038,7 +1196,7 @@
 	}
 
 	/*
-	 * Optionally run "miff" to find moves in parents' files here.
+	 * Optionally find moves in parents' files.
 	 */
 	if (opt & PICKAXE_BLAME_MOVE)
 		for (i = 0, parent = commit->parents;
@@ -1052,7 +1210,7 @@
 		}
 
 	/*
-	 * Optionally run "ciff" to find copies from parents' files here.
+	 * Optionally find copies from parents' files.
 	 */
 	if (opt & PICKAXE_BLAME_COPY)
 		for (i = 0, parent = commit->parents;
@@ -1069,72 +1227,9 @@
 		origin_decref(parent_origin[i]);
 }
 
-static void assign_blame(struct scoreboard *sb, struct rev_info *revs, int opt)
-{
-	while (1) {
-		struct blame_entry *ent;
-		struct commit *commit;
-		struct origin *suspect = NULL;
-
-		/* find one suspect to break down */
-		for (ent = sb->ent; !suspect && ent; ent = ent->next)
-			if (!ent->guilty)
-				suspect = ent->suspect;
-		if (!suspect)
-			return; /* all done */
-
-		origin_incref(suspect);
-		commit = suspect->commit;
-		if (!commit->object.parsed)
-			parse_commit(commit);
-		if (!(commit->object.flags & UNINTERESTING) &&
-		    !(revs->max_age != -1 && commit->date  < revs->max_age))
-			pass_blame(sb, suspect, opt);
-		else {
-			commit->object.flags |= UNINTERESTING;
-			if (commit->object.parsed)
-				mark_parents_uninteresting(commit);
-		}
-		/* treat root commit as boundary */
-		if (!commit->parents && !show_root)
-			commit->object.flags |= UNINTERESTING;
-
-		/* Take responsibility for the remaining entries */
-		for (ent = sb->ent; ent; ent = ent->next)
-			if (!cmp_suspect(ent->suspect, suspect))
-				ent->guilty = 1;
-		origin_decref(suspect);
-
-		if (DEBUG) /* sanity */
-			sanity_check_refcnt(sb);
-	}
-}
-
-static const char *format_time(unsigned long time, const char *tz_str,
-			       int show_raw_time)
-{
-	static char time_buf[128];
-	time_t t = time;
-	int minutes, tz;
-	struct tm *tm;
-
-	if (show_raw_time) {
-		sprintf(time_buf, "%lu %s", time, tz_str);
-		return time_buf;
-	}
-
-	tz = atoi(tz_str);
-	minutes = tz < 0 ? -tz : tz;
-	minutes = (minutes / 100)*60 + (minutes % 100);
-	minutes = tz < 0 ? -minutes : minutes;
-	t = time + minutes * 60;
-	tm = gmtime(&t);
-
-	strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S ", tm);
-	strcat(time_buf, tz_str);
-	return time_buf;
-}
-
+/*
+ * Information on commits, used for output.
+ */
 struct commit_info
 {
 	char *author;
@@ -1151,6 +1246,9 @@
 	char *summary;
 };
 
+/*
+ * Parse author/committer line in the commit object buffer
+ */
 static void get_ac_line(const char *inbuf, const char *what,
 			int bufsz, char *person, char **mail,
 			unsigned long *time, char **tz)
@@ -1205,7 +1303,8 @@
 	static char committer_buf[1024];
 	static char summary_buf[1024];
 
-	/* We've operated without save_commit_buffer, so
+	/*
+	 * We've operated without save_commit_buffer, so
 	 * we now need to populate them for output.
 	 */
 	if (!commit->buffer) {
@@ -1245,6 +1344,127 @@
 	summary_buf[len] = 0;
 }
 
+/*
+ * To allow LF and other nonportable characters in pathnames,
+ * they are c-style quoted as needed.
+ */
+static void write_filename_info(const char *path)
+{
+	printf("filename ");
+	write_name_quoted(NULL, 0, path, 1, stdout);
+	putchar('\n');
+}
+
+/*
+ * The blame_entry is found to be guilty for the range.  Mark it
+ * as such, and show it in incremental output.
+ */
+static void found_guilty_entry(struct blame_entry *ent)
+{
+	if (ent->guilty)
+		return;
+	ent->guilty = 1;
+	if (incremental) {
+		struct origin *suspect = ent->suspect;
+
+		printf("%s %d %d %d\n",
+		       sha1_to_hex(suspect->commit->object.sha1),
+		       ent->s_lno + 1, ent->lno + 1, ent->num_lines);
+		if (!(suspect->commit->object.flags & METAINFO_SHOWN)) {
+			struct commit_info ci;
+			suspect->commit->object.flags |= METAINFO_SHOWN;
+			get_commit_info(suspect->commit, &ci, 1);
+			printf("author %s\n", ci.author);
+			printf("author-mail %s\n", ci.author_mail);
+			printf("author-time %lu\n", ci.author_time);
+			printf("author-tz %s\n", ci.author_tz);
+			printf("committer %s\n", ci.committer);
+			printf("committer-mail %s\n", ci.committer_mail);
+			printf("committer-time %lu\n", ci.committer_time);
+			printf("committer-tz %s\n", ci.committer_tz);
+			printf("summary %s\n", ci.summary);
+			if (suspect->commit->object.flags & UNINTERESTING)
+				printf("boundary\n");
+		}
+		write_filename_info(suspect->path);
+	}
+}
+
+/*
+ * The main loop -- while the scoreboard has lines whose true origin
+ * is still unknown, pick one brame_entry, and allow its current
+ * suspect to pass blames to its parents.
+ */
+static void assign_blame(struct scoreboard *sb, struct rev_info *revs, int opt)
+{
+	while (1) {
+		struct blame_entry *ent;
+		struct commit *commit;
+		struct origin *suspect = NULL;
+
+		/* find one suspect to break down */
+		for (ent = sb->ent; !suspect && ent; ent = ent->next)
+			if (!ent->guilty)
+				suspect = ent->suspect;
+		if (!suspect)
+			return; /* all done */
+
+		/*
+		 * We will use this suspect later in the loop,
+		 * so hold onto it in the meantime.
+		 */
+		origin_incref(suspect);
+		commit = suspect->commit;
+		if (!commit->object.parsed)
+			parse_commit(commit);
+		if (!(commit->object.flags & UNINTERESTING) &&
+		    !(revs->max_age != -1 && commit->date < revs->max_age))
+			pass_blame(sb, suspect, opt);
+		else {
+			commit->object.flags |= UNINTERESTING;
+			if (commit->object.parsed)
+				mark_parents_uninteresting(commit);
+		}
+		/* treat root commit as boundary */
+		if (!commit->parents && !show_root)
+			commit->object.flags |= UNINTERESTING;
+
+		/* Take responsibility for the remaining entries */
+		for (ent = sb->ent; ent; ent = ent->next)
+			if (!cmp_suspect(ent->suspect, suspect))
+				found_guilty_entry(ent);
+		origin_decref(suspect);
+
+		if (DEBUG) /* sanity */
+			sanity_check_refcnt(sb);
+	}
+}
+
+static const char *format_time(unsigned long time, const char *tz_str,
+			       int show_raw_time)
+{
+	static char time_buf[128];
+	time_t t = time;
+	int minutes, tz;
+	struct tm *tm;
+
+	if (show_raw_time) {
+		sprintf(time_buf, "%lu %s", time, tz_str);
+		return time_buf;
+	}
+
+	tz = atoi(tz_str);
+	minutes = tz < 0 ? -tz : tz;
+	minutes = (minutes / 100)*60 + (minutes % 100);
+	minutes = tz < 0 ? -minutes : minutes;
+	t = time + minutes * 60;
+	tm = gmtime(&t);
+
+	strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S ", tm);
+	strcat(time_buf, tz_str);
+	return time_buf;
+}
+
 #define OUTPUT_ANNOTATE_COMPAT	001
 #define OUTPUT_LONG_OBJECT_NAME	002
 #define OUTPUT_RAW_TIMESTAMP	004
@@ -1279,13 +1499,13 @@
 		printf("committer-mail %s\n", ci.committer_mail);
 		printf("committer-time %lu\n", ci.committer_time);
 		printf("committer-tz %s\n", ci.committer_tz);
-		printf("filename %s\n", suspect->path);
+		write_filename_info(suspect->path);
 		printf("summary %s\n", ci.summary);
 		if (suspect->commit->object.flags & UNINTERESTING)
 			printf("boundary\n");
 	}
 	else if (suspect->commit->object.flags & MORE_THAN_ONE_PATH)
-		printf("filename %s\n", suspect->path);
+		write_filename_info(suspect->path);
 
 	cp = nth_line(sb, ent->lno);
 	for (cnt = 0; cnt < ent->num_lines; cnt++) {
@@ -1390,6 +1610,10 @@
 	}
 }
 
+/*
+ * To allow quick access to the contents of nth line in the
+ * final image, prepare an index in the scoreboard.
+ */
 static int prepare_lines(struct scoreboard *sb)
 {
 	const char *buf = sb->final_buf;
@@ -1417,6 +1641,11 @@
 	return sb->num_lines;
 }
 
+/*
+ * Add phony grafts for use with -S; this is primarily to
+ * support git-cvsserver that wants to give a linear history
+ * to its clients.
+ */
 static int read_ancestry(const char *graft_file)
 {
 	FILE *fp = fopen(graft_file, "r");
@@ -1434,6 +1663,9 @@
 	return 0;
 }
 
+/*
+ * How many columns do we need to show line numbers in decimal?
+ */
 static int lineno_width(int lines)
 {
         int i, width;
@@ -1443,6 +1675,10 @@
         return width;
 }
 
+/*
+ * How many columns do we need to show line numbers, authors,
+ * and filenames?
+ */
 static void find_alignment(struct scoreboard *sb, int *option)
 {
 	int longest_src_lines = 0;
@@ -1481,6 +1717,10 @@
 	max_score_digits = lineno_width(largest_score);
 }
 
+/*
+ * For debugging -- origin is refcounted, and this asserts that
+ * we do not underflow.
+ */
 static void sanity_check_refcnt(struct scoreboard *sb)
 {
 	int baa = 0;
@@ -1502,8 +1742,9 @@
 			ent->suspect->refcnt = -ent->suspect->refcnt;
 	}
 	for (ent = sb->ent; ent; ent = ent->next) {
-		/* then pick each and see if they have the the correct
-		 * refcnt.
+		/*
+		 * ... then pick each and see if they have the the
+		 * correct refcnt.
 		 */
 		int found;
 		struct blame_entry *e;
@@ -1533,6 +1774,10 @@
 	}
 }
 
+/*
+ * Used for the command line parsing; check if the path exists
+ * in the working tree.
+ */
 static int has_path_in_work_tree(const char *path)
 {
 	struct stat st;
@@ -1555,6 +1800,9 @@
 	return prefix_path(prefix, strlen(prefix), path);
 }
 
+/*
+ * Parsing of (comma separated) one item in the -L option
+ */
 static const char *parse_loc(const char *spec,
 			     struct scoreboard *sb, long lno,
 			     long begin, long *ret)
@@ -1629,6 +1877,9 @@
 	}
 }
 
+/*
+ * Parsing of -L option
+ */
 static void prepare_blame_range(struct scoreboard *sb,
 				const char *bottomtop,
 				long lno,
@@ -1717,6 +1968,8 @@
 				die("More than one '-L n,m' option given");
 			bottomtop = arg;
 		}
+		else if (!strcmp("--incremental", arg))
+			incremental = 1;
 		else if (!strcmp("--score-debug", arg))
 			output_option |= OUTPUT_SHOW_SCORE;
 		else if (!strcmp("-f", arg) ||
@@ -1737,12 +1990,16 @@
 			argv[unk++] = arg;
 	}
 
+	if (!incremental)
+		setup_pager();
+
 	if (!blame_move_score)
 		blame_move_score = BLAME_DEFAULT_MOVE_SCORE;
 	if (!blame_copy_score)
 		blame_copy_score = BLAME_DEFAULT_COPY_SCORE;
 
-	/* We have collected options unknown to us in argv[1..unk]
+	/*
+	 * We have collected options unknown to us in argv[1..unk]
 	 * which are to be passed to revision machinery if we are
 	 * going to do the "bottom" procesing.
 	 *
@@ -1822,7 +2079,8 @@
 	if (final_commit_name)
 		argv[unk++] = final_commit_name;
 
-	/* Now we got rev and path.  We do not want the path pruning
+	/*
+	 * Now we got rev and path.  We do not want the path pruning
 	 * but we may want "bottom" processing.
 	 */
 	argv[unk++] = "--"; /* terminate the rev name */
@@ -1832,7 +2090,8 @@
 	setup_revisions(unk, argv, &revs, "HEAD");
 	memset(&sb, 0, sizeof(sb));
 
-	/* There must be one and only one positive commit in the
+	/*
+	 * There must be one and only one positive commit in the
 	 * revs->pending array.
 	 */
 	for (i = 0; i < revs.pending.nr; i++) {
@@ -1853,7 +2112,10 @@
 	}
 
 	if (!sb.final) {
-		/* "--not A B -- path" without anything positive */
+		/*
+		 * "--not A B -- path" without anything positive;
+		 * default to HEAD.
+		 */
 		unsigned char head_sha1[20];
 
 		final_commit_name = "HEAD";
@@ -1863,7 +2125,8 @@
 		add_pending_object(&revs, &(sb.final->object), "HEAD");
 	}
 
-	/* If we have bottom, this will mark the ancestors of the
+	/*
+	 * If we have bottom, this will mark the ancestors of the
 	 * bottom commits we would reach while traversing as
 	 * uninteresting.
 	 */
@@ -1907,6 +2170,9 @@
 
 	assign_blame(&sb, &revs, opt);
 
+	if (incremental)
+		return 0;
+
 	coalesce(&sb);
 
 	if (!(output_option & OUTPUT_PORCELAIN))
diff --git a/builtin-branch.c b/builtin-branch.c
index c760e18..d60690b 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -324,7 +324,7 @@
 	if (resolve_ref(ref, sha1, 1, NULL)) {
 		if (!force)
 			die("A branch named '%s' already exists.", name);
-		else if (!strcmp(head, name))
+		else if (!is_bare_repository() && !strcmp(head, name))
 			die("Cannot force update the current branch.");
 	}
 
@@ -394,7 +394,6 @@
 	int kinds = REF_LOCAL_BRANCH;
 	int i;
 
-	setup_ident();
 	git_config(git_branch_config);
 
 	for (i = 1; i < argc; i++) {
diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c
index 0651e59..2a818a0 100644
--- a/builtin-commit-tree.c
+++ b/builtin-commit-tree.c
@@ -94,7 +94,6 @@
 	unsigned int size;
 	int encoding_is_utf8;
 
-	setup_ident();
 	git_config(git_default_config);
 
 	if (argc < 2)
diff --git a/builtin-repo-config.c b/builtin-config.c
similarity index 94%
rename from builtin-repo-config.c
rename to builtin-config.c
index 9063311..0f9051d 100644
--- a/builtin-repo-config.c
+++ b/builtin-config.c
@@ -2,7 +2,7 @@
 #include "cache.h"
 
 static const char git_config_set_usage[] =
-"git-repo-config [ --global ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --list";
+"git-config [ --global ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --list";
 
 static char *key;
 static regex_t *key_regexp;
@@ -126,7 +126,7 @@
 	return ret;
 }
 
-int cmd_repo_config(int argc, const char **argv, const char *prefix)
+int cmd_config(int argc, const char **argv, const char *prefix)
 {
 	int nongit = 0;
 	setup_git_directory_gently(&nongit);
diff --git a/builtin-describe.c b/builtin-describe.c
index a8c98ce..bcc6456 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -2,57 +2,41 @@
 #include "commit.h"
 #include "tag.h"
 #include "refs.h"
-#include "diff.h"
-#include "diffcore.h"
-#include "revision.h"
 #include "builtin.h"
 
+#define SEEN		(1u<<0)
+#define MAX_TAGS	(FLAG_BITS - 1)
+
 static const char describe_usage[] =
 "git-describe [--all] [--tags] [--abbrev=<n>] <committish>*";
 
+static int debug;	/* Display lots of verbose info */
 static int all;	/* Default to annotated tags only */
 static int tags;	/* But allow any tags if --tags is specified */
-
 static int abbrev = DEFAULT_ABBREV;
+static int max_candidates = 10;
 
-static int names, allocs;
-static struct commit_name {
-	struct commit *commit;
+struct commit_name {
 	int prio; /* annotated tag = 2, tag = 1, head = 0 */
 	char path[FLEX_ARRAY]; /* more */
-} **name_array = NULL;
-
-static struct commit_name *match(struct commit *cmit)
-{
-	int i = names;
-	struct commit_name **p = name_array;
-
-	while (i-- > 0) {
-		struct commit_name *n = *p++;
-		if (n->commit == cmit)
-			return n;
-	}
-	return NULL;
-}
+};
+static const char *prio_names[] = {
+	"head", "lightweight", "annotated",
+};
 
 static void add_to_known_names(const char *path,
 			       struct commit *commit,
 			       int prio)
 {
-	int idx;
-	int len = strlen(path)+1;
-	struct commit_name *name = xmalloc(sizeof(struct commit_name) + len);
-
-	name->commit = commit;
-	name->prio = prio;
-	memcpy(name->path, path, len);
-	idx = names;
-	if (idx >= allocs) {
-		allocs = (idx + 50) * 3 / 2;
-		name_array = xrealloc(name_array, allocs*sizeof(*name_array));
+	struct commit_name *e = commit->util;
+	if (!e || e->prio < prio) {
+		size_t len = strlen(path)+1;
+		free(e);
+		e = xmalloc(sizeof(struct commit_name) + len);
+		e->prio = prio;
+		memcpy(e->path, path, len);
+		commit->util = e;
 	}
-	name_array[idx] = name;
-	names = ++idx;
 }
 
 static int get_name(const char *path, const unsigned char *sha1, int flag, void *cb_data)
@@ -87,32 +71,69 @@
 	return 0;
 }
 
-static int compare_names(const void *_a, const void *_b)
-{
-	struct commit_name *a = *(struct commit_name **)_a;
-	struct commit_name *b = *(struct commit_name **)_b;
-	unsigned long a_date = a->commit->date;
-	unsigned long b_date = b->commit->date;
+struct possible_tag {
+	struct commit_name *name;
+	int depth;
+	int found_order;
+	unsigned flag_within;
+};
 
-	if (a->prio != b->prio)
-		return b->prio - a->prio;
-	return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
+static int compare_pt(const void *a_, const void *b_)
+{
+	struct possible_tag *a = (struct possible_tag *)a_;
+	struct possible_tag *b = (struct possible_tag *)b_;
+	if (a->name->prio != b->name->prio)
+		return b->name->prio - a->name->prio;
+	if (a->depth != b->depth)
+		return a->depth - b->depth;
+	if (a->found_order != b->found_order)
+		return a->found_order - b->found_order;
+	return 0;
 }
 
-struct possible_tag {
-	struct possible_tag *next;
-	struct commit_name *name;
-	unsigned long depth;
-};
+static unsigned long finish_depth_computation(
+	struct commit_list **list,
+	struct possible_tag *best)
+{
+	unsigned long seen_commits = 0;
+	while (*list) {
+		struct commit *c = pop_commit(list);
+		struct commit_list *parents = c->parents;
+		seen_commits++;
+		if (c->object.flags & best->flag_within) {
+			struct commit_list *a = *list;
+			while (a) {
+				struct commit *i = a->item;
+				if (!(i->object.flags & best->flag_within))
+					break;
+				a = a->next;
+			}
+			if (!a)
+				break;
+		} else
+			best->depth++;
+		while (parents) {
+			struct commit *p = parents->item;
+			parse_commit(p);
+			if (!(p->object.flags & SEEN))
+				insert_by_date(p, list);
+			p->object.flags |= c->object.flags;
+			parents = parents->next;
+		}
+	}
+	return seen_commits;
+}
 
 static void describe(const char *arg, int last_one)
 {
 	unsigned char sha1[20];
-	struct commit *cmit;
+	struct commit *cmit, *gave_up_on = NULL;
 	struct commit_list *list;
 	static int initialized = 0;
 	struct commit_name *n;
-	struct possible_tag *all_matches, *min_match, *cur_match;
+	struct possible_tag all_matches[MAX_TAGS];
+	unsigned int match_cnt = 0, annotated_cnt = 0, cur_match;
+	unsigned long seen_commits = 0;
 
 	if (get_sha1(arg, sha1))
 		die("Not a valid object name %s", arg);
@@ -123,78 +144,99 @@
 	if (!initialized) {
 		initialized = 1;
 		for_each_ref(get_name, NULL);
-		qsort(name_array, names, sizeof(*name_array), compare_names);
 	}
 
-	n = match(cmit);
+	n = cmit->util;
 	if (n) {
 		printf("%s\n", n->path);
 		return;
 	}
 
+	if (debug)
+		fprintf(stderr, "searching to describe %s\n", arg);
+
 	list = NULL;
-	all_matches = NULL;
-	cur_match = NULL;
+	cmit->object.flags = SEEN;
 	commit_list_insert(cmit, &list);
 	while (list) {
 		struct commit *c = pop_commit(&list);
-		n = match(c);
+		struct commit_list *parents = c->parents;
+		seen_commits++;
+		n = c->util;
 		if (n) {
-			struct possible_tag *p = xmalloc(sizeof(*p));
-			p->name = n;
-			p->next = NULL;
-			if (cur_match)
-				cur_match->next = p;
-			else
-				all_matches = p;
-			cur_match = p;
-		} else {
-			struct commit_list *parents = c->parents;
-			while (parents) {
-				struct commit *p = parents->item;
-				parse_commit(p);
-				if (!(p->object.flags & SEEN)) {
-					p->object.flags |= SEEN;
-					insert_by_date(p, &list);
-				}
-				parents = parents->next;
+			if (match_cnt < max_candidates) {
+				struct possible_tag *t = &all_matches[match_cnt++];
+				t->name = n;
+				t->depth = seen_commits - 1;
+				t->flag_within = 1u << match_cnt;
+				t->found_order = match_cnt;
+				c->object.flags |= t->flag_within;
+				if (n->prio == 2)
+					annotated_cnt++;
+			}
+			else {
+				gave_up_on = c;
+				break;
 			}
 		}
+		for (cur_match = 0; cur_match < match_cnt; cur_match++) {
+			struct possible_tag *t = &all_matches[cur_match];
+			if (!(c->object.flags & t->flag_within))
+				t->depth++;
+		}
+		if (annotated_cnt && !list) {
+			if (debug)
+				fprintf(stderr, "finished search at %s\n",
+					sha1_to_hex(c->object.sha1));
+			break;
+		}
+		while (parents) {
+			struct commit *p = parents->item;
+			parse_commit(p);
+			if (!(p->object.flags & SEEN))
+				insert_by_date(p, &list);
+			p->object.flags |= c->object.flags;
+			parents = parents->next;
+		}
 	}
 
-	if (!all_matches)
+	if (!match_cnt)
 		die("cannot describe '%s'", sha1_to_hex(cmit->object.sha1));
 
-	min_match = NULL;
-	for (cur_match = all_matches; cur_match; cur_match = cur_match->next) {
-		struct rev_info revs;
-		struct commit *tagged = cur_match->name->commit;
+	qsort(all_matches, match_cnt, sizeof(all_matches[0]), compare_pt);
 
-		clear_commit_marks(cmit, -1);
-		init_revisions(&revs, NULL);
-		tagged->object.flags |= UNINTERESTING;
-		add_pending_object(&revs, &tagged->object, NULL);
-		add_pending_object(&revs, &cmit->object, NULL);
-
-		prepare_revision_walk(&revs);
-		cur_match->depth = 0;
-		while ((!min_match || cur_match->depth < min_match->depth)
-			&& get_revision(&revs))
-			cur_match->depth++;
-		if (!min_match || cur_match->depth < min_match->depth)
-			min_match = cur_match;
-		free_commit_list(revs.commits);
+	if (gave_up_on) {
+		insert_by_date(gave_up_on, &list);
+		seen_commits--;
 	}
-	printf("%s-g%s\n", min_match->name->path,
-		   find_unique_abbrev(cmit->object.sha1, abbrev));
+	seen_commits += finish_depth_computation(&list, &all_matches[0]);
+	free_commit_list(list);
 
-	if (!last_one) {
-		for (cur_match = all_matches; cur_match; cur_match = min_match) {
-			min_match = cur_match->next;
-			free(cur_match);
+	if (debug) {
+		for (cur_match = 0; cur_match < match_cnt; cur_match++) {
+			struct possible_tag *t = &all_matches[cur_match];
+			fprintf(stderr, " %-11s %8d %s\n",
+				prio_names[t->name->prio],
+				t->depth, t->name->path);
 		}
-		clear_commit_marks(cmit, SEEN);
+		fprintf(stderr, "traversed %lu commits\n", seen_commits);
+		if (gave_up_on) {
+			fprintf(stderr,
+				"more than %i tags found; listed %i most recent\n"
+				"gave up search at %s\n",
+				max_candidates, max_candidates,
+				sha1_to_hex(gave_up_on->object.sha1));
+		}
 	}
+	if (abbrev == 0)
+		printf("%s\n", all_matches[0].name->path );
+	else
+		printf("%s-%d-g%s\n", all_matches[0].name->path,
+		       all_matches[0].depth,
+		       find_unique_abbrev(cmit->object.sha1, abbrev));
+
+	if (!last_one)
+		clear_commit_marks(cmit, -1);
 }
 
 int cmd_describe(int argc, const char **argv, const char *prefix)
@@ -206,15 +248,24 @@
 
 		if (*arg != '-')
 			break;
+		else if (!strcmp(arg, "--debug"))
+			debug = 1;
 		else if (!strcmp(arg, "--all"))
 			all = 1;
 		else if (!strcmp(arg, "--tags"))
 			tags = 1;
 		else if (!strncmp(arg, "--abbrev=", 9)) {
 			abbrev = strtoul(arg + 9, NULL, 10);
-			if (abbrev < MINIMUM_ABBREV || 40 < abbrev)
+			if (abbrev != 0 && (abbrev < MINIMUM_ABBREV || 40 < abbrev))
 				abbrev = DEFAULT_ABBREV;
 		}
+		else if (!strncmp(arg, "--candidates=", 13)) {
+			max_candidates = strtoul(arg + 13, NULL, 10);
+			if (max_candidates < 1)
+				max_candidates = 1;
+			else if (max_candidates > MAX_TAGS)
+				max_candidates = MAX_TAGS;
+		}
 		else
 			usage(describe_usage);
 	}
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index af72a12..9d5f266 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -12,6 +12,7 @@
 #define QUOTE_SHELL 1
 #define QUOTE_PERL 2
 #define QUOTE_PYTHON 3
+#define QUOTE_TCL 4
 
 typedef enum { FIELD_STR, FIELD_ULONG, FIELD_TIME } cmp_type;
 
@@ -723,6 +724,9 @@
 	case QUOTE_PYTHON:
 		python_quote_print(stdout, v->s);
 		break;
+	case QUOTE_TCL:
+		tcl_quote_print(stdout, v->s);
+		break;
 	}
 }
 
@@ -834,6 +838,12 @@
 			quote_style = QUOTE_PYTHON;
 			continue;
 		}
+		if (!strcmp(arg, "--tcl") ) {
+			if (0 <= quote_style)
+				die("more than one quoting style?");
+			quote_style = QUOTE_TCL;
+			continue;
+		}
 		if (!strncmp(arg, "--count=", 8)) {
 			if (maxcount)
 				die("more than one --count?");
diff --git a/fsck-objects.c b/builtin-fsck.c
similarity index 83%
rename from fsck-objects.c
rename to builtin-fsck.c
index 81f00db..fec1cbd 100644
--- a/fsck-objects.c
+++ b/builtin-fsck.c
@@ -54,6 +54,99 @@
 	return -1;
 }
 
+/*
+ * Check a single reachable object
+ */
+static void check_reachable_object(struct object *obj)
+{
+	const struct object_refs *refs;
+
+	/*
+	 * We obviously want the object to be parsed,
+	 * except if it was in a pack-file and we didn't
+	 * do a full fsck
+	 */
+	if (!obj->parsed) {
+		if (has_sha1_file(obj->sha1))
+			return; /* it is in pack - forget about it */
+		printf("missing %s %s\n", typename(obj->type), sha1_to_hex(obj->sha1));
+		return;
+	}
+
+	/*
+	 * Check that everything that we try to reference is also good.
+	 */
+	refs = lookup_object_refs(obj);
+	if (refs) {
+		unsigned j;
+		for (j = 0; j < refs->count; j++) {
+			struct object *ref = refs->ref[j];
+			if (ref->parsed ||
+			    (has_sha1_file(ref->sha1)))
+				continue;
+			printf("broken link from %7s %s\n",
+			       typename(obj->type), sha1_to_hex(obj->sha1));
+			printf("              to %7s %s\n",
+			       typename(ref->type), sha1_to_hex(ref->sha1));
+		}
+	}
+}
+
+/*
+ * Check a single unreachable object
+ */
+static void check_unreachable_object(struct object *obj)
+{
+	/*
+	 * Missing unreachable object? Ignore it. It's not like
+	 * we miss it (since it can't be reached), nor do we want
+	 * to complain about it being unreachable (since it does
+	 * not exist).
+	 */
+	if (!obj->parsed)
+		return;
+
+	/*
+	 * Unreachable object that exists? Show it if asked to,
+	 * since this is something that is prunable.
+	 */
+	if (show_unreachable) {
+		printf("unreachable %s %s\n", typename(obj->type), sha1_to_hex(obj->sha1));
+		return;
+	}
+
+	/*
+	 * "!used" means that nothing at all points to it, including
+	 * other unreacahble objects. In other words, it's the "tip"
+	 * of some set of unreachable objects, usually a commit that
+	 * got dropped.
+	 *
+	 * Such starting points are more interesting than some random
+	 * set of unreachable objects, so we show them even if the user
+	 * hasn't asked for _all_ unreachable objects. If you have
+	 * deleted a branch by mistake, this is a prime candidate to
+	 * start looking at, for example.
+	 */
+	if (!obj->used) {
+		printf("dangling %s %s\n", typename(obj->type),
+		       sha1_to_hex(obj->sha1));
+		return;
+	}
+
+	/*
+	 * Otherwise? It's there, it's unreachable, and some other unreachable
+	 * object points to it. Ignore it - it's not interesting, and we showed
+	 * all the interesting cases above.
+	 */
+}
+
+static void check_object(struct object *obj)
+{
+	if (obj->flags & REACHABLE)
+		check_reachable_object(obj);
+	else
+		check_unreachable_object(obj);
+}
 
 static void check_connectivity(void)
 {
@@ -62,46 +155,10 @@
 	/* Look up all the requirements, warn about missing objects.. */
 	max = get_max_object_index();
 	for (i = 0; i < max; i++) {
-		const struct object_refs *refs;
 		struct object *obj = get_indexed_object(i);
 
-		if (!obj)
-			continue;
-
-		if (!obj->parsed) {
-			if (has_sha1_file(obj->sha1))
-				; /* it is in pack */
-			else
-				printf("missing %s %s\n",
-				       typename(obj->type), sha1_to_hex(obj->sha1));
-			continue;
-		}
-
-		refs = lookup_object_refs(obj);
-		if (refs) {
-			unsigned j;
-			for (j = 0; j < refs->count; j++) {
-				struct object *ref = refs->ref[j];
-				if (ref->parsed ||
-				    (has_sha1_file(ref->sha1)))
-					continue;
-				printf("broken link from %7s %s\n",
-				       typename(obj->type), sha1_to_hex(obj->sha1));
-				printf("              to %7s %s\n",
-				       typename(ref->type), sha1_to_hex(ref->sha1));
-			}
-		}
-
-		if (show_unreachable && !(obj->flags & REACHABLE)) {
-			printf("unreachable %s %s\n",
-			       typename(obj->type), sha1_to_hex(obj->sha1));
-			continue;
-		}
-
-		if (!obj->used) {
-			printf("dangling %s %s\n", typename(obj->type),
-			       sha1_to_hex(obj->sha1));
-		}
+		if (obj)
+			check_object(obj);
 	}
 }
 
@@ -514,12 +571,11 @@
 	return err;
 }
 
-int main(int argc, char **argv)
+int cmd_fsck(int argc, char **argv, const char *prefix)
 {
 	int i, heads;
 
 	track_object_refs = 1;
-	setup_git_directory();
 
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
@@ -549,7 +605,7 @@
 			continue;
 		}
 		if (*arg == '-')
-			usage("git-fsck-objects [--tags] [--root] [[--unreachable] [--cache] [--full] [--strict] <head-sha1>*]");
+			usage("git-fsck [--tags] [--root] [[--unreachable] [--cache] [--full] [--strict] <head-sha1>*]");
 	}
 
 	fsck_head_link();
diff --git a/builtin-init-db.c b/builtin-init-db.c
index 8e7540b..1865489 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -257,7 +257,9 @@
 	}
 	else {
 		git_config_set("core.bare", "false");
-		git_config_set("core.logallrefupdates", "true");
+		/* allow template config file to override the default */
+		if (log_all_ref_updates == -1)
+		    git_config_set("core.logallrefupdates", "true");
 	}
 	return reinit;
 }
diff --git a/builtin-log.c b/builtin-log.c
index a59b4ac..982d871 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -50,8 +50,11 @@
 	prepare_revision_walk(rev);
 	while ((commit = get_revision(rev)) != NULL) {
 		log_tree_commit(rev, commit);
-		free(commit->buffer);
-		commit->buffer = NULL;
+		if (!rev->reflog_info) {
+			/* we allow cycles in reflog ancestry */
+			free(commit->buffer);
+			commit->buffer = NULL;
+		}
 		free_commit_list(commit->parents);
 		commit->parents = NULL;
 	}
@@ -197,17 +200,28 @@
 
 static char *extra_headers = NULL;
 static int extra_headers_size = 0;
+static const char *fmt_patch_suffix = ".patch";
 
 static int git_format_config(const char *var, const char *value)
 {
 	if (!strcmp(var, "format.headers")) {
-		int len = strlen(value);
+		int len;
+
+		if (!value)
+			die("format.headers without value");
+		len = strlen(value);
 		extra_headers_size += len + 1;
 		extra_headers = xrealloc(extra_headers, extra_headers_size);
 		extra_headers[extra_headers_size - len - 1] = 0;
 		strcat(extra_headers, value);
 		return 0;
 	}
+	if (!strcmp(var, "format.suffix")) {
+		if (!value)
+			die("format.suffix without value");
+		fmt_patch_suffix = xstrdup(value);
+		return 0;
+	}
 	if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) {
 		return 0;
 	}
@@ -223,9 +237,10 @@
 	char filename[1024];
 	char *sol;
 	int len = 0;
+	int suffix_len = strlen(fmt_patch_suffix) + 10; /* ., NUL and slop */
 
 	if (output_directory) {
-		strlcpy(filename, output_directory, 1010);
+		strlcpy(filename, output_directory, 1000);
 		len = strlen(filename);
 		if (filename[len - 1] != '/')
 			filename[len++] = '/';
@@ -249,7 +264,10 @@
 			}
 		}
 
-		for (j = 0; len < 1024 - 6 && sol[j] && sol[j] != '\n'; j++) {
+		for (j = 0;
+		     len < sizeof(filename) - suffix_len &&
+			     sol[j] && sol[j] != '\n';
+		     j++) {
 			if (istitlechar(sol[j])) {
 				if (space) {
 					filename[len++] = '-';
@@ -265,7 +283,7 @@
 		while (filename[len - 1] == '.' || filename[len - 1] == '-')
 			len--;
 	}
-	strcpy(filename + len, ".txt");
+	strcpy(filename + len, fmt_patch_suffix);
 	fprintf(realstdout, "%s\n", filename);
 	freopen(filename, "w", stdout);
 }
@@ -334,7 +352,7 @@
 
 static void gen_message_id(char *dest, unsigned int length, char *base)
 {
-	const char *committer = git_committer_info(1);
+	const char *committer = git_committer_info(-1);
 	const char *email_start = strrchr(committer, '<');
 	const char *email_end = strrchr(committer, '>');
 	if(!email_start || !email_end || email_start > email_end - 1)
@@ -362,7 +380,6 @@
 	char message_id[1024];
 	char ref_message_id[1024];
 
-	setup_ident();
 	git_config(git_format_config);
 	init_revisions(&rev, prefix);
 	rev.commit_format = CMIT_FMT_EMAIL;
@@ -436,6 +453,8 @@
 				die("Need a Message-Id for --in-reply-to");
 			in_reply_to = argv[i];
 		}
+		else if (!strncmp(argv[i], "--suffix=", 9))
+			fmt_patch_suffix = argv[i] + 9;
 		else
 			argv[j++] = argv[i];
 	}
@@ -451,9 +470,12 @@
 		die ("unrecognized argument: %s", argv[1]);
 
 	if (!rev.diffopt.output_format)
-		rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;
+		rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH;
 
-	if (!output_directory)
+	if (!rev.diffopt.text)
+		rev.diffopt.binary = 1;
+
+	if (!output_directory && !use_stdout)
 		output_directory = prefix;
 
 	if (output_directory) {
@@ -465,8 +487,13 @@
 	}
 
 	if (rev.pending.nr == 1) {
-		rev.pending.objects[0].item->flags |= UNINTERESTING;
-		add_head(&rev);
+		if (rev.max_count < 0) {
+			rev.pending.objects[0].item->flags |= UNINTERESTING;
+			add_head(&rev);
+		}
+		/* Otherwise, it is "format-patch -22 HEAD", and
+		 * get_revision() would return only the specified count.
+		 */
 	}
 
 	if (ignore_if_in_upstream)
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 42dd8c8..3824ee3 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -569,7 +569,7 @@
 					sha1_to_hex(object_list_sha1), "idx");
 	struct object_entry **list = sorted_by_sha;
 	struct object_entry **last = list + nr_result;
-	unsigned int array[256];
+	uint32_t array[256];
 
 	/*
 	 * Write the first-level table (the list is sorted,
@@ -587,7 +587,7 @@
 		array[i] = htonl(next - sorted_by_sha);
 		list = next;
 	}
-	sha1write(f, array, 256 * sizeof(int));
+	sha1write(f, array, 256 * 4);
 
 	/*
 	 * Write the actual SHA1 entries..
@@ -595,7 +595,7 @@
 	list = sorted_by_sha;
 	for (i = 0; i < nr_result; i++) {
 		struct object_entry *entry = *list++;
-		unsigned int offset = htonl(entry->offset);
+		uint32_t offset = htonl(entry->offset);
 		sha1write(f, &offset, 4);
 		sha1write(f, entry->sha1, 20);
 	}
diff --git a/builtin-pack-refs.c b/builtin-pack-refs.c
index 6de7128..3de9b3e 100644
--- a/builtin-pack-refs.c
+++ b/builtin-pack-refs.c
@@ -37,7 +37,9 @@
 	if ((flags & REF_ISSYMREF))
 		return 0;
 	is_tag_ref = !strncmp(path, "refs/tags/", 10);
-	if (!cb->all && !is_tag_ref)
+
+	/* ALWAYS pack refs that were already packed or are tags */
+	if (!cb->all && !is_tag_ref && !(flags & REF_ISPACKED))
 		return 0;
 
 	fprintf(cb->refs_file, "%s %s\n", sha1_to_hex(sha1), path);
diff --git a/builtin-prune-packed.c b/builtin-prune-packed.c
index a57b76d..9777300 100644
--- a/builtin-prune-packed.c
+++ b/builtin-prune-packed.c
@@ -2,7 +2,7 @@
 #include "cache.h"
 
 static const char prune_packed_usage[] =
-"git-prune-packed [-n]";
+"git-prune-packed [-n] [-q]";
 
 #define DRY_RUN 01
 #define VERBOSE 02
diff --git a/builtin-push.c b/builtin-push.c
index 7a3d2bb..5f4d7d3 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -8,10 +8,10 @@
 
 #define MAX_URI (16)
 
-static const char push_usage[] = "git-push [--all] [--tags] [-f | --force] <repository> [<refspec>...]";
+static const char push_usage[] = "git-push [--all] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]";
 
 static int all, tags, force, thin = 1, verbose;
-static const char *execute;
+static const char *receivepack;
 
 #define BUF_SIZE (2084)
 static char buffer[BUF_SIZE];
@@ -143,6 +143,7 @@
 static int config_repo_len;
 static int config_current_uri;
 static int config_get_refspecs;
+static int config_get_receivepack;
 
 static int get_remote_config(const char* key, const char* value)
 {
@@ -157,6 +158,15 @@
 		else if (config_get_refspecs &&
 			 !strcmp(key + 7 + config_repo_len, ".push"))
 			add_refspec(xstrdup(value));
+		else if (config_get_receivepack &&
+			 !strcmp(key + 7 + config_repo_len, ".receivepack")) {
+			if (!receivepack) {
+				char *rp = xmalloc(strlen(value) + 16);
+				sprintf(rp, "--receive-pack=%s", value);
+				receivepack = rp;
+			} else
+				error("more than one receivepack given, using the first");
+		}
 	}
 	return 0;
 }
@@ -168,6 +178,7 @@
 	config_current_uri = 0;
 	config_uri = uri;
 	config_get_refspecs = !(refspec_nr || all || tags);
+	config_get_receivepack = (receivepack == NULL);
 
 	git_config(get_remote_config);
 	return config_current_uri;
@@ -252,8 +263,8 @@
 		argv[argc++] = "--all";
 	if (force)
 		argv[argc++] = "--force";
-	if (execute)
-		argv[argc++] = execute;
+	if (receivepack)
+		argv[argc++] = receivepack;
 	common_argc = argc;
 
 	for (i = 0; i < n; i++) {
@@ -336,8 +347,12 @@
 			thin = 0;
 			continue;
 		}
+		if (!strncmp(arg, "--receive-pack=", 15)) {
+			receivepack = arg;
+			continue;
+		}
 		if (!strncmp(arg, "--exec=", 7)) {
-			execute = arg;
+			receivepack = arg;
 			continue;
 		}
 		usage(push_usage);
diff --git a/builtin-reflog.c b/builtin-reflog.c
index 7206b7a..b443ed9 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -13,7 +13,7 @@
  */
 
 static const char reflog_expire_usage[] =
-"git-reflog expire [--verbose] [--dry-run] [--fix-stale] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
+"git-reflog expire [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
 
 static unsigned long default_reflog_expire;
 static unsigned long default_reflog_expire_unreachable;
@@ -263,9 +263,6 @@
 	}
 
 	cb.ref_commit = lookup_commit_reference_gently(sha1, 1);
-	if (!cb.ref_commit)
-		fprintf(stderr,
-			"warning: ref '%s' does not point at a commit\n", ref);
 	cb.ref = ref;
 	cb.cmd = cmd;
 	for_each_reflog_ent(ref, expire_reflog_ent, &cb);
diff --git a/builtin-rm.c b/builtin-rm.c
index d81f289c..00dbe39 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -10,7 +10,7 @@
 #include "tree-walk.h"
 
 static const char builtin_rm_usage[] =
-"git-rm [-n] [-f] [--cached] <filepattern>...";
+"git-rm [-f] [-n] [-r] [--cached] [--] <file>...";
 
 static struct {
 	int nr, alloc;
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index c67f2fa..fa62e48 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -4,7 +4,9 @@
 #include "builtin.h"
 
 static const char show_branch_usage[] =
-"git-show-branch [--sparse] [--current] [--all] [--remotes] [--topo-order] [--more=count | --list | --independent | --merge-base ] [--topics] [<refs>...] | --reflog[=n] <branch>";
+"git-show-branch [--sparse] [--current] [--all] [--remotes] [--topo-order] [--more=count | --list | --independent | --merge-base ] [--topics] [<refs>...] | --reflog[=n[,b]] <branch>";
+static const char show_branch_usage_reflog[] =
+"--reflog is incompatible with --all, --remotes, --independent or --merge-base";
 
 static int default_num;
 static int default_alloc;
@@ -346,18 +348,21 @@
 	      compare_ref_name);
 }
 
-static int append_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
+static int append_ref(const char *refname, const unsigned char *sha1,
+		      int allow_dups)
 {
 	struct commit *commit = lookup_commit_reference_gently(sha1, 1);
 	int i;
 
 	if (!commit)
 		return 0;
-	/* Avoid adding the same thing twice */
-	for (i = 0; i < ref_name_cnt; i++)
-		if (!strcmp(refname, ref_name[i]))
-			return 0;
 
+	if (!allow_dups) {
+		/* Avoid adding the same thing twice */
+		for (i = 0; i < ref_name_cnt; i++)
+			if (!strcmp(refname, ref_name[i]))
+				return 0;
+	}
 	if (MAX_REVS <= ref_name_cnt) {
 		fprintf(stderr, "warning: ignoring %s; "
 			"cannot handle more than %d refs\n",
@@ -380,7 +385,7 @@
 	 */
 	if (get_sha1(refname + ofs, tmp) || hashcmp(tmp, sha1))
 		ofs = 5;
-	return append_ref(refname + ofs, sha1, flag, cb_data);
+	return append_ref(refname + ofs, sha1, 0);
 }
 
 static int append_remote_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
@@ -394,14 +399,14 @@
 	 */
 	if (get_sha1(refname + ofs, tmp) || hashcmp(tmp, sha1))
 		ofs = 5;
-	return append_ref(refname + ofs, sha1, flag, cb_data);
+	return append_ref(refname + ofs, sha1, 0);
 }
 
 static int append_tag_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
 {
 	if (strncmp(refname, "refs/tags/", 10))
 		return 0;
-	return append_ref(refname + 5, sha1, flag, cb_data);
+	return append_ref(refname + 5, sha1, 0);
 }
 
 static const char *match_ref_pattern = NULL;
@@ -434,7 +439,7 @@
 		return append_head_ref(refname, sha1, flag, cb_data);
 	if (!strncmp("refs/tags/", refname, 10))
 		return append_tag_ref(refname, sha1, flag, cb_data);
-	return append_ref(refname, sha1, flag, cb_data);
+	return append_ref(refname, sha1, 0);
 }
 
 static void snarf_refs(int head, int remotes)
@@ -507,7 +512,7 @@
 {
 	unsigned char revkey[20];
 	if (!get_sha1(av, revkey)) {
-		append_ref(av, revkey, 0, NULL);
+		append_ref(av, revkey, 0);
 		return;
 	}
 	if (strchr(av, '*') || strchr(av, '?') || strchr(av, '[')) {
@@ -562,9 +567,24 @@
 	return 0;
 }
 
+static void parse_reflog_param(const char *arg, int *cnt, const char **base)
+{
+	char *ep;
+	*cnt = strtoul(arg, &ep, 10);
+	if (*ep == ',')
+		*base = ep + 1;
+	else if (*ep)
+		die("unrecognized reflog param '%s'", arg + 9);
+	else
+		*base = NULL;
+	if (*cnt <= 0)
+		*cnt = DEFAULT_REFLOG;
+}
+
 int cmd_show_branch(int ac, const char **av, const char *prefix)
 {
 	struct commit *rev[MAX_REVS], *commit;
+	char *reflog_msg[MAX_REVS];
 	struct commit_list *list = NULL, *seen = NULL;
 	unsigned int rev_mask[MAX_REVS];
 	int num_rev, i, extra = 0;
@@ -585,6 +605,7 @@
 	int topics = 0;
 	int dense = 1;
 	int reflog = 0;
+	const char *reflog_base = NULL;
 
 	git_config(git_show_branch_config);
 
@@ -628,42 +649,101 @@
 			dense = 0;
 		else if (!strcmp(arg, "--date-order"))
 			lifo = 0;
-		else if (!strcmp(arg, "--reflog")) {
+		else if (!strcmp(arg, "--reflog") || !strcmp(arg, "-g")) {
 			reflog = DEFAULT_REFLOG;
 		}
-		else if (!strncmp(arg, "--reflog=", 9)) {
-			char *end;
-			reflog = strtoul(arg + 9, &end, 10);
-			if (*end != '\0')
-				die("unrecognized reflog count '%s'", arg + 9);
-		}
+		else if (!strncmp(arg, "--reflog=", 9))
+			parse_reflog_param(arg + 9, &reflog, &reflog_base);
+		else if (!strncmp(arg, "-g=", 3))
+			parse_reflog_param(arg + 3, &reflog, &reflog_base);
 		else
 			usage(show_branch_usage);
 		ac--; av++;
 	}
 	ac--; av++;
 
-	/* Only one of these is allowed */
-	if (1 < independent + merge_base + (extra != 0) + (!!reflog))
-		usage(show_branch_usage);
+	if (extra || reflog) {
+		/* "listing" mode is incompatible with
+		 * independent nor merge-base modes.
+		 */
+		if (independent || merge_base)
+			usage(show_branch_usage);
+		if (reflog && ((0 < extra) || all_heads || all_remotes))
+			/*
+			 * Asking for --more in reflog mode does not
+			 * make sense.  --list is Ok.
+			 *
+			 * Also --all and --remotes do not make sense either.
+			 */
+			usage(show_branch_usage_reflog);
+	}
 
 	/* If nothing is specified, show all branches by default */
 	if (ac + all_heads + all_remotes == 0)
 		all_heads = 1;
 
-	if (all_heads + all_remotes)
-		snarf_refs(all_heads, all_remotes);
 	if (reflog) {
-		int reflen;
-		if (!ac)
+		unsigned char sha1[20];
+		char nth_desc[256];
+		char *ref;
+		int base = 0;
+
+		if (ac == 0) {
+			static const char *fake_av[2];
+			fake_av[0] = "HEAD";
+			fake_av[1] = NULL;
+			av = fake_av;
+			ac = 1;
+		}
+		if (ac != 1)
 			die("--reflog option needs one branch name");
-		reflen = strlen(*av);
+
+		if (MAX_REVS < reflog)
+			die("Only %d entries can be shown at one time.",
+			    MAX_REVS);
+		if (!dwim_ref(*av, strlen(*av), sha1, &ref))
+			die("No such ref %s", *av);
+
+		/* Has the base been specified? */
+		if (reflog_base) {
+			char *ep;
+			base = strtoul(reflog_base, &ep, 10);
+			if (*ep) {
+				/* Ah, that is a date spec... */
+				unsigned long at;
+				at = approxidate(reflog_base);
+				read_ref_at(ref, at, -1, sha1, NULL,
+					    NULL, NULL, &base);
+			}
+		}
+
 		for (i = 0; i < reflog; i++) {
-			char *name = xmalloc(reflen + 20);
-			sprintf(name, "%s@{%d}", *av, i);
-			append_one_rev(name);
+			char *logmsg, *msg, *m;
+			unsigned long timestamp;
+			int tz;
+
+			if (read_ref_at(ref, 0, base+i, sha1, &logmsg,
+					&timestamp, &tz, NULL)) {
+				reflog = i;
+				break;
+			}
+			msg = strchr(logmsg, '\t');
+			if (!msg)
+				msg = "(none)";
+			else
+				msg++;
+			m = xmalloc(strlen(msg) + 200);
+			sprintf(m, "(%s) %s",
+				show_date(timestamp, tz, 1),
+				msg);
+			reflog_msg[i] = m;
+			free(logmsg);
+			sprintf(nth_desc, "%s@{%d}", *av, base+i);
+			append_ref(nth_desc, sha1, 1);
 		}
 	}
+	else if (all_heads + all_remotes)
+		snarf_refs(all_heads, all_remotes);
 	else {
 		while (0 < ac) {
 			append_one_rev(*av);
@@ -760,8 +840,14 @@
 				printf("%c [%s] ",
 				       is_head ? '*' : '!', ref_name[i]);
 			}
-			/* header lines never need name */
-			show_one_commit(rev[i], 1);
+
+			if (!reflog) {
+				/* header lines never need name */
+				show_one_commit(rev[i], 1);
+			}
+			else
+				puts(reflog_msg[i]);
+
 			if (is_head)
 				head_at = i;
 		}
diff --git a/builtin-symbolic-ref.c b/builtin-symbolic-ref.c
index d8be052..227c9d4 100644
--- a/builtin-symbolic-ref.c
+++ b/builtin-symbolic-ref.c
@@ -3,9 +3,9 @@
 #include "refs.h"
 
 static const char git_symbolic_ref_usage[] =
-"git-symbolic-ref name [ref]";
+"git-symbolic-ref [-q] name [ref]";
 
-static void check_symref(const char *HEAD)
+static void check_symref(const char *HEAD, int quiet)
 {
 	unsigned char sha1[20];
 	int flag;
@@ -13,17 +13,41 @@
 
 	if (!refs_heads_master)
 		die("No such ref: %s", HEAD);
-	else if (!(flag & REF_ISSYMREF))
-		die("ref %s is not a symbolic ref", HEAD);
+	else if (!(flag & REF_ISSYMREF)) {
+		if (!quiet)
+			die("ref %s is not a symbolic ref", HEAD);
+		else
+			exit(1);
+	}
 	puts(refs_heads_master);
 }
 
 int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
 {
+	int quiet = 0;
+
 	git_config(git_default_config);
+
+	while (1 < argc) {
+		const char *arg = argv[1];
+		if (arg[0] != '-')
+			break;
+		else if (!strcmp("-q", arg))
+			quiet = 1;
+		else if (!strcmp("--", arg)) {
+			argc--;
+			argv++;
+			break;
+		}
+		else
+			die("unknown option %s", arg);
+		argc--;
+		argv++;
+	}
+
 	switch (argc) {
 	case 2:
-		check_symref(argv[1]);
+		check_symref(argv[1], quiet);
 		break;
 	case 3:
 		create_symref(argv[1], argv[2]);
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 182331d..1ac613a 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -501,6 +501,7 @@
 
 	for (i = 1 ; i < argc; i++) {
 		const char *path = argv[i];
+		const char *p;
 
 		if (allow_options && *path == '-') {
 			if (!strcmp(path, "--")) {
@@ -616,9 +617,12 @@
 				usage(update_index_usage);
 			die("unknown option %s", path);
 		}
-		update_one(path, prefix, prefix_length);
+		p = prefix_path(prefix, prefix_length, path);
+		update_one(p, NULL, 0);
 		if (set_executable_bit)
-			chmod_path(set_executable_bit, path);
+			chmod_path(set_executable_bit, p);
+		if (p < path || p > path + strlen(path))
+			free((char*)p);
 	}
 	if (read_from_stdin) {
 		struct strbuf buf;
diff --git a/builtin-update-ref.c b/builtin-update-ref.c
index b34e598..5ee960b 100644
--- a/builtin-update-ref.c
+++ b/builtin-update-ref.c
@@ -13,7 +13,6 @@
 	int i, delete;
 
 	delete = 0;
-	setup_ident();
 	git_config(git_default_config);
 
 	for (i = 1; i < argc; i++) {
@@ -62,10 +61,8 @@
 
 	lock = lock_any_ref_for_update(refname, oldval ? oldsha1 : NULL);
 	if (!lock)
-		return 1;
+		die("%s: cannot lock the ref", refname);
 	if (write_ref_sha1(lock, sha1, msg) < 0)
-		return 1;
-
-	/* write_ref_sha1 always unlocks the ref, no need to do it explicitly */
+		die("%s: cannot update the ref", refname);
 	return 0;
 }
diff --git a/builtin.h b/builtin.h
index 0b3c9f6..dd0e352 100644
--- a/builtin.h
+++ b/builtin.h
@@ -34,6 +34,7 @@
 extern int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix);
 extern int cmd_for_each_ref(int argc, const char **argv, const char *prefix);
 extern int cmd_format_patch(int argc, const char **argv, const char *prefix);
+extern int cmd_fsck(int argc, const char **argv, const char *prefix);
 extern int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix);
 extern int cmd_grep(int argc, const char **argv, const char *prefix);
 extern int cmd_help(int argc, const char **argv, const char *prefix);
@@ -53,7 +54,7 @@
 extern int cmd_push(int argc, const char **argv, const char *prefix);
 extern int cmd_read_tree(int argc, const char **argv, const char *prefix);
 extern int cmd_reflog(int argc, const char **argv, const char *prefix);
-extern int cmd_repo_config(int argc, const char **argv, const char *prefix);
+extern int cmd_config(int argc, const char **argv, const char *prefix);
 extern int cmd_rerere(int argc, const char **argv, const char *prefix);
 extern int cmd_rev_list(int argc, const char **argv, const char *prefix);
 extern int cmd_rev_parse(int argc, const char **argv, const char *prefix);
diff --git a/cache.h b/cache.h
index 620b6a4..9873ee9 100644
--- a/cache.h
+++ b/cache.h
@@ -129,6 +129,7 @@
 
 extern int is_bare_repository_cfg;
 extern int is_bare_repository(void);
+extern int is_inside_git_dir(void);
 extern const char *get_git_dir(void);
 extern char *get_object_directory(void);
 extern char *get_refs_directory(void);
@@ -299,6 +300,8 @@
 extern char *sha1_to_hex(const unsigned char *sha1);	/* static buffer result! */
 extern int read_ref(const char *filename, unsigned char *sha1);
 extern const char *resolve_ref(const char *path, unsigned char *sha1, int, int *);
+extern int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref);
+
 extern int create_symref(const char *ref, const char *refs_heads_master);
 extern int validate_headref(const char *ref);
 
@@ -316,8 +319,6 @@
 void datestamp(char *buf, int bufsize);
 unsigned long approxidate(const char *);
 
-extern int setup_ident(void);
-extern void ignore_missing_committer_name();
 extern const char *git_author_info(int);
 extern const char *git_committer_info(int);
 
@@ -351,7 +352,7 @@
 extern struct packed_git {
 	struct packed_git *next;
 	struct pack_window *windows;
-	unsigned int *index_base;
+	uint32_t *index_base;
 	off_t index_size;
 	off_t pack_size;
 	int pack_fd;
@@ -400,7 +401,7 @@
 extern struct packed_git *find_sha1_pack(const unsigned char *sha1, 
 					 struct packed_git *packs);
 
-extern void pack_report();
+extern void pack_report(void);
 extern unsigned char* use_pack(struct packed_git *, struct pack_window **, unsigned long, unsigned int *);
 extern void unuse_pack(struct pack_window **);
 extern struct packed_git *add_packed_git(char *, int, int);
diff --git a/commit.h b/commit.h
index 936f8fc..491b0c4 100644
--- a/commit.h
+++ b/commit.h
@@ -110,7 +110,7 @@
 extern int register_shallow(const unsigned char *sha1);
 extern int unregister_shallow(const unsigned char *sha1);
 extern int write_shallow_commits(int fd, int use_pack_protocol);
-extern int is_repository_shallow();
+extern int is_repository_shallow(void);
 extern struct commit_list *get_shallow_commits(struct object_array *heads,
 		int depth, int shallow_flag, int not_shallow_flag);
 
diff --git a/config.c b/config.c
index b6082f5..c08c668 100644
--- a/config.c
+++ b/config.c
@@ -661,6 +661,11 @@
 				goto out_free;
 			}
 			c = tolower(c);
+		} else if (c == '\n') {
+			fprintf(stderr, "invalid key (newline): %s\n", key);
+			free(store.key);
+			ret = 1;
+			goto out_free;
 		}
 		store.key[i] = c;
 	}
diff --git a/connect.c b/connect.c
index 66daa11..7844888 100644
--- a/connect.c
+++ b/connect.c
@@ -529,7 +529,7 @@
 	int sockfd = git_tcp_connect_sock(host);
 
 	fd[0] = sockfd;
-	fd[1] = sockfd;
+	fd[1] = dup(sockfd);
 }
 
 
diff --git a/contrib/blameview/README b/contrib/blameview/README
new file mode 100644
index 0000000..50a6f67
--- /dev/null
+++ b/contrib/blameview/README
@@ -0,0 +1,10 @@
+This is a sample program to use 'git-blame --incremental', based
+on this message.
+
+From: Jeff King <peff@peff.net>
+Subject: Re: More precise tag following
+To: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: git@vger.kernel.org
+Date: Sat, 27 Jan 2007 18:52:38 -0500
+Message-ID: <20070127235238.GA28706@coredump.intra.peff.net>
+
diff --git a/contrib/blameview/blameview.perl b/contrib/blameview/blameview.perl
new file mode 100755
index 0000000..5e9a67c
--- /dev/null
+++ b/contrib/blameview/blameview.perl
@@ -0,0 +1,119 @@
+#!/usr/bin/perl
+
+use Gtk2 -init;
+use Gtk2::SimpleList;
+
+my $fn = shift or die "require filename to blame";
+
+Gtk2::Rc->parse_string(<<'EOS');
+style "treeview_style"
+{
+  GtkTreeView::vertical-separator = 0
+}
+class "GtkTreeView" style "treeview_style"
+EOS
+
+my $window = Gtk2::Window->new('toplevel');
+$window->signal_connect(destroy => sub { Gtk2->main_quit });
+my $scrolled_window = Gtk2::ScrolledWindow->new;
+$window->add($scrolled_window);
+my $fileview = Gtk2::SimpleList->new(
+    'Commit' => 'text',
+    'CommitInfo' => 'text',
+    'FileLine' => 'text',
+    'Data' => 'text'
+);
+$scrolled_window->add($fileview);
+$fileview->get_column(0)->set_spacing(0);
+$fileview->set_size_request(1024, 768);
+$fileview->set_rules_hint(1);
+
+my $fh;
+open($fh, '-|', "git cat-file blob HEAD:$fn")
+  or die "unable to open $fn: $!";
+while(<$fh>) {
+  chomp;
+  $fileview->{data}->[$.] = ['HEAD', '?', "$fn:$.", $_];
+}
+
+my $blame;
+open($blame, '-|', qw(git blame --incremental --), $fn)
+    or die "cannot start git-blame $fn";
+
+Glib::IO->add_watch(fileno($blame), 'in', \&read_blame_line);
+
+$window->show_all;
+Gtk2->main;
+exit 0;
+
+my %commitinfo = ();
+
+sub flush_blame_line {
+	my ($attr) = @_;
+
+	return unless defined $attr;
+
+	my ($commit, $s_lno, $lno, $cnt) =
+	    @{$attr}{qw(COMMIT S_LNO LNO CNT)};
+
+	my ($filename, $author, $author_time, $author_tz) =
+	    @{$commitinfo{$commit}}{qw(FILENAME AUTHOR AUTHOR-TIME AUTHOR-TZ)};
+	my $info = $author . ' ' . format_time($author_time, $author_tz);
+
+	for(my $i = 0; $i < $cnt; $i++) {
+		@{$fileview->{data}->[$lno+$i-1]}[0,1,2] =
+		    (substr($commit, 0, 8), $info,
+		     $filename . ':' . ($s_lno+$i));
+	}
+}
+
+my $buf;
+my $current;
+sub read_blame_line {
+
+	my $r = sysread($blame, $buf, 1024, length($buf));
+	die "I/O error" unless defined $r;
+
+	if ($r == 0) {
+		flush_blame_line($current);
+		$current = undef;
+		return 0;
+	}
+
+	while ($buf =~ s/([^\n]*)\n//) {
+		my $line = $1;
+
+		if (($commit, $s_lno, $lno, $cnt) =
+		    ($line =~ /^([0-9a-f]{40}) (\d+) (\d+) (\d+)$/)) {
+			flush_blame_line($current);
+			$current = +{
+				COMMIT => $1,
+				S_LNO => $2,
+				LNO => $3,
+				CNT => $4,
+			};
+			next;
+		}
+
+		# extended attribute values
+		if ($line =~ /^(author|author-mail|author-time|author-tz|committer|committer-mail|committer-time|committer-tz|summary|filename) (.*)$/) {
+			my $commit = $current->{COMMIT};
+			$commitinfo{$commit}{uc($1)} = $2;
+			next;
+		}
+	}
+	return 1;
+}
+
+sub format_time {
+  my $time = shift;
+  my $tz = shift;
+
+  my $minutes = $tz < 0 ? 0-$tz : $tz;
+  $minutes = ($minutes / 100)*60 + ($minutes % 100);
+  $minutes = $tz < 0 ? 0-$minutes : $minutes;
+  $time += $minutes * 60;
+  my @t = gmtime($time);
+  return sprintf('%04d-%02d-%02d %02d:%02d:%02d %s',
+		 $t[5] + 1900, @t[4,3,2,1,0], $tz);
+}
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 7c7520e..83c69ec 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -145,7 +145,7 @@
 		echo ${i#$d/remotes/}
 	done
 	[ "$ngoff" ] && shopt -u nullglob
-	for i in $(git --git-dir="$d" repo-config --list); do
+	for i in $(git --git-dir="$d" config --list); do
 		case "$i" in
 		remote.*.url=*)
 			i="${i#remote.}"
@@ -286,7 +286,7 @@
 __git_aliases ()
 {
 	local i IFS=$'\n'
-	for i in $(git --git-dir="$(__gitdir)" repo-config --list); do
+	for i in $(git --git-dir="$(__gitdir)" config --list); do
 		case "$i" in
 		alias.*)
 			i="${i#alias.}"
@@ -299,7 +299,7 @@
 __git_aliased_command ()
 {
 	local word cmdline=$(git --git-dir="$(__gitdir)" \
-		repo-config --get "alias.$1")
+		config --get "alias.$1")
 	for word in $cmdline; do
 		if [ "${word##-*}" ]; then
 			echo $word
@@ -629,7 +629,7 @@
 	COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
 }
 
-_git_repo_config ()
+_git_config ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
 	local prv="${COMP_WORDS[COMP_CWORD-1]}"
@@ -806,6 +806,7 @@
 	checkout)    _git_checkout ;;
 	cherry-pick) _git_cherry_pick ;;
 	commit)      _git_commit ;;
+	config)      _git_config ;;
 	diff)        _git_diff ;;
 	diff-tree)   _git_diff_tree ;;
 	fetch)       _git_fetch ;;
@@ -819,7 +820,7 @@
 	pull)        _git_pull ;;
 	push)        _git_push ;;
 	rebase)      _git_rebase ;;
-	repo-config) _git_repo_config ;;
+	repo-config) _git_config ;;
 	reset)       _git_reset ;;
 	show)        _git_show ;;
 	show-branch) _git_log ;;
@@ -856,7 +857,7 @@
 complete -o default -o nospace -F _git_pull git-pull
 complete -o default -o nospace -F _git_push git-push
 complete -o default            -F _git_rebase git-rebase
-complete -o default            -F _git_repo_config git-repo-config
+complete -o default            -F _git_config git-config
 complete -o default            -F _git_reset git-reset
 complete -o default -o nospace -F _git_show git-show
 complete -o default -o nospace -F _git_log git-show-branch
@@ -879,7 +880,7 @@
 complete -o default            -F _git_merge_base git-merge-base.exe
 complete -o default            -F _git_name_rev git-name-rev.exe
 complete -o default -o nospace -F _git_push git-push.exe
-complete -o default            -F _git_repo_config git-repo-config
+complete -o default            -F _git_config git-config
 complete -o default -o nospace -F _git_show git-show.exe
 complete -o default -o nospace -F _git_log git-show-branch.exe
 complete -o default -o nospace -F _git_log git-whatchanged.exe
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index d90ba81..24629eb 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -222,7 +222,7 @@
   "Return the name to use as GIT_COMMITTER_NAME."
   ; copied from log-edit
   (or git-committer-name
-      (git-repo-config "user.name")
+      (git-config "user.name")
       (and (boundp 'add-log-full-name) add-log-full-name)
       (and (fboundp 'user-full-name) (user-full-name))
       (and (boundp 'user-full-name) user-full-name)))
@@ -231,7 +231,7 @@
   "Return the email address to use as GIT_COMMITTER_EMAIL."
   ; copied from log-edit
   (or git-committer-email
-      (git-repo-config "user.email")
+      (git-config "user.email")
       (and (boundp 'add-log-mailing-address) add-log-mailing-address)
       (and (fboundp 'user-mail-address) (user-mail-address))
       (and (boundp 'user-mail-address) user-mail-address)))
@@ -298,9 +298,9 @@
   (git-get-string-sha1
    (git-call-process-env-string nil "rev-parse" rev)))
 
-(defun git-repo-config (key)
+(defun git-config (key)
   "Retrieve the value associated to KEY in the git repository config file."
-  (let ((str (git-call-process-env-string nil "repo-config" key)))
+  (let ((str (git-call-process-env-string nil "config" key)))
     (and str (car (split-string str "\n")))))
 
 (defun git-symbolic-ref (ref)
diff --git a/contrib/emacs/vc-git.el b/contrib/emacs/vc-git.el
index 3eb4bd1..e456ab9 100644
--- a/contrib/emacs/vc-git.el
+++ b/contrib/emacs/vc-git.el
@@ -120,7 +120,16 @@
     (vc-git--run-command file "commit" "-m" comment "--only" "--")))
 
 (defun vc-git-checkout (file &optional editable rev destfile)
-  (vc-git--run-command file "checkout" (or rev "HEAD")))
+  (if destfile
+      (let ((fullname (substring
+                       (vc-git--run-command-string file "ls-files" "-z" "--full-name" "--")
+                       0 -1))
+            (coding-system-for-read 'no-conversion)
+            (coding-system-for-write 'no-conversion))
+        (with-temp-file destfile
+          (eq 0 (call-process "git" nil t nil "cat-file" "blob"
+                              (concat (or rev "HEAD") ":" fullname)))))
+    (vc-git--run-command file "checkout" (or rev "HEAD"))))
 
 (defun vc-git-annotate-command (file buf &optional rev)
   ; FIXME: rev is ignored
diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview
index 3b6bdce..521b2fc 100755
--- a/contrib/gitview/gitview
+++ b/contrib/gitview/gitview
@@ -497,7 +497,7 @@
 		fp.close()
 
 	def get_encoding(self):
-		fp = os.popen("git repo-config --get i18n.commitencoding")
+		fp = os.popen("git config --get i18n.commitencoding")
 		self.encoding=string.strip(fp.readline())
 		fp.close()
 		if (self.encoding == ""):
diff --git a/contrib/remotes2config.sh b/contrib/remotes2config.sh
index 25901e2..dc09eae 100644
--- a/contrib/remotes2config.sh
+++ b/contrib/remotes2config.sh
@@ -11,7 +11,7 @@
 	{
 		cd "$GIT_DIR"/remotes
 		ls | while read f; do
-			name=$(echo -n "$f" | tr -c "A-Za-z0-9" ".")
+			name=$(printf "$f" | tr -c "A-Za-z0-9" ".")
 			sed -n \
 			-e "s/^URL: \(.*\)$/remote.$name.url \1 ./p" \
 			-e "s/^Pull: \(.*\)$/remote.$name.fetch \1 ^$ /p" \
@@ -26,8 +26,8 @@
 				mv "$GIT_DIR"/remotes "$GIT_DIR"/remotes.old
 			fi ;;
 		*)
-			echo "git-repo-config $key "$value" $regex"
-			git-repo-config $key "$value" $regex || error=1 ;;
+			echo "git-config $key "$value" $regex"
+			git-config $key "$value" $regex || error=1 ;;
 		esac
 	done
 fi
diff --git a/contrib/vim/syntax/gitcommit.vim b/contrib/vim/syntax/gitcommit.vim
index d911efb..332121b 100644
--- a/contrib/vim/syntax/gitcommit.vim
+++ b/contrib/vim/syntax/gitcommit.vim
@@ -1,7 +1,7 @@
 syn region gitLine start=/^#/ end=/$/
-syn region gitCommit start=/^# Added but not yet committed:$/ end=/^#$/ contains=gitHead,gitCommitFile
+syn region gitCommit start=/^# Changes to be committed:$/ end=/^#$/ contains=gitHead,gitCommitFile
 syn region gitHead contained start=/^#   (.*)/ end=/^#$/
-syn region gitChanged start=/^# Changed but not added:/ end=/^#$/ contains=gitHead,gitChangedFile
+syn region gitChanged start=/^# Changed but not updated:/ end=/^#$/ contains=gitHead,gitChangedFile
 syn region gitUntracked start=/^# Untracked files:/ end=/^#$/ contains=gitHead,gitUntrackedFile
 
 syn match gitCommitFile contained /^#\t.*/hs=s+2
diff --git a/daemon.c b/daemon.c
index f039534..9590372 100644
--- a/daemon.c
+++ b/daemon.c
@@ -372,9 +372,16 @@
 	return -1;
 }
 
+static int receive_pack(void)
+{
+	execl_git_cmd("receive-pack", ".", NULL);
+	return -1;
+}
+
 static struct daemon_service daemon_service[] = {
 	{ "upload-archive", "uploadarch", upload_archive, 0, 1 },
 	{ "upload-pack", "uploadpack", upload_pack, 1, 1 },
+	{ "receive-pack", "receivepack", receive_pack, 0, 1 },
 };
 
 static void enable_service(const char *name, int ena) {
diff --git a/date.c b/date.c
index 7acb8cb..542c004 100644
--- a/date.c
+++ b/date.c
@@ -62,12 +62,11 @@
 
 	if (relative) {
 		unsigned long diff;
-		time_t t = gm_time_t(time, tz);
 		struct timeval now;
 		gettimeofday(&now, NULL);
-		if (now.tv_sec < t)
+		if (now.tv_sec < time)
 			return "in the future";
-		diff = now.tv_sec - t;
+		diff = now.tv_sec - time;
 		if (diff < 90) {
 			snprintf(timebuf, sizeof(timebuf), "%lu seconds ago", diff);
 			return timebuf;
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index de44ada..286919e 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -14,6 +14,8 @@
 	const char *data;
 	if (diff_populate_filespec(one, 0))
 		return 0;
+	if (!len)
+		return 0;
 
 	sz = one->size;
 	data = one->data;
diff --git a/fetch-pack.c b/fetch-pack.c
index 1530a94..c787106 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -4,16 +4,20 @@
 #include "commit.h"
 #include "tag.h"
 #include "exec_cmd.h"
+#include "pack.h"
 #include "sideband.h"
 
 static int keep_pack;
+static int transfer_unpack_limit = -1;
+static int fetch_unpack_limit = -1;
+static int unpack_limit = 100;
 static int quiet;
 static int verbose;
 static int fetch_all;
 static int depth;
 static const char fetch_pack_usage[] =
-"git-fetch-pack [--all] [-q] [-v] [-k] [--thin] [--exec=upload-pack] [--depth=<n>] [host:]directory <refs>...";
-static const char *exec = "git-upload-pack";
+"git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=<git-upload-pack>] [--depth=<n>] [-v] [<host>:]<directory> [<refs>...]";
+static const char *uploadpack = "git-upload-pack";
 
 #define COMPLETE	(1U << 0)
 #define COMMON		(1U << 1)
@@ -486,13 +490,58 @@
 	return side_pid;
 }
 
-static int get_pack(int xd[2], const char **argv)
+static int get_pack(int xd[2])
 {
 	int status;
 	pid_t pid, side_pid;
 	int fd[2];
+	const char *argv[20];
+	char keep_arg[256];
+	char hdr_arg[256];
+	const char **av;
+	int do_keep = keep_pack;
 
 	side_pid = setup_sideband(fd, xd);
+
+	av = argv;
+	*hdr_arg = 0;
+	if (unpack_limit) {
+		struct pack_header header;
+
+		if (read_pack_header(fd[0], &header))
+			die("protocol error: bad pack header");
+		snprintf(hdr_arg, sizeof(hdr_arg), "--pack_header=%u,%u",
+			 ntohl(header.hdr_version), ntohl(header.hdr_entries));
+		if (ntohl(header.hdr_entries) < unpack_limit)
+			do_keep = 0;
+		else
+			do_keep = 1;
+	}
+
+	if (do_keep) {
+		*av++ = "index-pack";
+		*av++ = "--stdin";
+		if (!quiet)
+			*av++ = "-v";
+		if (use_thin_pack)
+			*av++ = "--fix-thin";
+		if (keep_pack > 1 || unpack_limit) {
+			int s = sprintf(keep_arg,
+					"--keep=fetch-pack %d on ", getpid());
+			if (gethostname(keep_arg + s, sizeof(keep_arg) - s))
+				strcpy(keep_arg + s, "localhost");
+			*av++ = keep_arg;
+		}
+	}
+	else {
+		*av++ = "unpack-objects";
+		if (quiet)
+			*av++ = "-q";
+	}
+	if (*hdr_arg)
+		*av++ = hdr_arg;
+	*av++ = NULL;
+
 	pid = fork();
 	if (pid < 0)
 		die("fetch-pack: unable to fork off %s", argv[0]);
@@ -522,39 +571,10 @@
 	die("%s died of unnatural causes %d", argv[0], status);
 }
 
-static int explode_rx_pack(int xd[2])
-{
-	const char *argv[3] = { "unpack-objects", quiet ? "-q" : NULL, NULL };
-	return get_pack(xd, argv);
-}
-
-static int keep_rx_pack(int xd[2])
-{
-	const char *argv[6];
-	char keep_arg[256];
-	int n = 0;
-
-	argv[n++] = "index-pack";
-	argv[n++] = "--stdin";
-	if (!quiet)
-		argv[n++] = "-v";
-	if (use_thin_pack)
-		argv[n++] = "--fix-thin";
-	if (keep_pack > 1) {
-		int s = sprintf(keep_arg, "--keep=fetch-pack %i on ", getpid());
-		if (gethostname(keep_arg + s, sizeof(keep_arg) - s))
-			strcpy(keep_arg + s, "localhost");
-		argv[n++] = keep_arg;
-	}
-	argv[n] = NULL;
-	return get_pack(xd, argv);
-}
-
 static int fetch_pack(int fd[2], int nr_match, char **match)
 {
 	struct ref *ref;
 	unsigned char sha1[20];
-	int status;
 
 	get_remote_heads(fd[0], &ref, 0, NULL, 0);
 	if (is_repository_shallow() && !server_supports("shallow"))
@@ -589,8 +609,7 @@
 			 */
 			fprintf(stderr, "warning: no common commits\n");
 
-	status = (keep_pack) ? keep_rx_pack(fd) : explode_rx_pack(fd);
-	if (status)
+	if (get_pack(fd))
 		die("git-fetch-pack: fetch failed.");
 
  all_done:
@@ -625,6 +644,21 @@
 	return dst;
 }
 
+static int fetch_pack_config(const char *var, const char *value)
+{
+	if (strcmp(var, "fetch.unpacklimit") == 0) {
+		fetch_unpack_limit = git_config_int(var, value);
+		return 0;
+	}
+
+	if (strcmp(var, "transfer.unpacklimit") == 0) {
+		transfer_unpack_limit = git_config_int(var, value);
+		return 0;
+	}
+
+	return git_default_config(var, value);
+}
+
 static struct lock_file lock;
 
 int main(int argc, char **argv)
@@ -636,6 +670,12 @@
 	struct stat st;
 
 	setup_git_directory();
+	git_config(fetch_pack_config);
+
+	if (0 <= transfer_unpack_limit)
+		unpack_limit = transfer_unpack_limit;
+	else if (0 <= fetch_unpack_limit)
+		unpack_limit = fetch_unpack_limit;
 
 	nr_heads = 0;
 	heads = NULL;
@@ -643,8 +683,12 @@
 		char *arg = argv[i];
 
 		if (*arg == '-') {
+			if (!strncmp("--upload-pack=", arg, 14)) {
+				uploadpack = arg + 14;
+				continue;
+			}
 			if (!strncmp("--exec=", arg, 7)) {
-				exec = arg + 7;
+				uploadpack = arg + 7;
 				continue;
 			}
 			if (!strcmp("--quiet", arg) || !strcmp("-q", arg)) {
@@ -653,6 +697,7 @@
 			}
 			if (!strcmp("--keep", arg) || !strcmp("-k", arg)) {
 				keep_pack++;
+				unpack_limit = 0;
 				continue;
 			}
 			if (!strcmp("--thin", arg)) {
@@ -682,7 +727,7 @@
 	}
 	if (!dest)
 		usage(fetch_pack_usage);
-	pid = git_connect(fd, dest, exec);
+	pid = git_connect(fd, dest, uploadpack);
 	if (pid < 0)
 		return 1;
 	if (heads && nr_heads)
diff --git a/git-checkout.sh b/git-checkout.sh
index 66e40b9..0bae86e 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -155,10 +155,10 @@
 	detached="$new"
 	if test -n "$oldbranch"
 	then
-		detach_warn="warning: you are not on ANY branch anymore.
-If you meant to create a new branch from the commit, you need -b to
-associate a new branch with the wanted checkout.  Example:
-  git checkout -b <new_branch_name> $arg"
+		detach_warn="Note: you are not on ANY branch anymore.
+If you want to create a new branch from this checkout, you may do so
+(now or later) by using -b with the checkout command again. Example:
+  git checkout -b <new_branch_name>"
 	fi
 elif test -z "$oldbranch" && test -n "$branch"
 then
@@ -200,16 +200,12 @@
 	# Match the index to the working tree, and do a three-way.
     	git diff-files --name-only | git update-index --remove --stdin &&
 	work=`git write-tree` &&
-	git read-tree --reset -u $new &&
-	git read-tree -m -u --aggressive --exclude-per-directory=.gitignore $old $new $work ||
-	exit
+	git read-tree --reset -u $new || exit
 
-	if result=`git write-tree 2>/dev/null`
-	then
-	    echo >&2 "Trivially automerged."
-	else
-	    git merge-index -o git-merge-one-file -a
-	fi
+	eval GITHEAD_$new=${new_name:-${branch:-$new}} &&
+	eval GITHEAD_$work=local &&
+	export GITHEAD_$new GITHEAD_$work &&
+	git merge-recursive $old -- $new $work
 
 	# Do not register the cleanly merged paths in the index yet.
 	# this is not a real merge before committing, but just carrying
diff --git a/git-clone.sh b/git-clone.sh
index 0f7bbbf..4ddfa77 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -36,7 +36,7 @@
 	clone_tmp="$GIT_DIR/clone-tmp" &&
 	mkdir -p "$clone_tmp" || exit 1
 	if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \
-		"`git-repo-config --bool http.noEPSV`" = true ]; then
+		"`git-config --bool http.noEPSV`" = true ]; then
 		curl_extra_args="${curl_extra_args} --disable-epsv"
 	fi
 	http_fetch "$1/info/refs" "$clone_tmp/refs" ||
@@ -66,48 +66,6 @@
 	rm -f "$GIT_DIR/REMOTE_HEAD"
 }
 
-# Read git-fetch-pack -k output and store the remote branches.
-copy_refs='
-use File::Path qw(mkpath);
-use File::Basename qw(dirname);
-my $git_dir = $ARGV[0];
-my $use_separate_remote = $ARGV[1];
-my $origin = $ARGV[2];
-
-my $branch_top = ($use_separate_remote ? "remotes/$origin" : "heads");
-my $tag_top = "tags";
-
-sub store {
-	my ($sha1, $name, $top) = @_;
-	$name = "$git_dir/refs/$top/$name";
-	mkpath(dirname($name));
-	open O, ">", "$name";
-	print O "$sha1\n";
-	close O;
-}
-
-open FH, "<", "$git_dir/CLONE_HEAD";
-while (<FH>) {
-	my ($sha1, $name) = /^([0-9a-f]{40})\s(.*)$/;
-	next if ($name =~ /\^\173/);
-	if ($name eq "HEAD") {
-		open O, ">", "$git_dir/REMOTE_HEAD";
-		print O "$sha1\n";
-		close O;
-		next;
-	}
-	if ($name =~ s/^refs\/heads\///) {
-		store($sha1, $name, $branch_top);
-		next;
-	}
-	if ($name =~ s/^refs\/tags\///) {
-		store($sha1, $name, $tag_top);
-		next;
-	}
-}
-close FH;
-'
-
 quiet=
 local=no
 use_local=no
@@ -163,7 +121,9 @@
 	1,-u|1,--upload-pack) usage ;;
 	*,-u|*,--upload-pack)
 		shift
-		upload_pack="--exec=$1" ;;
+		upload_pack="--upload-pack=$1" ;;
+	*,--upload-pack=*)
+		upload_pack=--upload-pack=$(expr "z$1" : 'z-[^=]*=\(.*\)') ;;
 	1,--depth) usage;;
 	*,--depth)
 		shift
@@ -330,8 +290,29 @@
 if test -f "$GIT_DIR/CLONE_HEAD"
 then
 	# Read git-fetch-pack -k output and store the remote branches.
-	@@PERL@@ -e "$copy_refs" "$GIT_DIR" "$use_separate_remote" "$origin" ||
-	exit
+	if [ -n "$use_separate_remote" ]
+	then
+		branch_top="remotes/$origin"
+	else
+		branch_top="heads"
+	fi
+	tag_top="tags"
+	while read sha1 name
+	do
+		case "$name" in
+		*'^{}')
+			continue ;;
+		HEAD)
+			destname="REMOTE_HEAD" ;;
+		refs/heads/*)
+			destname="refs/$branch_top/${name#refs/heads/}" ;;
+		refs/tags/*)
+			destname="refs/$tag_top/${name#refs/tags/}" ;;
+		*)
+			continue ;;
+		esac
+		git-update-ref -m "clone: from $repo" "$destname" "$sha1" ""
+	done < "$GIT_DIR/CLONE_HEAD"
 fi
 
 cd "$D" || exit
@@ -384,17 +365,17 @@
 		git-update-ref HEAD "$head_sha1" &&
 
 		# Upstream URL
-		git-repo-config remote."$origin".url "$repo" &&
+		git-config remote."$origin".url "$repo" &&
 
 		# Set up the mappings to track the remote branches.
-		git-repo-config remote."$origin".fetch \
+		git-config remote."$origin".fetch \
 			"+refs/heads/*:$remote_top/*" '^$' &&
 		rm -f "refs/remotes/$origin/HEAD"
 		git-symbolic-ref "refs/remotes/$origin/HEAD" \
 			"refs/remotes/$origin/$head_points_at" &&
 
-		git-repo-config branch."$head_points_at".remote "$origin" &&
-		git-repo-config branch."$head_points_at".merge "refs/heads/$head_points_at"
+		git-config branch."$head_points_at".remote "$origin" &&
+		git-config branch."$head_points_at".merge "refs/heads/$head_points_at"
 	esac
 
 	case "$no_checkout" in
diff --git a/git-commit.sh b/git-commit.sh
index e23918c..dc0fc3b 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -3,7 +3,7 @@
 # Copyright (c) 2005 Linus Torvalds
 # Copyright (c) 2006 Junio C Hamano
 
-USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>] [-u] [--amend] [-e] [--author <author>] [[-i | -o] <path>...]'
+USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [[-i | -o] <path>...]'
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
 require_work_tree
@@ -284,9 +284,9 @@
 
 case "$log_given" in
 tt*)
-	die "Only one of -c/-C/-F can be used." ;;
+	die "Only one of -c/-C/-F/--amend can be used." ;;
 *tm*|*mt*)
-	die "Option -m cannot be combined with -c/-C/-F." ;;
+	die "Option -m cannot be combined with -c/-C/-F/--amend." ;;
 esac
 
 case "$#,$also,$only,$amend" in
@@ -429,7 +429,7 @@
 	fi
 elif test "$use_commit" != ""
 then
-	encoding=$(git repo-config i18n.commitencoding || echo UTF-8)
+	encoding=$(git config i18n.commitencoding || echo UTF-8)
 	git show -s --pretty=raw --encoding="$encoding" "$use_commit" |
 	sed -e '1,/^$/d' -e 's/^    //'
 elif test -f "$GIT_DIR/MERGE_MSG"
@@ -442,8 +442,11 @@
 
 case "$signoff" in
 t)
+	need_blank_before_signoff=
+	tail -n 1 "$GIT_DIR"/COMMIT_EDITMSG |
+	grep 'Signed-off-by:' >/dev/null || need_blank_before_signoff=yes
 	{
-		echo
+		test -z "$need_blank_before_signoff" || echo
 		git-var GIT_COMMITTER_IDENT | sed -e '
 			s/>.*/>/
 			s/^/Signed-off-by: /
@@ -462,15 +465,7 @@
 fi >>"$GIT_DIR"/COMMIT_EDITMSG
 
 # Author
-if test '' != "$force_author"
-then
-	GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` &&
-	GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` &&
-	test '' != "$GIT_AUTHOR_NAME" &&
-	test '' != "$GIT_AUTHOR_EMAIL" ||
-	die "malformed --author parameter"
-	export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
-elif test '' != "$use_commit"
+if test '' != "$use_commit"
 then
 	pick_author_script='
 	/^author /{
@@ -493,7 +488,7 @@
 		q
 	}
 	'
-	encoding=$(git repo-config i18n.commitencoding || echo UTF-8)
+	encoding=$(git config i18n.commitencoding || echo UTF-8)
 	set_author_env=`git show -s --pretty=raw --encoding="$encoding" "$use_commit" |
 	LANG=C LC_ALL=C sed -ne "$pick_author_script"`
 	eval "$set_author_env"
@@ -501,6 +496,15 @@
 	export GIT_AUTHOR_EMAIL
 	export GIT_AUTHOR_DATE
 fi
+if test '' != "$force_author"
+then
+	GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` &&
+	GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` &&
+	test '' != "$GIT_AUTHOR_NAME" &&
+	test '' != "$GIT_AUTHOR_EMAIL" ||
+	die "malformed --author parameter"
+	export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
+fi
 
 PARENTS="-p HEAD"
 if test -z "$initial_commit"
diff --git a/git-compat-util.h b/git-compat-util.h
index 8781e8e..c1bcb00 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -15,8 +15,9 @@
 #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #endif
-#define _GNU_SOURCE
-#define _BSD_SOURCE
+#define _ALL_SOURCE 1
+#define _GNU_SOURCE 1
+#define _BSD_SOURCE 1
 
 #include <unistd.h>
 #include <stdio.h>
@@ -45,7 +46,10 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 #include <pwd.h>
+#include <inttypes.h>
+#undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */
 #include <grp.h>
+#define _ALL_SOURCE 1
 
 #ifndef NO_ICONV
 #include <iconv.h>
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 35ef0c0..6c9fbfe 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -85,7 +85,7 @@
 	close ($f);
 }
 
-getopts("hivmkuo:d:p:C:z:s:M:P:A:S:L:") or usage();
+getopts("haivmkuo:d:p:C:z:s:M:P:A:S:L:") or usage();
 usage if $opt_h;
 
 @ARGV <= 1 or usage();
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index a33a876..9371788 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -172,11 +172,11 @@
        return 0;
     }
 
-    my @gitvars = `git-repo-config -l`;
+    my @gitvars = `git-config -l`;
     if ($?) {
-       print "E problems executing git-repo-config on the server -- this is not a git repository or the PATH is not set correctly.\n";
+       print "E problems executing git-config on the server -- this is not a git repository or the PATH is not set correctly.\n";
         print "E \n";
-        print "error 1 - problem executing git-repo-config\n";
+        print "error 1 - problem executing git-config\n";
        return 0;
     }
     foreach my $line ( @gitvars )
@@ -876,9 +876,9 @@
                 print "MT newline\n";
 		next;
 	    }
-	    elsif ( !defined($wrev) || $wrev == 0 )
+	    elsif ( (!defined($wrev) || $wrev == 0) && (!defined($meta->{revision}) || $meta->{revision} == 0) )
 	    {
-	        $log->info("Tell the client the file will be added");
+	        $log->info("Tell the client the file is scheduled for addition");
 		print "MT text A \n";
                 print "MT fname $filename\n";
                 print "MT newline\n";
@@ -886,7 +886,7 @@
 
 	    }
 	    else {
-                $log->info("Updating '$filename' $wrev");
+                $log->info("Updating '$filename' to ".$meta->{revision});
                 print "MT +updated\n";
                 print "MT text U \n";
                 print "MT fname $filename\n";
diff --git a/git-fetch.sh b/git-fetch.sh
index 87b940b..357cac2 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -22,7 +22,6 @@
 verbose=
 update_head_ok=
 exec=
-upload_pack=
 keep=
 shallow_depth=
 while case "$#" in 0) break ;; esac
@@ -34,8 +33,12 @@
 	--upl|--uplo|--uploa|--upload|--upload-|--upload-p|\
 	--upload-pa|--upload-pac|--upload-pack)
 		shift
-		exec="--exec=$1" 
-		upload_pack="-u $1"
+		exec="--upload-pack=$1"
+		;;
+	--upl=*|--uplo=*|--uploa=*|--upload=*|\
+	--upload-=*|--upload-p=*|--upload-pa=*|--upload-pac=*|--upload-pack=*)
+		exec=--upload-pack=$(expr "z$1" : 'z-[^=]*=\(.*\)')
+		shift
 		;;
 	-f|--f|--fo|--for|--forc|--force)
 		force=t
@@ -82,6 +85,12 @@
 	set x $origin ; shift ;;
 esac
 
+if test -z "$exec"
+then
+	# No command line override and we have configuration for the remote.
+	exec="--upload-pack=$(get_uploadpack $1)"
+fi
+
 remote_nick="$1"
 remote=$(get_remote_url "$@")
 refs=
@@ -94,7 +103,7 @@
 fi
 
 # Global that is reused later
-ls_remote_result=$(git ls-remote $upload_pack "$remote") ||
+ls_remote_result=$(git ls-remote $exec "$remote") ||
 	die "Cannot get the repository state from $remote"
 
 append_fetch_head () {
@@ -312,7 +321,7 @@
 	      curl_extra_args="-k"
 	  fi
 	  if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \
-		"`git-repo-config --bool http.noEPSV`" = true ]; then
+		"`git-config --bool http.noEPSV`" = true ]; then
 	      noepsv_opt="--disable-epsv"
 	  fi
 
diff --git a/git-gc.sh b/git-gc.sh
index 6de55f7..3e8c87c 100755
--- a/git-gc.sh
+++ b/git-gc.sh
@@ -4,12 +4,26 @@
 #
 # Cleanup unreachable files and optimize the repository.
 
-USAGE=''
+USAGE='git-gc [--prune]'
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
 
+no_prune=:
+while case $# in 0) break ;; esac
+do
+	case "$1" in
+	--prune)
+		no_prune=
+		;;
+	--)
+		usage
+		;;
+	esac
+	shift
+done
+
 git-pack-refs --prune &&
 git-reflog expire --all &&
 git-repack -a -d -l &&
-git-prune &&
+$no_prune git-prune &&
 git-rerere gc || exit
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 80adc83..cbc7418 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -15,11 +15,11 @@
 	fqgitdir="$PWD/$GIT_DIR" ;;
 esac
 
-local="`git repo-config --bool --get instaweb.local`"
-httpd="`git repo-config --get instaweb.httpd`"
-browser="`git repo-config --get instaweb.browser`"
-port=`git repo-config --get instaweb.port`
-module_path="`git repo-config --get instaweb.modulepath`"
+local="`git config --bool --get instaweb.local`"
+httpd="`git config --get instaweb.httpd`"
+browser="`git config --get instaweb.browser`"
+port=`git config --get instaweb.port`
+module_path="`git config --get instaweb.modulepath`"
 
 conf=$GIT_DIR/gitweb/httpd.conf
 
diff --git a/git-lost-found.sh b/git-lost-found.sh
index b928f2c..9360804 100755
--- a/git-lost-found.sh
+++ b/git-lost-found.sh
@@ -12,7 +12,7 @@
 laf="$GIT_DIR/lost-found"
 rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
 
-git fsck-objects --full |
+git fsck --full |
 while read dangling type sha1
 do
 	case "$dangling" in
diff --git a/git-ls-remote.sh b/git-ls-remote.sh
index 03b624e..8ea5c5e 100755
--- a/git-ls-remote.sh
+++ b/git-ls-remote.sh
@@ -23,7 +23,11 @@
   -u|--u|--up|--upl|--uploa|--upload|--upload-|--upload-p|--upload-pa|\
   --upload-pac|--upload-pack)
 	shift
-	exec="--exec=$1"
+	exec="--upload-pack=$1"
+	shift;;
+  -u=*|--u=*|--up=*|--upl=*|--uplo=*|--uploa=*|--upload=*|\
+  --upload-=*|--upload-p=*|--upload-pa=*|--upload-pac=*|--upload-pack=*)
+	exec=--upload-pack=$(expr "z$1" : 'z-[^=]*=\(.*\)')
 	shift;;
   --)
   shift; break ;;
@@ -54,7 +58,7 @@
             curl_extra_args="-k"
         fi
 	if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \
-		"`git-repo-config --bool http.noEPSV`" = true ]; then
+		"`git-config --bool http.noEPSV`" = true ]; then
 		curl_extra_args="${curl_extra_args} --disable-epsv"
 	fi
 	curl -nsf $curl_extra_args --header "Pragma: no-cache" "$peek_repo/info/refs" ||
diff --git a/git-merge.sh b/git-merge.sh
index 7b59026..04a5eb0 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -7,7 +7,6 @@
 
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
-set_reflog_action "merge $*"
 require_work_tree
 cd_to_toplevel
 
@@ -217,6 +216,7 @@
 
 # All the rest are remote heads
 test "$#" = 0 && usage ;# we need at least one remote head.
+set_reflog_action "merge $*"
 
 remoteheads=
 for remote
@@ -233,7 +233,7 @@
 '')
 	case "$#" in
 	1)
-		var="`git-repo-config --get pull.twohead`"
+		var="`git-config --get pull.twohead`"
 		if test -n "$var"
 		then
 			use_strategies="$var"
@@ -241,7 +241,7 @@
 			use_strategies="$default_twohead_strategies"
 		fi ;;
 	*)
-		var="`git-repo-config --get pull.octopus`"
+		var="`git-config --get pull.octopus`"
 		if test -n "$var"
 		then
 			use_strategies="$var"
diff --git a/git-p4import.py b/git-p4import.py
index 5c56cac..60a758b 100644
--- a/git-p4import.py
+++ b/git-p4import.py
@@ -193,13 +193,13 @@
 
     def get_config(self, variable):
         try:
-            return self.git("repo-config --get %s" % variable)[0].rstrip()
+            return self.git("config --get %s" % variable)[0].rstrip()
         except:
             return None
 
     def set_config(self, variable, value):
         try:
-            self.git("repo-config %s %s"%(variable, value) )
+            self.git("config %s %s"%(variable, value) )
         except:
             die("Could not set %s to " % variable, value)
 
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index d2e4c2b..3e783b7 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -10,7 +10,7 @@
 		echo ''
 		;;
 	*)
-		if test "$(git-repo-config --get "remote.$1.url")"
+		if test "$(git-config --get "remote.$1.url")"
 		then
 			echo config
 		elif test -f "$GIT_DIR/remotes/$1"
@@ -32,7 +32,7 @@
 		echo "$1"
 		;;
 	config)
-		git-repo-config --get "remote.$1.url"
+		git-config --get "remote.$1.url"
 		;;
 	remotes)
 		sed -ne '/^URL: */{
@@ -49,8 +49,8 @@
 }
 
 get_default_remote () {
-	curr_branch=$(git-symbolic-ref HEAD | sed -e 's|^refs/heads/||')
-	origin=$(git-repo-config --get "branch.$curr_branch.remote")
+	curr_branch=$(git-symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')
+	origin=$(git-config --get "branch.$curr_branch.remote")
 	echo ${origin:-origin}
 }
 
@@ -60,7 +60,7 @@
 	'' | branches)
 		;; # no default push mapping, just send matching refs.
 	config)
-		git-repo-config --get-all "remote.$1.push" ;;
+		git-config --get-all "remote.$1.push" ;;
 	remotes)
 		sed -ne '/^Push: */{
 			s///p
@@ -81,7 +81,14 @@
 # is to help prevent randomly "globbed" ref from being chosen as
 # a merge candidate
 expand_refs_wildcard () {
+	remote="$1"
+	shift
 	first_one=yes
+	if test "$#" = 0
+	then
+		echo empty
+		echo >&2 "Nothing specified for fetching with remote.$remote.fetch"
+	fi
 	for ref
 	do
 		lref=${ref#'+'}
@@ -132,14 +139,14 @@
 	if test "$1" = "-d"
 	then
 		shift ; remote="$1" ; shift
-		set $(expand_refs_wildcard "$@")
+		set $(expand_refs_wildcard "$remote" "$@")
 		is_explicit="$1"
 		shift
 		if test "$remote" = "$(get_default_remote)"
 		then
-			curr_branch=$(git-symbolic-ref HEAD | \
+			curr_branch=$(git-symbolic-ref -q HEAD | \
 			    sed -e 's|^refs/heads/||')
-			merge_branches=$(git-repo-config \
+			merge_branches=$(git-config \
 			    --get-all "branch.${curr_branch}.merge")
 		fi
 		if test -z "$merge_branches" && test $is_explicit != explicit
@@ -176,7 +183,7 @@
 			done
 		fi
 		case "$remote" in
-		'') remote=HEAD ;;
+		'' | HEAD ) remote=HEAD ;;
 		refs/heads/* | refs/tags/* | refs/remotes/*) ;;
 		heads/* | tags/* | remotes/* ) remote="refs/$remote" ;;
 		*) remote="refs/heads/$remote" ;;
@@ -205,7 +212,7 @@
 		echo "HEAD:" ;;
 	config)
 		canon_refs_list_for_fetch -d "$1" \
-			$(git-repo-config --get-all "remote.$1.fetch") ;;
+			$(git-config --get-all "remote.$1.fetch") ;;
 	branches)
 		remote_branch=$(sed -ne '/#/s/.*#//p' "$GIT_DIR/branches/$1")
 		case "$remote_branch" in '') remote_branch=master ;; esac
@@ -279,3 +286,16 @@
 		esac
 	done
 }
+
+get_uploadpack () {
+	data_source=$(get_data_source "$1")
+	case "$data_source" in
+	config)
+		uplp=$(git-config --get "remote.$1.uploadpack")
+		echo ${uplp:-git-upload-pack}
+		;;
+	*)
+		echo "git-upload-pack"
+		;;
+	esac
+}
diff --git a/git-pull.sh b/git-pull.sh
index 9592617..a3665d7 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -83,8 +83,17 @@
 
 case "$merge_head" in
 '')
-	curr_branch=$(git-symbolic-ref HEAD | \
-		sed -e 's|^refs/heads/||')
+	curr_branch=$(git-symbolic-ref -q HEAD)
+	case $? in
+	  0) ;;
+	  1) echo >&2 "You are not currently on a branch; you must explicitly"
+	     echo >&2 "specify which branch you wish to merge:"
+	     echo >&2 "  git pull <remote> <branch>"
+	     exit 1;;
+	  *) exit $?;;
+	esac
+	curr_branch=${curr_branch#refs/heads/}
+
 	echo >&2 "Warning: No merge candidate found because value of config option
          \"branch.${curr_branch}.merge\" does not match any remote branch fetched."
 	echo >&2 "No changes."
diff --git a/git-quiltimport.sh b/git-quiltimport.sh
index 10135da..2ae1f20 100755
--- a/git-quiltimport.sh
+++ b/git-quiltimport.sh
@@ -89,7 +89,7 @@
 			echo "No author found in $patch_name" >&2;
 			echo "---"
 			cat $tmp_msg
-			echo -n "Author: ";
+			printf "Author: ";
 			read patch_author
 
 			echo "$patch_author"
diff --git a/git-rebase.sh b/git-rebase.sh
index c8bd0f9..9d2f71d 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -249,7 +249,8 @@
 git-update-index --refresh || exit
 diff=$(git-diff-index --cached --name-status -r HEAD)
 case "$diff" in
-?*)	echo "$diff"
+?*)	echo "cannot rebase: your index is not up-to-date"
+	echo "$diff"
 	exit 1
 	;;
 esac
@@ -275,8 +276,12 @@
 	git-checkout "$2" || usage
 	;;
 *)
-	branch_name=`git symbolic-ref HEAD` || die "No current branch"
-	branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'`
+	if branch_name=`git symbolic-ref -q HEAD`
+	then
+		branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'`
+	else
+		branch_name=HEAD ;# detached
+	fi
 	;;
 esac
 branch=$(git-rev-parse --verify "${branch_name}^0") || exit
diff --git a/git-remote.perl b/git-remote.perl
index fc055b6..c813fe1 100755
--- a/git-remote.perl
+++ b/git-remote.perl
@@ -64,7 +64,7 @@
 	my ($git) = @_;
 	my %seen = ();
 	my @remotes = eval {
-		$git->command(qw(repo-config --get-regexp), '^remote\.');
+		$git->command(qw(config --get-regexp), '^remote\.');
 	};
 	for (@remotes) {
 		if (/^remote\.([^.]*)\.(\S*)\s+(.*)$/) {
@@ -103,7 +103,7 @@
 	my ($git) = @_;
 	my %seen = ();
 	my @branches = eval {
-		$git->command(qw(repo-config --get-regexp), '^branch\.');
+		$git->command(qw(config --get-regexp), '^branch\.');
 	};
 	for (@branches) {
 		if (/^branch\.([^.]*)\.(\S*)\s+(.*)$/) {
@@ -238,8 +238,8 @@
 		print STDERR "remote $name already exists.\n";
 		exit(1);
 	}
-	$git->command('repo-config', "remote.$name.url", $url);
-	$git->command('repo-config', "remote.$name.fetch",
+	$git->command('config', "remote.$name.url", $url);
+	$git->command('config', "remote.$name.fetch",
 		      "+refs/heads/*:refs/remotes/$name/*");
 }
 
diff --git a/git-repack.sh b/git-repack.sh
index da8e67f..ddfa8b4 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -28,7 +28,7 @@
 # Later we will default repack.UseDeltaBaseOffset to true
 default_dbo=false
 
-case "`git repo-config --bool repack.usedeltabaseoffset ||
+case "`git config --bool repack.usedeltabaseoffset ||
        echo $default_dbo`" in
 true)
 	extra="$extra --delta-base-offset" ;;
diff --git a/git-reset.sh b/git-reset.sh
index 91c7e6e..fee6d98 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -43,7 +43,7 @@
 # affecting the working tree nor HEAD.
 if test $# != 0
 then
-	test "$reset_type" == "--mixed" ||
+	test "$reset_type" = "--mixed" ||
 		die "Cannot do partial $reset_type reset."
 
 	git-diff-index --cached $rev -- "$@" |
@@ -87,7 +87,7 @@
 case "$reset_type" in
 --hard )
 	test $update_ref_status = 0 && {
-		echo -n "HEAD is now at "
+		printf "HEAD is now at "
 		GIT_PAGER= git log --max-count=1 --pretty=oneline \
 			--abbrev-commit HEAD
 	}
diff --git a/git-revert.sh b/git-revert.sh
index 71cbcbc..866d622 100755
--- a/git-revert.sh
+++ b/git-revert.sh
@@ -81,7 +81,7 @@
 git-rev-parse --verify "$commit^2" >/dev/null 2>&1 &&
 	die "Cannot run $me a multi-parent commit."
 
-encoding=$(git repo-config i18n.commitencoding || echo UTF-8)
+encoding=$(git config i18n.commitencoding || echo UTF-8)
 
 # "commit" is an existing commit.  We would want to apply
 # the difference it introduces since its first parent "prev"
@@ -146,37 +146,38 @@
 
 esac >.msg
 
+eval GITHEAD_$head=HEAD
+eval GITHEAD_$next='`git show -s \
+	--pretty=oneline --encoding="$encoding" "$commit" |
+	sed -e "s/^[^ ]* //"`'
+export GITHEAD_$head GITHEAD_$next
+
 # This three way merge is an interesting one.  We are at
 # $head, and would want to apply the change between $commit
 # and $prev on top of us (when reverting), or the change between
 # $prev and $commit on top of us (when cherry-picking or replaying).
 
-echo >&2 "First trying simple merge strategy to $me."
-git-read-tree -m -u --aggressive $base $head $next &&
+git-merge-recursive $base -- $head $next &&
 result=$(git-write-tree 2>/dev/null) || {
-    echo >&2 "Simple $me fails; trying Automatic $me."
-    git-merge-index -o git-merge-one-file -a || {
-	    mv -f .msg "$GIT_DIR/MERGE_MSG"
-	    {
-		echo '
+	mv -f .msg "$GIT_DIR/MERGE_MSG"
+	{
+	    echo '
 Conflicts:
 '
 		git ls-files --unmerged |
 		sed -e 's/^[^	]*	/	/' |
 		uniq
-	    } >>"$GIT_DIR/MERGE_MSG"
-	    echo >&2 "Automatic $me failed.  After resolving the conflicts,"
-	    echo >&2 "mark the corrected paths with 'git-add <paths>'"
-	    echo >&2 "and commit the result."
-	    case "$me" in
-	    cherry-pick)
+	} >>"$GIT_DIR/MERGE_MSG"
+	echo >&2 "Automatic $me failed.  After resolving the conflicts,"
+	echo >&2 "mark the corrected paths with 'git-add <paths>'"
+	echo >&2 "and commit the result."
+	case "$me" in
+	cherry-pick)
 		echo >&2 "You may choose to use the following when making"
 		echo >&2 "the commit:"
 		echo >&2 "$set_author_env"
-	    esac
-	    exit 1
-    }
-    result=$(git-write-tree) || exit
+	esac
+	exit 1
 }
 echo >&2 "Finished one $me."
 
diff --git a/git-send-email.perl b/git-send-email.perl
index 8dc2ee0..6a285bf 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -408,7 +408,7 @@
 		s/_/ /g;
 		s/=([0-9A-F]{2})/chr(hex($1))/eg;
 	}
-	return "$_ - unquoted";
+	return "$_";
 }
 
 sub send_message
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 6b1c142..b4aa4b2 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -29,7 +29,7 @@
 }
 
 is_bare_repository () {
-	git-repo-config --bool --get core.bare ||
+	git-config --bool --get core.bare ||
 	case "$GIT_DIR" in
 	.git | */.git) echo false ;;
 	*) echo true ;;
diff --git a/git-svn.perl b/git-svn.perl
index 9986a0c..68156fc 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -593,7 +593,7 @@
 				      "$trunk_url ($_trunk)\n";
 			}
 			init($trunk_url);
-			command_noisy('repo-config', 'svn.trunk', $trunk_url);
+			command_noisy('config', 'svn.trunk', $trunk_url);
 		}
 	}
 	$_prefix = '' unless defined $_prefix;
@@ -772,22 +772,22 @@
 	return 1 if $_color;
 	my ($dc, $dcvar);
 	$dcvar = 'color.diff';
-	$dc = `git-repo-config --get $dcvar`;
+	$dc = `git-config --get $dcvar`;
 	if ($dc eq '') {
 		# nothing at all; fallback to "diff.color"
 		$dcvar = 'diff.color';
-		$dc = `git-repo-config --get $dcvar`;
+		$dc = `git-config --get $dcvar`;
 	}
 	chomp($dc);
 	if ($dc eq 'auto') {
 		my $pc;
-		$pc = `git-repo-config --get color.pager`;
+		$pc = `git-config --get color.pager`;
 		if ($pc eq '') {
 			# does not have it -- fallback to pager.color
-			$pc = `git-repo-config --bool --get pager.color`;
+			$pc = `git-config --bool --get pager.color`;
 		}
 		else {
-			$pc = `git-repo-config --bool --get color.pager`;
+			$pc = `git-config --bool --get color.pager`;
 			if ($?) {
 				$pc = 'false';
 			}
@@ -800,7 +800,7 @@
 	}
 	return 0 if $dc eq 'never';
 	return 1 if $dc eq 'always';
-	chomp($dc = `git-repo-config --bool --get $dcvar`);
+	chomp($dc = `git-config --bool --get $dcvar`);
 	return ($dc eq 'true');
 }
 
@@ -919,7 +919,7 @@
 	waitpid $pid, 0;
 	croak $? if $?;
 	my ($n) = ($switch =~ /^--(\w+)/);
-	command_noisy('repo-config', "svn.$n", $full_url);
+	command_noisy('config', "svn.$n", $full_url);
 }
 
 sub common_prefix {
@@ -1594,7 +1594,7 @@
 	%tree_map = ();
 }
 
-# convert GetOpt::Long specs for use by git-repo-config
+# convert GetOpt::Long specs for use by git-config
 sub read_repo_config {
 	return unless -d $GIT_DIR;
 	my $opts = shift;
@@ -1602,7 +1602,7 @@
 		my $v = $opts->{$o};
 		my ($key) = ($o =~ /^([a-z\-]+)/);
 		$key =~ s/-//g;
-		my $arg = 'git-repo-config';
+		my $arg = 'git-config';
 		$arg .= ' --int' if ($o =~ /[:=]i$/);
 		$arg .= ' --bool' if ($o !~ /[:=][sfi]$/);
 		if (ref $v eq 'ARRAY') {
@@ -1918,7 +1918,8 @@
 	$default_username = $_username if defined $_username;
 	if (defined $default_username && length $default_username) {
 		if (defined $realm && length $realm) {
-			print "Authentication realm: $realm\n";
+			print STDERR "Authentication realm: $realm\n";
+			STDERR->flush;
 		}
 		$cred->username($default_username);
 	} else {
@@ -1933,36 +1934,38 @@
 sub _ssl_server_trust_prompt {
 	my ($cred, $realm, $failures, $cert_info, $may_save, $pool) = @_;
 	$may_save = undef if $_no_auth_cache;
-	print "Error validating server certificate for '$realm':\n";
+	print STDERR "Error validating server certificate for '$realm':\n";
 	if ($failures & $SVN::Auth::SSL::UNKNOWNCA) {
-		print " - The certificate is not issued by a trusted ",
+		print STDERR " - The certificate is not issued by a trusted ",
 		      "authority. Use the\n",
 	              "   fingerprint to validate the certificate manually!\n";
 	}
 	if ($failures & $SVN::Auth::SSL::CNMISMATCH) {
-		print " - The certificate hostname does not match.\n";
+		print STDERR " - The certificate hostname does not match.\n";
 	}
 	if ($failures & $SVN::Auth::SSL::NOTYETVALID) {
-		print " - The certificate is not yet valid.\n";
+		print STDERR " - The certificate is not yet valid.\n";
 	}
 	if ($failures & $SVN::Auth::SSL::EXPIRED) {
-		print " - The certificate has expired.\n";
+		print STDERR " - The certificate has expired.\n";
 	}
 	if ($failures & $SVN::Auth::SSL::OTHER) {
-		print " - The certificate has an unknown error.\n";
+		print STDERR " - The certificate has an unknown error.\n";
 	}
-	printf( "Certificate information:\n".
+	printf STDERR
+	        "Certificate information:\n".
 	        " - Hostname: %s\n".
 	        " - Valid: from %s until %s\n".
 	        " - Issuer: %s\n".
 	        " - Fingerprint: %s\n",
 	        map $cert_info->$_, qw(hostname valid_from valid_until
-	                               issuer_dname fingerprint) );
+	                               issuer_dname fingerprint);
 	my $choice;
 prompt:
-	print $may_save ?
+	print STDERR $may_save ?
 	      "(R)eject, accept (t)emporarily or accept (p)ermanently? " :
 	      "(R)eject or accept (t)emporarily? ";
+	STDERR->flush;
 	$choice = lc(substr(<STDIN> || 'R', 0, 1));
 	if ($choice =~ /^t$/i) {
 		$cred->may_save(undef);
@@ -1980,7 +1983,8 @@
 sub _ssl_client_cert_prompt {
 	my ($cred, $realm, $may_save, $pool) = @_;
 	$may_save = undef if $_no_auth_cache;
-	print "Client certificate filename: ";
+	print STDERR "Client certificate filename: ";
+	STDERR->flush;
 	chomp(my $filename = <STDIN>);
 	$cred->cert_file($filename);
 	$cred->may_save($may_save);
@@ -1999,13 +2003,14 @@
 	my ($cred, $realm, $may_save, $pool) = @_;
 	$may_save = undef if $_no_auth_cache;
 	if (defined $realm && length $realm) {
-		print "Authentication realm: $realm\n";
+		print STDERR "Authentication realm: $realm\n";
 	}
 	my $username;
 	if (defined $_username) {
 		$username = $_username;
 	} else {
-		print "Username: ";
+		print STDERR "Username: ";
+		STDERR->flush;
 		chomp($username = <STDIN>);
 	}
 	$cred->username($username);
@@ -2015,7 +2020,8 @@
 
 sub _read_password {
 	my ($prompt, $realm) = @_;
-	print $prompt;
+	print STDERR $prompt;
+	STDERR->flush;
 	require Term::ReadKey;
 	Term::ReadKey::ReadMode('noecho');
 	my $password = '';
@@ -2024,7 +2030,8 @@
 		$password .= $key;
 	}
 	Term::ReadKey::ReadMode('restore');
-	print "\n";
+	print STDERR "\n";
+	STDERR->flush;
 	$password;
 }
 
@@ -2849,7 +2856,7 @@
 	foreach my $d (sort { $b =~ tr#/#/# <=> $a =~ tr#/#/# } keys %$rm) {
 		$self->close_directory($bat->{$d}, $p);
 		my ($dn) = ($d =~ m#^(.*?)/?(?:[^/]+)$#);
-		print "\tD+\t/$d/\n" unless $q;
+		print "\tD+\t$d/\n" unless $q;
 		$self->SUPER::delete_entry($d, $r, $bat->{$dn}, $p);
 		delete $bat->{$d};
 	}
diff --git a/git-tag.sh b/git-tag.sh
index ecb9100..4a0a7b6 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -63,12 +63,21 @@
 	;;
     -d)
     	shift
-	tag_name="$1"
-	tag=$(git-show-ref --verify --hash -- "refs/tags/$tag_name") ||
-		die "Seriously, what tag are you talking about?"
-	git-update-ref -m 'tag: delete' -d "refs/tags/$tag_name" "$tag" &&
-		echo "Deleted tag $tag_name."
-	exit $?
+	had_error=0
+	for tag
+	do
+		cur=$(git-show-ref --verify --hash -- "refs/tags/$tag") || {
+			echo >&2 "Seriously, what tag are you talking about?"
+			had_error=1
+			continue
+		}
+		git-update-ref -m 'tag: delete' -d "refs/tags/$tag" "$cur" || {
+			had_error=1
+			continue
+		}
+		echo "Deleted tag $tag."
+	done
+	exit $had_error
 	;;
     -v)
 	shift
@@ -103,7 +112,10 @@
 object=$(git-rev-parse --verify --default HEAD "$@") || exit 1
 type=$(git-cat-file -t $object) || exit 1
 tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
-: ${username:=$(expr "z$tagger" : 'z\(.*>\)')}
+
+test -n "$username" ||
+	username=$(git-repo-config user.signingkey) ||
+	username=$(expr "z$tagger" : 'z\(.*>\)')
 
 trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG "$GIT_DIR"/TAG_EDITMSG' 0
 
diff --git a/git.c b/git.c
index 72a1486..fb03a54 100644
--- a/git.c
+++ b/git.c
@@ -214,16 +214,17 @@
 		int option;
 	} commands[] = {
 		{ "add", cmd_add, RUN_SETUP | NOT_BARE },
-		{ "annotate", cmd_annotate, },
+		{ "annotate", cmd_annotate, USE_PAGER },
 		{ "apply", cmd_apply },
 		{ "archive", cmd_archive },
-		{ "blame", cmd_blame, RUN_SETUP | USE_PAGER },
+		{ "blame", cmd_blame, RUN_SETUP },
 		{ "branch", cmd_branch, RUN_SETUP },
 		{ "cat-file", cmd_cat_file, RUN_SETUP },
 		{ "checkout-index", cmd_checkout_index, RUN_SETUP },
 		{ "check-ref-format", cmd_check_ref_format },
 		{ "cherry", cmd_cherry, RUN_SETUP },
 		{ "commit-tree", cmd_commit_tree, RUN_SETUP },
+		{ "config", cmd_config },
 		{ "count-objects", cmd_count_objects, RUN_SETUP },
 		{ "describe", cmd_describe, RUN_SETUP },
 		{ "diff", cmd_diff, RUN_SETUP | USE_PAGER },
@@ -234,6 +235,8 @@
 		{ "fmt-merge-msg", cmd_fmt_merge_msg, RUN_SETUP },
 		{ "for-each-ref", cmd_for_each_ref, RUN_SETUP },
 		{ "format-patch", cmd_format_patch, RUN_SETUP },
+		{ "fsck", cmd_fsck, RUN_SETUP },
+		{ "fsck-objects", cmd_fsck, RUN_SETUP },
 		{ "get-tar-commit-id", cmd_get_tar_commit_id },
 		{ "grep", cmd_grep, RUN_SETUP },
 		{ "help", cmd_help },
@@ -254,7 +257,7 @@
 		{ "push", cmd_push, RUN_SETUP },
 		{ "read-tree", cmd_read_tree, RUN_SETUP },
 		{ "reflog", cmd_reflog, RUN_SETUP },
-		{ "repo-config", cmd_repo_config },
+		{ "repo-config", cmd_config },
 		{ "rerere", cmd_rerere, RUN_SETUP },
 		{ "rev-list", cmd_rev_list, RUN_SETUP },
 		{ "rev-parse", cmd_rev_parse, RUN_SETUP },
diff --git a/gitk b/gitk
index 3dabc69..31d0aad 100755
--- a/gitk
+++ b/gitk
@@ -12,7 +12,7 @@
     if {[info exists env(GIT_DIR)]} {
 	return $env(GIT_DIR)
     } else {
-	return ".git"
+	return [exec git rev-parse --git-dir]
     }
 }
 
@@ -6193,7 +6193,7 @@
 
 set gitencoding {}
 catch {
-    set gitencoding [exec git repo-config --get i18n.commitencoding]
+    set gitencoding [exec git config --get i18n.commitencoding]
 }
 if {$gitencoding == ""} {
     set gitencoding "utf-8"
@@ -6293,6 +6293,7 @@
 set patchnum 0
 setcoords
 makewindow
+wm title . "[file tail $argv0]: [file tail [pwd]]"
 readrefs
 
 if {$cmdline_files ne {} || $revtreeargs ne {}} {
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 88af2e6..b606c1d 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -986,7 +986,7 @@
 	$key =~ s/^gitweb\.//;
 	return if ($key =~ m/\W/);
 
-	my @x = (git_cmd(), 'repo-config');
+	my @x = (git_cmd(), 'config');
 	if (defined $type) { push @x, $type; }
 	push @x, "--get";
 	push @x, "gitweb.$key";
diff --git a/http-fetch.c b/http-fetch.c
index 67dfb0a..9f790a0 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -1003,7 +1003,6 @@
 	int arg = 1;
 	int rc = 0;
 
-	setup_ident();
 	setup_git_directory();
 	git_config(git_default_config);
 
@@ -1070,7 +1069,7 @@
 		fprintf(stderr,
 "Some loose object were found to be corrupt, but they might be just\n"
 "a false '404 Not Found' error message sent with incorrect HTTP\n"
-"status code.  Suggest running git fsck-objects.\n");
+"status code.  Suggest running git-fsck.\n");
 	}
 	return rc;
 }
diff --git a/http-push.c b/http-push.c
index 0a15f53..b128c01 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2299,7 +2299,6 @@
 	struct ref *ref;
 
 	setup_git_directory();
-	setup_ident();
 
 	remote = xcalloc(sizeof(*remote), 1);
 
diff --git a/ident.c b/ident.c
index 6ad8fed..a6fc7b5 100644
--- a/ident.c
+++ b/ident.c
@@ -43,19 +43,13 @@
 
 }
 
-int setup_ident(void)
+static void copy_email(struct passwd *pw)
 {
-	int len;
-	struct passwd *pw = getpwuid(getuid());
-
-	if (!pw)
-		die("You don't exist. Go away!");
-
-	/* Get the name ("gecos") */
-	copy_gecos(pw, git_default_name, sizeof(git_default_name));
-
-	/* Make up a fake email address (name + '@' + hostname [+ '.' + domainname]) */
-	len = strlen(pw->pw_name);
+	/*
+	 * Make up a fake email address
+	 * (name + '@' + hostname [+ '.' + domainname])
+	 */
+	int len = strlen(pw->pw_name);
 	if (len > sizeof(git_default_email)/2)
 		die("Your sysadmin must hate you!");
 	memcpy(git_default_email, pw->pw_name, len);
@@ -68,13 +62,37 @@
 		len = strlen(git_default_email);
 		git_default_email[len++] = '.';
 		if (he && (domainname = strchr(he->h_name, '.')))
-			strlcpy(git_default_email + len, domainname + 1, sizeof(git_default_email) - len);
+			strlcpy(git_default_email + len, domainname + 1,
+				sizeof(git_default_email) - len);
 		else
-			strlcpy(git_default_email + len, "(none)", sizeof(git_default_email) - len);
+			strlcpy(git_default_email + len, "(none)",
+				sizeof(git_default_email) - len);
 	}
+}
+
+static void setup_ident(void)
+{
+	struct passwd *pw = NULL;
+
+	/* Get the name ("gecos") */
+	if (!git_default_name[0]) {
+		pw = getpwuid(getuid());
+		if (!pw)
+			die("You don't exist. Go away!");
+		copy_gecos(pw, git_default_name, sizeof(git_default_name));
+	}
+
+	if (!git_default_email[0]) {
+		if (!pw)
+			pw = getpwuid(getuid());
+		if (!pw)
+			die("You don't exist. Go away!");
+		copy_email(pw);
+	}
+
 	/* And set the default date */
-	datestamp(git_default_date, sizeof(git_default_date));
-	return 0;
+	if (!git_default_date[0])
+		datestamp(git_default_date, sizeof(git_default_date));
 }
 
 static int add_raw(char *buf, int size, int offset, const char *str)
@@ -160,8 +178,8 @@
 "\n"
 "Run\n"
 "\n"
-"  git repo-config user.email \"you@email.com\"\n"
-"  git repo-config user.name \"Your Name\"\n"
+"  git config user.email \"you@email.com\"\n"
+"  git config user.name \"Your Name\"\n"
 "\n"
 "To set the identity in this repository.\n"
 "Add --global to set your account\'s default\n"
@@ -174,18 +192,28 @@
 	char date[50];
 	int i;
 
+	setup_ident();
 	if (!name)
 		name = git_default_name;
 	if (!email)
 		email = git_default_email;
 
 	if (!*name) {
-		if (name == git_default_name && env_hint) {
+		struct passwd *pw;
+
+		if (0 <= error_on_no_name &&
+		    name == git_default_name && env_hint) {
 			fprintf(stderr, env_hint, au_env, co_env);
 			env_hint = NULL; /* warn only once, for "git-var -l" */
 		}
-		if (error_on_no_name)
+		if (0 < error_on_no_name)
 			die("empty ident %s <%s> not allowed", name, email);
+		pw = getpwuid(getuid());
+		if (!pw)
+			die("You don't exist. Go away!");
+		strlcpy(git_default_name, pw->pw_name,
+			sizeof(git_default_name));
+		name = git_default_name;
 	}
 
 	strcpy(date, git_default_date);
@@ -218,18 +246,3 @@
 			 getenv("GIT_COMMITTER_DATE"),
 			 error_on_no_name);
 }
-
-void ignore_missing_committer_name()
-{
-	/* If we did not get a name from the user's gecos entry then
-	 * git_default_name is empty; so instead load the username
-	 * into it as a 'good enough for now' approximation of who
-	 * this user is.
-	 */
-	if (!*git_default_name) {
-		struct passwd *pw = getpwuid(getuid());
-		if (!pw)
-			die("You don't exist. Go away!");
-		strlcpy(git_default_name, pw->pw_name, sizeof(git_default_name));
-	}
-}
diff --git a/local-fetch.c b/local-fetch.c
index cf99cb7..7cfe8b3 100644
--- a/local-fetch.c
+++ b/local-fetch.c
@@ -210,7 +210,6 @@
 	char **commit_id;
 	int arg = 1;
 
-	setup_ident();
 	setup_git_directory();
 	git_config(git_default_config);
 
diff --git a/log-tree.c b/log-tree.c
index 35be33a..d8ca36b 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -2,6 +2,7 @@
 #include "diff.h"
 #include "commit.h"
 #include "log-tree.h"
+#include "reflog-walk.h"
 
 static void show_parents(struct commit *commit, int abbrev)
 {
@@ -223,6 +224,14 @@
 		printf("%s",
 		       diff_get_color(opt->diffopt.color_diff, DIFF_RESET));
 		putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');
+		if (opt->reflog_info) {
+			show_reflog_message(opt->reflog_info,
+				    opt->commit_format == CMIT_FMT_ONELINE);;
+			if (opt->commit_format == CMIT_FMT_ONELINE) {
+				printf("%s", sep);
+				return;
+			}
+		}
 	}
 
 	/*
diff --git a/merge-recursive.c b/merge-recursive.c
index b4acbb7..fa320eb 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -67,27 +67,75 @@
 	unsigned processed:1;
 };
 
+struct output_buffer
+{
+	struct output_buffer *next;
+	char *str;
+};
+
 static struct path_list current_file_set = {NULL, 0, 0, 1};
 static struct path_list current_directory_set = {NULL, 0, 0, 1};
 
-static int output_indent = 0;
+static int call_depth = 0;
+static int verbosity = 2;
+static int buffer_output = 1;
+static int do_progress = 1;
+static unsigned last_percent;
+static unsigned merged_cnt;
+static unsigned total_cnt;
+static volatile sig_atomic_t progress_update;
+static struct output_buffer *output_list, *output_end;
 
-static void output(const char *fmt, ...)
+static int show (int v)
+{
+	return (!call_depth && verbosity >= v) || verbosity >= 5;
+}
+
+static void output(int v, const char *fmt, ...)
 {
 	va_list args;
-	int i;
-	for (i = output_indent; i--;)
-		fputs("  ", stdout);
 	va_start(args, fmt);
-	vfprintf(stdout, fmt, args);
+	if (buffer_output && show(v)) {
+		struct output_buffer *b = xmalloc(sizeof(*b));
+		nfvasprintf(&b->str, fmt, args);
+		b->next = NULL;
+		if (output_end)
+			output_end->next = b;
+		else
+			output_list = b;
+		output_end = b;
+	} else if (show(v)) {
+		int i;
+		for (i = call_depth; i--;)
+			fputs("  ", stdout);
+		vfprintf(stdout, fmt, args);
+		fputc('\n', stdout);
+	}
 	va_end(args);
-	fputc('\n', stdout);
+}
+
+static void flush_output()
+{
+	struct output_buffer *b, *n;
+	for (b = output_list; b; b = n) {
+		int i;
+		for (i = call_depth; i--;)
+			fputs("  ", stdout);
+		fputs(b->str, stdout);
+		fputc('\n', stdout);
+		n = b->next;
+		free(b->str);
+		free(b);
+	}
+	output_list = NULL;
+	output_end = NULL;
 }
 
 static void output_commit_title(struct commit *commit)
 {
 	int i;
-	for (i = output_indent; i--;)
+	flush_output();
+	for (i = call_depth; i--;)
 		fputs("  ", stdout);
 	if (commit->util)
 		printf("virtual %s\n", (char *)commit->util);
@@ -110,6 +158,39 @@
 	}
 }
 
+static void progress_interval(int signum)
+{
+	progress_update = 1;
+}
+
+static void setup_progress_signal(void)
+{
+	struct sigaction sa;
+	struct itimerval v;
+
+	memset(&sa, 0, sizeof(sa));
+	sa.sa_handler = progress_interval;
+	sigemptyset(&sa.sa_mask);
+	sa.sa_flags = SA_RESTART;
+	sigaction(SIGALRM, &sa, NULL);
+
+	v.it_interval.tv_sec = 1;
+	v.it_interval.tv_usec = 0;
+	v.it_value = v.it_interval;
+	setitimer(ITIMER_REAL, &v, NULL);
+}
+
+static void display_progress()
+{
+	unsigned percent = total_cnt ? merged_cnt * 100 / total_cnt : 0;
+	if (progress_update || percent != last_percent) {
+		fprintf(stderr, "%4u%% (%u/%u) done\r",
+			percent, merged_cnt, total_cnt);
+		progress_update = 0;
+		last_percent = percent;
+	}
+}
+
 static struct cache_entry *make_cache_entry(unsigned int mode,
 		const unsigned char *sha1, const char *path, int stage, int refresh)
 {
@@ -272,11 +353,14 @@
 	int i;
 
 	unmerged->strdup_paths = 1;
+	total_cnt += active_nr;
 
-	for (i = 0; i < active_nr; i++) {
+	for (i = 0; i < active_nr; i++, merged_cnt++) {
 		struct path_list_item *item;
 		struct stage_data *e;
 		struct cache_entry *ce = active_cache[i];
+		if (do_progress)
+			display_progress();
 		if (!ce_stage(ce))
 			continue;
 
@@ -640,13 +724,13 @@
 	const char *dst_name2 = ren2_dst;
 	if (path_list_has_path(&current_directory_set, ren1_dst)) {
 		dst_name1 = del[delp++] = unique_path(ren1_dst, branch1);
-		output("%s is a directory in %s adding as %s instead",
+		output(1, "%s is a directory in %s added as %s instead",
 		       ren1_dst, branch2, dst_name1);
 		remove_file(0, ren1_dst, 0);
 	}
 	if (path_list_has_path(&current_directory_set, ren2_dst)) {
 		dst_name2 = del[delp++] = unique_path(ren2_dst, branch2);
-		output("%s is a directory in %s adding as %s instead",
+		output(1, "%s is a directory in %s added as %s instead",
 		       ren2_dst, branch1, dst_name2);
 		remove_file(0, ren2_dst, 0);
 	}
@@ -660,7 +744,7 @@
 				const char *branch1)
 {
 	char *new_path = unique_path(ren1->pair->two->path, branch1);
-	output("Renaming %s to %s instead", ren1->pair->one->path, new_path);
+	output(1, "Renamed %s to %s instead", ren1->pair->one->path, new_path);
 	remove_file(0, ren1->pair->two->path, 0);
 	update_file(0, ren1->pair->two->sha1, ren1->pair->two->mode, new_path);
 	free(new_path);
@@ -673,7 +757,7 @@
 {
 	char *new_path1 = unique_path(ren1->pair->two->path, branch1);
 	char *new_path2 = unique_path(ren2->pair->two->path, branch2);
-	output("Renaming %s to %s and %s to %s instead",
+	output(1, "Renamed %s to %s and %s to %s instead",
 	       ren1->pair->one->path, new_path1,
 	       ren2->pair->one->path, new_path2);
 	remove_file(0, ren1->pair->two->path, 0);
@@ -766,7 +850,7 @@
 			ren2->processed = 1;
 			if (strcmp(ren1_dst, ren2_dst) != 0) {
 				clean_merge = 0;
-				output("CONFLICT (rename/rename): "
+				output(1, "CONFLICT (rename/rename): "
 				       "Rename %s->%s in branch %s "
 				       "rename %s->%s in %s",
 				       src, ren1_dst, branch1,
@@ -781,13 +865,13 @@
 						 branch1,
 						 branch2);
 				if (mfi.merge || !mfi.clean)
-					output("Renaming %s->%s", src, ren1_dst);
+					output(1, "Renamed %s->%s", src, ren1_dst);
 
 				if (mfi.merge)
-					output("Auto-merging %s", ren1_dst);
+					output(2, "Auto-merged %s", ren1_dst);
 
 				if (!mfi.clean) {
-					output("CONFLICT (content): merge conflict in %s",
+					output(1, "CONFLICT (content): merge conflict in %s",
 					       ren1_dst);
 					clean_merge = 0;
 
@@ -818,14 +902,14 @@
 
 			if (path_list_has_path(&current_directory_set, ren1_dst)) {
 				clean_merge = 0;
-				output("CONFLICT (rename/directory): Rename %s->%s in %s "
+				output(1, "CONFLICT (rename/directory): Renamed %s->%s in %s "
 				       " directory %s added in %s",
 				       ren1_src, ren1_dst, branch1,
 				       ren1_dst, branch2);
 				conflict_rename_dir(ren1, branch1);
 			} else if (sha_eq(src_other.sha1, null_sha1)) {
 				clean_merge = 0;
-				output("CONFLICT (rename/delete): Rename %s->%s in %s "
+				output(1, "CONFLICT (rename/delete): Renamed %s->%s in %s "
 				       "and deleted in %s",
 				       ren1_src, ren1_dst, branch1,
 				       branch2);
@@ -834,19 +918,19 @@
 				const char *new_path;
 				clean_merge = 0;
 				try_merge = 1;
-				output("CONFLICT (rename/add): Rename %s->%s in %s. "
+				output(1, "CONFLICT (rename/add): Renamed %s->%s in %s. "
 				       "%s added in %s",
 				       ren1_src, ren1_dst, branch1,
 				       ren1_dst, branch2);
 				new_path = unique_path(ren1_dst, branch2);
-				output("Adding as %s instead", new_path);
+				output(1, "Added as %s instead", new_path);
 				update_file(0, dst_other.sha1, dst_other.mode, new_path);
 			} else if ((item = path_list_lookup(ren1_dst, renames2Dst))) {
 				ren2 = item->util;
 				clean_merge = 0;
 				ren2->processed = 1;
-				output("CONFLICT (rename/rename): Rename %s->%s in %s. "
-				       "Rename %s->%s in %s",
+				output(1, "CONFLICT (rename/rename): Renamed %s->%s in %s. "
+				       "Renamed %s->%s in %s",
 				       ren1_src, ren1_dst, branch1,
 				       ren2->pair->one->path, ren2->pair->two->path, branch2);
 				conflict_rename_rename_2(ren1, branch1, ren2, branch2);
@@ -870,11 +954,11 @@
 						a_branch, b_branch);
 
 				if (mfi.merge || !mfi.clean)
-					output("Renaming %s => %s", ren1_src, ren1_dst);
+					output(1, "Renamed %s => %s", ren1_src, ren1_dst);
 				if (mfi.merge)
-					output("Auto-merging %s", ren1_dst);
+					output(2, "Auto-merged %s", ren1_dst);
 				if (!mfi.clean) {
-					output("CONFLICT (rename/modify): Merge conflict in %s",
+					output(1, "CONFLICT (rename/modify): Merge conflict in %s",
 					       ren1_dst);
 					clean_merge = 0;
 
@@ -922,20 +1006,20 @@
 			/* Deleted in both or deleted in one and
 			 * unchanged in the other */
 			if (a_sha)
-				output("Removing %s", path);
+				output(2, "Removed %s", path);
 			/* do not touch working file if it did not exist */
 			remove_file(1, path, !a_sha);
 		} else {
 			/* Deleted in one and changed in the other */
 			clean_merge = 0;
 			if (!a_sha) {
-				output("CONFLICT (delete/modify): %s deleted in %s "
+				output(1, "CONFLICT (delete/modify): %s deleted in %s "
 				       "and modified in %s. Version %s of %s left in tree.",
 				       path, branch1,
 				       branch2, branch2, path);
 				update_file(0, b_sha, b_mode, path);
 			} else {
-				output("CONFLICT (delete/modify): %s deleted in %s "
+				output(1, "CONFLICT (delete/modify): %s deleted in %s "
 				       "and modified in %s. Version %s of %s left in tree.",
 				       path, branch2,
 				       branch1, branch1, path);
@@ -968,13 +1052,13 @@
 		if (path_list_has_path(&current_directory_set, path)) {
 			const char *new_path = unique_path(path, add_branch);
 			clean_merge = 0;
-			output("CONFLICT (%s): There is a directory with name %s in %s. "
-			       "Adding %s as %s",
+			output(1, "CONFLICT (%s): There is a directory with name %s in %s. "
+			       "Added %s as %s",
 			       conf, path, other_branch, path, new_path);
 			remove_file(0, path, 0);
 			update_file(0, sha, mode, new_path);
 		} else {
-			output("Adding %s", path);
+			output(2, "Added %s", path);
 			update_file(1, sha, mode, path);
 		}
 	} else if (a_sha && b_sha) {
@@ -988,7 +1072,7 @@
 			reason = "add/add";
 			o_sha = (unsigned char *)null_sha1;
 		}
-		output("Auto-merging %s", path);
+		output(2, "Auto-merged %s", path);
 		o.path = a.path = b.path = (char *)path;
 		hashcpy(o.sha1, o_sha);
 		o.mode = o_mode;
@@ -1004,7 +1088,7 @@
 			update_file(1, mfi.sha, mfi.mode, path);
 		else {
 			clean_merge = 0;
-			output("CONFLICT (%s): Merge conflict in %s",
+			output(1, "CONFLICT (%s): Merge conflict in %s",
 					reason, path);
 
 			if (index_only)
@@ -1028,7 +1112,7 @@
 {
 	int code, clean;
 	if (sha_eq(common->object.sha1, merge->object.sha1)) {
-		output("Already uptodate!");
+		output(0, "Already uptodate!");
 		*result = head;
 		return 1;
 	}
@@ -1053,13 +1137,15 @@
 		re_merge = get_renames(merge, common, head, merge, entries);
 		clean = process_renames(re_head, re_merge,
 				branch1, branch2);
-		for (i = 0; i < entries->nr; i++) {
+		total_cnt += entries->nr;
+		for (i = 0; i < entries->nr; i++, merged_cnt++) {
 			const char *path = entries->items[i].path;
 			struct stage_data *e = entries->items[i].util;
-			if (e->processed)
-				continue;
-			if (!process_entry(path, e, branch1, branch2))
+			if (!e->processed
+				&& !process_entry(path, e, branch1, branch2))
 				clean = 0;
+			if (do_progress)
+				display_progress();
 		}
 
 		path_list_clear(re_merge, 0);
@@ -1095,7 +1181,6 @@
 		 struct commit *h2,
 		 const char *branch1,
 		 const char *branch2,
-		 int call_depth /* =0 */,
 		 struct commit_list *ca,
 		 struct commit **result)
 {
@@ -1104,18 +1189,22 @@
 	struct tree *mrtree;
 	int clean;
 
-	output("Merging:");
-	output_commit_title(h1);
-	output_commit_title(h2);
+	if (show(4)) {
+		output(4, "Merging:");
+		output_commit_title(h1);
+		output_commit_title(h2);
+	}
 
 	if (!ca) {
 		ca = get_merge_bases(h1, h2, 1);
 		ca = reverse_commit_list(ca);
 	}
 
-	output("found %u common ancestor(s):", commit_list_count(ca));
-	for (iter = ca; iter; iter = iter->next)
-		output_commit_title(iter->item);
+	if (show(5)) {
+		output(5, "found %u common ancestor(s):", commit_list_count(ca));
+		for (iter = ca; iter; iter = iter->next)
+			output_commit_title(iter->item);
+	}
 
 	merged_common_ancestors = pop_commit(&ca);
 	if (merged_common_ancestors == NULL) {
@@ -1129,7 +1218,7 @@
 	}
 
 	for (iter = ca; iter; iter = iter->next) {
-		output_indent = call_depth + 1;
+		call_depth++;
 		/*
 		 * When the merge fails, the result contains files
 		 * with conflict markers. The cleanness flag is
@@ -1141,17 +1230,16 @@
 		merge(merged_common_ancestors, iter->item,
 		      "Temporary merge branch 1",
 		      "Temporary merge branch 2",
-		      call_depth + 1,
 		      NULL,
 		      &merged_common_ancestors);
-		output_indent = call_depth;
+		call_depth--;
 
 		if (!merged_common_ancestors)
 			die("merge returned no commit");
 	}
 
 	discard_cache();
-	if (call_depth == 0) {
+	if (!call_depth) {
 		read_cache();
 		index_only = 0;
 	} else
@@ -1165,6 +1253,16 @@
 		commit_list_insert(h1, &(*result)->parents);
 		commit_list_insert(h2, &(*result)->parents->next);
 	}
+	if (!call_depth && do_progress) {
+		/* Make sure we end at 100% */
+		if (!total_cnt)
+			total_cnt = 1;
+		merged_cnt = total_cnt;
+		progress_update = 1;
+		display_progress();
+		fputc('\n', stderr);
+	}
+	flush_output();
 	return clean;
 }
 
@@ -1198,6 +1296,15 @@
 	return (struct commit *)object;
 }
 
+static int merge_config(const char *var, const char *value)
+{
+	if (!strcasecmp(var, "merge.verbosity")) {
+		verbosity = git_config_int(var, value);
+		return 0;
+	}
+	return git_default_config(var, value);
+}
+
 int main(int argc, char *argv[])
 {
 	static const char *bases[20];
@@ -1209,7 +1316,9 @@
 	struct lock_file *lock = xcalloc(1, sizeof(struct lock_file));
 	int index_fd;
 
-	git_config(git_default_config); /* core.filemode */
+	git_config(merge_config);
+	if (getenv("GIT_MERGE_VERBOSITY"))
+		verbosity = strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10);
 
 	if (argc < 4)
 		die("Usage: %s <base>... -- <head> <remote> ...\n", argv[0]);
@@ -1222,6 +1331,12 @@
 	}
 	if (argc - i != 3) /* "--" "<head>" "<remote>" */
 		die("Not handling anything other than two heads merge.");
+	if (verbosity >= 5) {
+		buffer_output = 0;
+		do_progress = 0;
+	}
+	else
+		do_progress = isatty(1);
 
 	branch1 = argv[++i];
 	branch2 = argv[++i];
@@ -1231,7 +1346,11 @@
 
 	branch1 = better_branch_name(branch1);
 	branch2 = better_branch_name(branch2);
-	printf("Merging %s with %s\n", branch1, branch2);
+
+	if (do_progress)
+		setup_progress_signal();
+	if (show(3))
+		printf("Merging %s with %s\n", branch1, branch2);
 
 	index_fd = hold_lock_file_for_update(lock, get_index_file(), 1);
 
@@ -1239,7 +1358,7 @@
 		struct commit *ancestor = get_ref(bases[i]);
 		ca = commit_list_insert(ancestor, &ca);
 	}
-	clean = merge(h1, h2, branch1, branch2, 0, ca, &result);
+	clean = merge(h1, h2, branch1, branch2, ca, &result);
 
 	if (active_cache_changed &&
 	    (write_cache(index_fd, active_cache, active_nr) ||
diff --git a/pack.h b/pack.h
index 4814800..deb427e 100644
--- a/pack.h
+++ b/pack.h
@@ -10,10 +10,43 @@
 #define PACK_VERSION 2
 #define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
 struct pack_header {
-	unsigned int hdr_signature;
-	unsigned int hdr_version;
-	unsigned int hdr_entries;
+	uint32_t hdr_signature;
+	uint32_t hdr_version;
+	uint32_t hdr_entries;
 };
 
+/*
+ * Packed object index header
+ *
+ * struct pack_idx_header {
+ * 	uint32_t idx_signature;
+ *	uint32_t idx_version;
+ * };
+ *
+ * Note: this header isn't active yet.  In future versions of git
+ * we may change the index file format.  At that time we would start
+ * the first four bytes of the new index format with this signature,
+ * as all older git binaries would find this value illegal and abort
+ * reading the file.
+ *
+ * This is the case because the number of objects in a packfile
+ * cannot exceed 1,431,660,000 as every object would need at least
+ * 3 bytes of data and the overall packfile cannot exceed 4 GiB due
+ * to the 32 bit offsets used by the index.  Clearly the signature
+ * exceeds this maximum.
+ *
+ * Very old git binaries will also compare the first 4 bytes to the
+ * next 4 bytes in the index and abort with a "non-monotonic index"
+ * error if the second 4 byte word is smaller than the first 4
+ * byte word.  This would be true in the proposed future index
+ * format as idx_signature would be greater than idx_version.
+ */
+#define PACK_IDX_SIGNATURE 0xff744f63	/* "\377tOc" */
+
 extern int verify_pack(struct packed_git *, int);
+
+#define PH_ERROR_EOF		(-1)
+#define PH_ERROR_PACK_SIGNATURE	(-2)
+#define PH_ERROR_PROTOCOL	(-3)
+extern int read_pack_header(int fd, struct pack_header *);
 #endif
diff --git a/peek-remote.c b/peek-remote.c
index 353da00..ef3c76c 100644
--- a/peek-remote.c
+++ b/peek-remote.c
@@ -3,8 +3,8 @@
 #include "pkt-line.h"
 
 static const char peek_remote_usage[] =
-"git-peek-remote [--exec=upload-pack] [host:]directory";
-static const char *exec = "git-upload-pack";
+"git-peek-remote [--upload-pack=<git-upload-pack>] [<host>:]<directory>";
+static const char *uploadpack = "git-upload-pack";
 
 static int peek_remote(int fd[2], unsigned flags)
 {
@@ -35,8 +35,12 @@
 		char *arg = argv[i];
 
 		if (*arg == '-') {
+			if (!strncmp("--upload-pack=", arg, 14)) {
+				uploadpack = arg + 14;
+				continue;
+			}
 			if (!strncmp("--exec=", arg, 7)) {
-				exec = arg + 7;
+				uploadpack = arg + 7;
 				continue;
 			}
 			if (!strcmp("--tags", arg)) {
@@ -60,7 +64,7 @@
 	if (!dest || i != argc - 1)
 		usage(peek_remote_usage);
 
-	pid = git_connect(fd, dest, exec);
+	pid = git_connect(fd, dest, uploadpack);
 	if (pid < 0)
 		return 1;
 	ret = peek_remote(fd, flags);
diff --git a/perl/Git.pm b/perl/Git.pm
index 3474ad3..5d1ccaa 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -275,7 +275,7 @@
 
 	} else {
 		my @lines = <$fh>;
-		chomp @lines;
+		defined and chomp for @lines;
 		try {
 			_cmd_close($fh, $ctx);
 		} catch Git::Error::Command with {
@@ -482,14 +482,14 @@
 
 =item config ( VARIABLE )
 
-Retrieve the configuration C<VARIABLE> in the same manner as C<repo-config>
+Retrieve the configuration C<VARIABLE> in the same manner as C<config>
 does. In scalar context requires the variable to be set only one time
 (exception is thrown otherwise), in array context returns allows the
 variable to be set multiple times and returns all the values.
 
 Must be called on a repository instance.
 
-This currently wraps command('repo-config') so it is not so fast.
+This currently wraps command('config') so it is not so fast.
 
 =cut
 
@@ -500,9 +500,9 @@
 
 	try {
 		if (wantarray) {
-			return $self->command('repo-config', '--get-all', $var);
+			return $self->command('config', '--get-all', $var);
 		} else {
-			return $self->command_oneline('repo-config', '--get', $var);
+			return $self->command_oneline('config', '--get', $var);
 		}
 	} catch Git::Error::Command with {
 		my $E = shift;
@@ -736,13 +736,19 @@
 	_check_valid_cmd($cmd);
 
 	my $fh;
-	if ($^O eq '##INSERT_ACTIVESTATE_STRING_HERE##') {
+	if ($^O eq 'MSWin32') {
 		# ActiveState Perl
 		#defined $opts{STDERR} and
 		#	warn 'ignoring STDERR option - running w/ ActiveState';
 		$direction eq '-|' or
 			die 'input pipe for ActiveState not implemented';
-		tie ($fh, 'Git::activestate_pipe', $cmd, @args);
+		# the strange construction with *ACPIPE is just to
+		# explain the tie below that we want to bind to
+		# a handle class, not scalar. It is not known if
+		# it is something specific to ActiveState Perl or
+		# just a Perl quirk.
+		tie (*ACPIPE, 'Git::activestate_pipe', $cmd, @args);
+		$fh = *ACPIPE;
 
 	} else {
 		my $pid = open($fh, $direction);
@@ -809,8 +815,9 @@
 	# FIXME: This is probably horrible idea and the thing will explode
 	# at the moment you give it arguments that require some quoting,
 	# but I have no ActiveState clue... --pasky
-	my $cmdline = join " ", @params;
-	my @data = qx{$cmdline};
+	# Let's just hope ActiveState Perl does at least the quoting
+	# correctly.
+	my @data = qx{git @params};
 	bless { i => 0, data => \@data }, $class;
 }
 
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index 4168775..9b117fd 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -20,6 +20,10 @@
 my %extra;
 $extra{DESTDIR} = $ENV{DESTDIR} if $ENV{DESTDIR};
 
+# redirect stdout, otherwise the message "Writing perl.mak for Git"
+# disrupts the output for the target 'instlibdir'
+open STDOUT, ">&STDERR";
+
 WriteMakefile(
 	NAME            => 'Git',
 	VERSION_FROM    => 'Git.pm',
diff --git a/quote.c b/quote.c
index a418a0f..fb9e4ca 100644
--- a/quote.c
+++ b/quote.c
@@ -387,3 +387,37 @@
 	}
 	fputc(sq, stream);
 }
+
+void tcl_quote_print(FILE *stream, const char *src)
+{
+	char c;
+
+	fputc('"', stream);
+	while ((c = *src++)) {
+		switch (c) {
+		case '[': case ']':
+		case '{': case '}':
+		case '$': case '\\': case '"':
+			fputc('\\', stream);
+		default:
+			fputc(c, stream);
+			break;
+		case '\f':
+			fputs("\\f", stream);
+			break;
+		case '\r':
+			fputs("\\r", stream);
+			break;
+		case '\n':
+			fputs("\\n", stream);
+			break;
+		case '\t':
+			fputs("\\t", stream);
+			break;
+		case '\v':
+			fputs("\\v", stream);
+			break;
+		}
+	}
+	fputc('"', stream);
+}
diff --git a/quote.h b/quote.h
index b55e699..bdc3610 100644
--- a/quote.h
+++ b/quote.h
@@ -55,5 +55,6 @@
 /* quoting as a string literal for other languages */
 extern void perl_quote_print(FILE *stream, const char *src);
 extern void python_quote_print(FILE *stream, const char *src);
+extern void tcl_quote_print(FILE *stream, const char *src);
 
 #endif
diff --git a/receive-pack.c b/receive-pack.c
index c176d8f..7311c82 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -10,6 +10,8 @@
 static const char receive_pack_usage[] = "git-receive-pack <git-dir>";
 
 static int deny_non_fast_forwards = 0;
+static int receive_unpack_limit = -1;
+static int transfer_unpack_limit = -1;
 static int unpack_limit = 100;
 static int report_status;
 
@@ -18,21 +20,22 @@
 
 static int receive_pack_config(const char *var, const char *value)
 {
-	git_default_config(var, value);
-
-	if (strcmp(var, "receive.denynonfastforwards") == 0)
-	{
+	if (strcmp(var, "receive.denynonfastforwards") == 0) {
 		deny_non_fast_forwards = git_config_bool(var, value);
 		return 0;
 	}
 
-	if (strcmp(var, "receive.unpacklimit") == 0)
-	{
-		unpack_limit = git_config_int(var, value);
+	if (strcmp(var, "receive.unpacklimit") == 0) {
+		receive_unpack_limit = git_config_int(var, value);
 		return 0;
 	}
 
-	return 0;
+	if (strcmp(var, "transfer.unpacklimit") == 0) {
+		transfer_unpack_limit = git_config_int(var, value);
+		return 0;
+	}
+
+	return git_default_config(var, value);
 }
 
 static int show_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
@@ -250,20 +253,22 @@
 
 static const char *parse_pack_header(struct pack_header *hdr)
 {
-	char *c = (char*)hdr;
-	ssize_t remaining = sizeof(struct pack_header);
-	do {
-		ssize_t r = xread(0, c, remaining);
-		if (r <= 0)
-			return "eof before pack header was fully read";
-		remaining -= r;
-		c += r;
-	} while (remaining > 0);
-	if (hdr->hdr_signature != htonl(PACK_SIGNATURE))
+	switch (read_pack_header(0, hdr)) {
+	case PH_ERROR_EOF:
+		return "eof before pack header was fully read";
+
+	case PH_ERROR_PACK_SIGNATURE:
 		return "protocol error (pack signature mismatch detected)";
-	if (!pack_version_ok(hdr->hdr_version))
+
+	case PH_ERROR_PROTOCOL:
 		return "protocol error (pack version unsupported)";
-	return NULL;
+
+	default:
+		return "unknown error in parse_pack_header";
+
+	case 0:
+		return NULL;
+	}
 }
 
 static const char *pack_lockfile;
@@ -421,11 +426,16 @@
 	if (!enter_repo(dir, 0))
 		die("'%s': unable to chdir or not a git archive", dir);
 
-	setup_ident();
-	/* don't die if gecos is empty */
-	ignore_missing_committer_name();
+	if (is_repository_shallow())
+		die("attempt to push into a shallow repository");
+
 	git_config(receive_pack_config);
 
+	if (0 <= transfer_unpack_limit)
+		unpack_limit = transfer_unpack_limit;
+	else if (0 <= receive_unpack_limit)
+		unpack_limit = receive_unpack_limit;
+
 	write_head_info();
 
 	/* EOF */
diff --git a/reflog-walk.c b/reflog-walk.c
new file mode 100644
index 0000000..8262160
--- /dev/null
+++ b/reflog-walk.c
@@ -0,0 +1,250 @@
+#include "cache.h"
+#include "commit.h"
+#include "refs.h"
+#include "diff.h"
+#include "revision.h"
+#include "path-list.h"
+#include "reflog-walk.h"
+
+struct complete_reflogs {
+	char *ref;
+	struct reflog_info {
+		unsigned char osha1[20], nsha1[20];
+		char *email;
+		unsigned long timestamp;
+		int tz;
+		char *message;
+	} *items;
+	int nr, alloc;
+};
+
+static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1,
+		const char *email, unsigned long timestamp, int tz,
+		const char *message, void *cb_data)
+{
+	struct complete_reflogs *array = cb_data;
+	struct reflog_info *item;
+
+	if (array->nr >= array->alloc) {
+		array->alloc = alloc_nr(array->nr + 1);
+		array->items = xrealloc(array->items, array->alloc *
+			sizeof(struct reflog_info));
+	}
+	item = array->items + array->nr;
+	memcpy(item->osha1, osha1, 20);
+	memcpy(item->nsha1, nsha1, 20);
+	item->email = xstrdup(email);
+	item->timestamp = timestamp;
+	item->tz = tz;
+	item->message = xstrdup(message);
+	array->nr++;
+	return 0;
+}
+
+static struct complete_reflogs *read_complete_reflog(const char *ref)
+{
+	struct complete_reflogs *reflogs =
+		xcalloc(sizeof(struct complete_reflogs), 1);
+	reflogs->ref = xstrdup(ref);
+	for_each_reflog_ent(ref, read_one_reflog, reflogs);
+	if (reflogs->nr == 0) {
+		unsigned char sha1[20];
+		const char *name = resolve_ref(ref, sha1, 1, NULL);
+		if (name)
+			for_each_reflog_ent(name, read_one_reflog, reflogs);
+	}
+	if (reflogs->nr == 0) {
+		int len = strlen(ref);
+		char *refname = xmalloc(len + 12);
+		sprintf(refname, "refs/%s", ref);
+		for_each_reflog_ent(refname, read_one_reflog, reflogs);
+		if (reflogs->nr == 0) {
+			sprintf(refname, "refs/heads/%s", ref);
+			for_each_reflog_ent(refname, read_one_reflog, reflogs);
+		}
+		free(refname);
+	}
+	return reflogs;
+}
+
+static int get_reflog_recno_by_time(struct complete_reflogs *array,
+	unsigned long timestamp)
+{
+	int i;
+	for (i = array->nr - 1; i >= 0; i--)
+		if (timestamp >= array->items[i].timestamp)
+			return i;
+	return -1;
+}
+
+struct commit_info_lifo {
+	struct commit_info {
+		struct commit *commit;
+		void *util;
+	} *items;
+	int nr, alloc;
+};
+
+static struct commit_info *get_commit_info(struct commit *commit,
+		struct commit_info_lifo *lifo, int pop)
+{
+	int i;
+	for (i = 0; i < lifo->nr; i++)
+		if (lifo->items[i].commit == commit) {
+			struct commit_info *result = &lifo->items[i];
+			if (pop) {
+				if (i + 1 < lifo->nr)
+					memmove(lifo->items + i,
+						lifo->items + i + 1,
+						(lifo->nr - i) *
+						sizeof(struct commit_info));
+				lifo->nr--;
+			}
+			return result;
+		}
+	return NULL;
+}
+
+static void add_commit_info(struct commit *commit, void *util,
+		struct commit_info_lifo *lifo)
+{
+	struct commit_info *info;
+	if (lifo->nr >= lifo->alloc) {
+		lifo->alloc = alloc_nr(lifo->nr + 1);
+		lifo->items = xrealloc(lifo->items,
+			lifo->alloc * sizeof(struct commit_info));
+	}
+	info = lifo->items + lifo->nr;
+	info->commit = commit;
+	info->util = util;
+	lifo->nr++;
+}
+
+struct commit_reflog {
+	int flag, recno;
+	struct complete_reflogs *reflogs;
+};
+
+struct reflog_walk_info {
+	struct commit_info_lifo reflogs;
+	struct path_list complete_reflogs;
+	struct commit_reflog *last_commit_reflog;
+};
+
+void init_reflog_walk(struct reflog_walk_info** info)
+{
+	*info = xcalloc(sizeof(struct reflog_walk_info), 1);
+}
+
+void add_reflog_for_walk(struct reflog_walk_info *info,
+		struct commit *commit, const char *name)
+{
+	unsigned long timestamp = 0;
+	int recno = -1;
+	struct path_list_item *item;
+	struct complete_reflogs *reflogs;
+	char *branch, *at = strchr(name, '@');
+	struct commit_reflog *commit_reflog;
+
+	if (commit->object.flags & UNINTERESTING)
+		die ("Cannot walk reflogs for %s", name);
+
+	branch = xstrdup(name);
+	if (at && at[1] == '{') {
+		char *ep;
+		branch[at - name] = '\0';
+		recno = strtoul(at + 2, &ep, 10);
+		if (*ep != '}') {
+			recno = -1;
+			timestamp = approxidate(at + 2);
+		}
+	} else
+		recno = 0;
+
+	item = path_list_lookup(branch, &info->complete_reflogs);
+	if (item)
+		reflogs = item->util;
+	else {
+		reflogs = read_complete_reflog(branch);
+		if (!reflogs || reflogs->nr == 0)
+			die("No reflogs found for '%s'", branch);
+		path_list_insert(branch, &info->complete_reflogs)->util
+			= reflogs;
+	}
+
+	commit_reflog = xcalloc(sizeof(struct commit_reflog), 1);
+	if (recno < 0) {
+		commit_reflog->flag = 1;
+		commit_reflog->recno = get_reflog_recno_by_time(reflogs, timestamp);
+		if (commit_reflog->recno < 0) {
+			free(branch);
+			free(commit_reflog);
+			return;
+		}
+	} else
+		commit_reflog->recno = reflogs->nr - recno - 1;
+	commit_reflog->reflogs = reflogs;
+
+	add_commit_info(commit, commit_reflog, &info->reflogs);
+}
+
+void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
+{
+	struct commit_info *commit_info =
+		get_commit_info(commit, &info->reflogs, 0);
+	struct commit_reflog *commit_reflog;
+	struct reflog_info *reflog;
+
+	info->last_commit_reflog = NULL;
+	if (!commit_info)
+		return;
+
+	commit_reflog = commit_info->util;
+	if (commit_reflog->recno < 0) {
+		commit->parents = NULL;
+		return;
+	}
+
+	reflog = &commit_reflog->reflogs->items[commit_reflog->recno];
+	info->last_commit_reflog = commit_reflog;
+	commit_reflog->recno--;
+	commit_info->commit = (struct commit *)parse_object(reflog->osha1);
+	if (!commit_info->commit) {
+		commit->parents = NULL;
+		return;
+	}
+
+	commit->parents = xcalloc(sizeof(struct commit_list), 1);
+	commit->parents->item = commit_info->commit;
+	commit->object.flags &= ~(ADDED | SEEN | SHOWN);
+}
+
+void show_reflog_message(struct reflog_walk_info* info, int oneline)
+{
+	if (info && info->last_commit_reflog) {
+		struct commit_reflog *commit_reflog = info->last_commit_reflog;
+		struct reflog_info *info;
+
+		info = &commit_reflog->reflogs->items[commit_reflog->recno+1];
+		if (oneline) {
+			printf("%s@{", commit_reflog->reflogs->ref);
+			if (commit_reflog->flag)
+				printf("%s", show_date(info->timestamp, 0, 1));
+			else
+				printf("%d", commit_reflog->reflogs->nr
+				       - 2 - commit_reflog->recno);
+			printf("}: %s", info->message);
+		}
+		else {
+			printf("Reflog: %s@{", commit_reflog->reflogs->ref);
+			if (commit_reflog->flag)
+				printf("%s", show_rfc2822_date(info->timestamp,
+							       info->tz));
+			else
+				printf("%d", commit_reflog->reflogs->nr
+				       - 2 - commit_reflog->recno);
+			printf("} (%s)\nReflog message: %s",
+			       info->email, info->message);
+		}
+	}
+}
diff --git a/reflog-walk.h b/reflog-walk.h
new file mode 100644
index 0000000..e63d867
--- /dev/null
+++ b/reflog-walk.h
@@ -0,0 +1,11 @@
+#ifndef REFLOG_WALK_H
+#define REFLOG_WALK_H
+
+extern void init_reflog_walk(struct reflog_walk_info** info);
+extern void add_reflog_for_walk(struct reflog_walk_info *info,
+		struct commit *commit, const char *name);
+extern void fake_reflog_parent(struct reflog_walk_info *info,
+		struct commit *commit);
+extern void show_reflog_message(struct reflog_walk_info *info, int);
+
+#endif
diff --git a/refs.c b/refs.c
index 689ac50..3db444c 100644
--- a/refs.c
+++ b/refs.c
@@ -331,7 +331,11 @@
 		return -1;
 	}
 	lockpath = mkpath("%s.lock", git_HEAD);
-	fd = open(lockpath, O_CREAT | O_EXCL | O_WRONLY, 0666);	
+	fd = open(lockpath, O_CREAT | O_EXCL | O_WRONLY, 0666);
+	if (fd < 0) {
+		error("Unable to open %s for writing", lockpath);
+		return -5;
+	}
 	written = write_in_full(fd, ref, len);
 	close(fd);
 	if (written != len) {
@@ -706,6 +710,8 @@
 
 struct ref_lock *lock_any_ref_for_update(const char *ref, const unsigned char *old_sha1)
 {
+	if (check_ref_format(ref) == -1)
+		return NULL;
 	return lock_ref_sha1_basic(ref, old_sha1, NULL);
 }
 
@@ -837,7 +843,12 @@
 
  retry:
 	if (log && rename(git_path("tmp-renamed-log"), git_path("logs/%s", newref))) {
-		if (errno==EISDIR) {
+		if (errno==EISDIR || errno==ENOTDIR) {
+			/*
+			 * rename(a, b) when b is an existing
+			 * directory ought to result in ISDIR, but
+			 * Solaris 5.8 gives ENOTDIR.  Sheesh.
+			 */
 			if (remove_empty_directories(git_path("logs/%s", newref))) {
 				error("Directory not empty: logs/%s", newref);
 				goto rollback;
@@ -920,6 +931,7 @@
 {
 	int logfd, written, oflags = O_APPEND | O_WRONLY;
 	unsigned maxlen, len;
+	int msglen;
 	char *logrec;
 	const char *committer;
 
@@ -953,24 +965,30 @@
 				     lock->log_file, strerror(errno));
 	}
 
-	committer = git_committer_info(1);
+	msglen = 0;
 	if (msg) {
-		maxlen = strlen(committer) + strlen(msg) + 2*40 + 5;
-		logrec = xmalloc(maxlen);
-		len = snprintf(logrec, maxlen, "%s %s %s\t%s\n",
-			sha1_to_hex(lock->old_sha1),
-			sha1_to_hex(sha1),
-			committer,
-			msg);
+		/* clean up the message and make sure it is a single line */
+		for ( ; *msg; msg++)
+			if (!isspace(*msg))
+				break;
+		if (*msg) {
+			const char *ep = strchr(msg, '\n');
+			if (ep)
+				msglen = ep - msg;
+			else
+				msglen = strlen(msg);
+		}
 	}
-	else {
-		maxlen = strlen(committer) + 2*40 + 4;
-		logrec = xmalloc(maxlen);
-		len = snprintf(logrec, maxlen, "%s %s %s\n",
-			sha1_to_hex(lock->old_sha1),
-			sha1_to_hex(sha1),
-			committer);
-	}
+
+	committer = git_committer_info(-1);
+	maxlen = strlen(committer) + msglen + 100;
+	logrec = xmalloc(maxlen);
+	len = sprintf(logrec, "%s %s %s\n",
+		      sha1_to_hex(lock->old_sha1),
+		      sha1_to_hex(sha1),
+		      committer);
+	if (msglen)
+		len += sprintf(logrec + len - 1, "\t%.*s\n", msglen, msg) - 1;
 	written = len <= maxlen ? write_in_full(logfd, logrec, len) : -1;
 	free(logrec);
 	close(logfd);
@@ -1012,7 +1030,21 @@
 	return 0;
 }
 
-int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *sha1)
+static char *ref_msg(const char *line, const char *endp)
+{
+	const char *ep;
+	char *msg;
+
+	line += 82;
+	for (ep = line; ep < endp && *ep != '\n'; ep++)
+		;
+	msg = xmalloc(ep - line + 1);
+	memcpy(msg, line, ep - line);
+	msg[ep - line] = 0;
+	return msg;
+}
+
+int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *sha1, char **msg, unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt)
 {
 	const char *logfile, *logdata, *logend, *rec, *lastgt, *lastrec;
 	char *tz_c;
@@ -1020,6 +1052,7 @@
 	struct stat st;
 	unsigned long date;
 	unsigned char logged_sha1[20];
+	void *log_mapped;
 
 	logfile = git_path("logs/%s", ref);
 	logfd = open(logfile, O_RDONLY, 0);
@@ -1028,7 +1061,8 @@
 	fstat(logfd, &st);
 	if (!st.st_size)
 		die("Log %s is empty.", logfile);
-	logdata = xmmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, logfd, 0);
+	log_mapped = xmmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, logfd, 0);
+	logdata = log_mapped;
 	close(logfd);
 
 	lastrec = NULL;
@@ -1047,13 +1081,21 @@
 			die("Log %s is corrupt.", logfile);
 		date = strtoul(lastgt + 1, &tz_c, 10);
 		if (date <= at_time || cnt == 0) {
+			tz = strtoul(tz_c, NULL, 10);
+			if (msg)
+				*msg = ref_msg(rec, logend);
+			if (cutoff_time)
+				*cutoff_time = date;
+			if (cutoff_tz)
+				*cutoff_tz = tz;
+			if (cutoff_cnt)
+				*cutoff_cnt = reccnt - 1;
 			if (lastrec) {
 				if (get_sha1_hex(lastrec, logged_sha1))
 					die("Log %s is corrupt.", logfile);
 				if (get_sha1_hex(rec + 41, sha1))
 					die("Log %s is corrupt.", logfile);
 				if (hashcmp(logged_sha1, sha1)) {
-					tz = strtoul(tz_c, NULL, 10);
 					fprintf(stderr,
 						"warning: Log %s has gap after %s.\n",
 						logfile, show_rfc2822_date(date, tz));
@@ -1067,13 +1109,12 @@
 				if (get_sha1_hex(rec + 41, logged_sha1))
 					die("Log %s is corrupt.", logfile);
 				if (hashcmp(logged_sha1, sha1)) {
-					tz = strtoul(tz_c, NULL, 10);
 					fprintf(stderr,
 						"warning: Log %s unexpectedly ended on %s.\n",
 						logfile, show_rfc2822_date(date, tz));
 				}
 			}
-			munmap((void*)logdata, st.st_size);
+			munmap(log_mapped, st.st_size);
 			return 0;
 		}
 		lastrec = rec;
@@ -1090,14 +1131,17 @@
 	tz = strtoul(tz_c, NULL, 10);
 	if (get_sha1_hex(logdata, sha1))
 		die("Log %s is corrupt.", logfile);
-	munmap((void*)logdata, st.st_size);
-	if (at_time)
-		fprintf(stderr, "warning: Log %s only goes back to %s.\n",
-			logfile, show_rfc2822_date(date, tz));
-	else
-		fprintf(stderr, "warning: Log %s only has %d entries.\n",
-			logfile, reccnt);
-	return 0;
+	if (msg)
+		*msg = ref_msg(logdata, logend);
+	munmap(log_mapped, st.st_size);
+
+	if (cutoff_time)
+		*cutoff_time = date;
+	if (cutoff_tz)
+		*cutoff_tz = tz;
+	if (cutoff_cnt)
+		*cutoff_cnt = reccnt;
+	return 1;
 }
 
 int for_each_reflog_ent(const char *ref, each_reflog_ent_fn fn, void *cb_data)
@@ -1105,6 +1149,7 @@
 	const char *logfile;
 	FILE *logfp;
 	char buf[1024];
+	int ret = 0;
 
 	logfile = git_path("logs/%s", ref);
 	logfp = fopen(logfile, "r");
@@ -1114,7 +1159,7 @@
 		unsigned char osha1[20], nsha1[20];
 		char *email_end, *message;
 		unsigned long timestamp;
-		int len, ret, tz;
+		int len, tz;
 
 		/* old SP new SP name <email> SP time TAB msg LF */
 		len = strlen(buf);
@@ -1135,9 +1180,9 @@
 		message += 7;
 		ret = fn(osha1, nsha1, buf+82, timestamp, tz, message, cb_data);
 		if (ret)
-			return ret;
+			break;
 	}
 	fclose(logfp);
-	return 0;
+	return ret;
 }
 
diff --git a/refs.h b/refs.h
index 0e877e8..33450f1 100644
--- a/refs.h
+++ b/refs.h
@@ -42,7 +42,7 @@
 extern int write_ref_sha1(struct ref_lock *lock, const unsigned char *sha1, const char *msg);
 
 /** Reads log for the value of ref during at_time. **/
-extern int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *sha1);
+extern int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *sha1, char **msg, unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt);
 
 /* iterate over reflog entries */
 typedef int each_reflog_ent_fn(unsigned char *osha1, unsigned char *nsha1, const char *, unsigned long, int, const char *, void *);
diff --git a/revision.c b/revision.c
index f2ddd95..5bcd155 100644
--- a/revision.c
+++ b/revision.c
@@ -7,6 +7,7 @@
 #include "refs.h"
 #include "revision.h"
 #include "grep.h"
+#include "reflog-walk.h"
 
 static char *path_name(struct name_path *path, const char *name)
 {
@@ -116,6 +117,9 @@
 void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)
 {
 	add_object_array(obj, name, &revs->pending);
+	if (revs->reflog_info && obj->type == OBJ_COMMIT)
+		add_reflog_for_walk(revs->reflog_info,
+				(struct commit *)obj, name);
 }
 
 static struct object *get_reference(struct rev_info *revs, const char *name, const unsigned char *sha1, unsigned int flags)
@@ -864,6 +868,11 @@
 				handle_reflog(revs, flags);
 				continue;
 			}
+			if (!strcmp(arg, "-g") ||
+					!strcmp(arg, "--walk-reflogs")) {
+				init_reflog_walk(&revs->reflog_info);
+				continue;
+			}
 			if (!strcmp(arg, "--not")) {
 				flags ^= UNINTERESTING;
 				continue;
@@ -1210,6 +1219,9 @@
 		revs->commits = entry->next;
 		free(entry);
 
+		if (revs->reflog_info)
+			fake_reflog_parent(revs->reflog_info, commit);
+
 		/*
 		 * If we haven't done the list limiting, we need to look at
 		 * the parents here. We also need to do the date-based limiting
diff --git a/revision.h b/revision.h
index 8f7907d..d93481f 100644
--- a/revision.h
+++ b/revision.h
@@ -89,6 +89,8 @@
 
 	topo_sort_set_fn_t topo_setter;
 	topo_sort_get_fn_t topo_getter;
+
+	struct reflog_walk_info *reflog_info;
 };
 
 #define REV_TREE_SAME		0
diff --git a/send-pack.c b/send-pack.c
index 6756264..33e69db 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -6,9 +6,9 @@
 #include "exec_cmd.h"
 
 static const char send_pack_usage[] =
-"git-send-pack [--all] [--exec=git-receive-pack] <remote> [<head>...]\n"
-"  --all and explicit <head> specification are mutually exclusive.";
-static const char *exec = "git-receive-pack";
+"git-send-pack [--all] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]\n"
+"  --all and explicit <ref> specification are mutually exclusive.";
+static const char *receivepack = "git-receive-pack";
 static int verbose;
 static int send_all;
 static int force_update;
@@ -25,6 +25,8 @@
 	if (pipe(pipe_fd) < 0)
 		return error("send-pack: pipe failed");
 	pid = fork();
+	if (pid < 0)
+		return error("send-pack: unable to fork git-pack-objects");
 	if (!pid) {
 		/*
 		 * The child becomes pack-objects --revs; we feed
@@ -377,8 +379,12 @@
 		char *arg = *argv;
 
 		if (*arg == '-') {
+			if (!strncmp(arg, "--receive-pack=", 15)) {
+				receivepack = arg + 15;
+				continue;
+			}
 			if (!strncmp(arg, "--exec=", 7)) {
-				exec = arg + 7;
+				receivepack = arg + 7;
 				continue;
 			}
 			if (!strcmp(arg, "--all")) {
@@ -413,7 +419,7 @@
 		usage(send_pack_usage);
 	verify_remote_names(nr_heads, heads);
 
-	pid = git_connect(fd, dest, exec);
+	pid = git_connect(fd, dest, receivepack);
 	if (pid < 0)
 		return 1;
 	ret = send_pack(fd[0], fd[1], nr_heads, heads);
diff --git a/server-info.c b/server-info.c
index 6cd38be..f9be5a7 100644
--- a/server-info.c
+++ b/server-info.c
@@ -10,6 +10,8 @@
 static int add_info_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
 {
 	struct object *o = parse_object(sha1);
+	if (!o)
+		return -1;
 
 	fprintf(info_ref_fp, "%s	%s\n", sha1_to_hex(sha1), path);
 	if (o->type == OBJ_TAG) {
diff --git a/setup.c b/setup.c
index cc97f9f..e9d3f5a 100644
--- a/setup.c
+++ b/setup.c
@@ -95,6 +95,8 @@
 	const char *name;
 	struct stat st;
 
+	if (is_inside_git_dir())
+		return;
 	if (*arg == '-')
 		return; /* flag */
 	name = prefix ? prefix_filename(prefix, strlen(prefix), arg) : arg;
@@ -168,6 +170,28 @@
 	return 1;
 }
 
+static int inside_git_dir = -1;
+
+int is_inside_git_dir(void)
+{
+	if (inside_git_dir < 0) {
+		char buffer[1024];
+
+		if (is_bare_repository())
+			return (inside_git_dir = 1);
+		if (getcwd(buffer, sizeof(buffer))) {
+			const char *git_dir = get_git_dir(), *cwd = buffer;
+			while (*git_dir && *git_dir == *cwd) {
+				git_dir++;
+				cwd++;
+			}
+			inside_git_dir = !*git_dir;
+		} else
+			inside_git_dir = 0;
+	}
+	return inside_git_dir;
+}
+
 const char *setup_git_directory_gently(int *nongit_ok)
 {
 	static char cwd[PATH_MAX+1];
@@ -206,6 +230,7 @@
 					if (chdir(cwd))
 						die("Cannot come back to cwd");
 					setenv(GIT_DIR_ENVIRONMENT, cwd, 1);
+					inside_git_dir = 1;
 					return NULL;
 				}
 				if (nongit_ok) {
@@ -226,6 +251,7 @@
 	offset++;
 	cwd[len++] = '/';
 	cwd[len] = 0;
+	inside_git_dir = !strncmp(cwd + offset, ".git/", 5);
 	return cwd + offset;
 }
 
diff --git a/sha1_file.c b/sha1_file.c
index 1b1c0f7..498665e 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -435,7 +435,7 @@
 				void **idx_map_)
 {
 	void *idx_map;
-	unsigned int *index;
+	uint32_t *index;
 	unsigned long idx_size;
 	int nr, i;
 	int fd = open(path, O_RDONLY);
@@ -456,12 +456,23 @@
 
 	/* check index map */
 	if (idx_size < 4*256 + 20 + 20)
-		return error("index file too small");
+		return error("index file %s is too small", path);
+
+	/* a future index format would start with this, as older git
+	 * binaries would fail the non-monotonic index check below.
+	 * give a nicer warning to the user if we can.
+	 */
+	if (index[0] == htonl(PACK_IDX_SIGNATURE))
+		return error("index file %s is a newer version"
+			" and is not supported by this binary"
+			" (try upgrading GIT to a newer version)",
+			path);
+
 	nr = 0;
 	for (i = 0; i < 256; i++) {
 		unsigned int n = ntohl(index[i]);
 		if (n < nr)
-			return error("non-monotonic index");
+			return error("non-monotonic index %s", path);
 		nr = n;
 	}
 
@@ -473,7 +484,7 @@
 	 *  - 20-byte SHA1 file checksum
 	 */
 	if (idx_size != 4*256 + nr * 24 + 20 + 20)
-		return error("wrong index file size");
+		return error("wrong index file size in %s", path);
 
 	return 0;
 }
@@ -1340,7 +1351,7 @@
 unsigned long find_pack_entry_one(const unsigned char *sha1,
 				  struct packed_git *p)
 {
-	unsigned int *level1_ofs = p->index_base;
+	uint32_t *level1_ofs = p->index_base;
 	int hi = ntohl(level1_ofs[*sha1]);
 	int lo = ((*sha1 == 0x0) ? 0 : ntohl(level1_ofs[*sha1 - 1]));
 	void *index = p->index_base + 256;
@@ -1349,7 +1360,7 @@
 		int mi = (lo + hi) / 2;
 		int cmp = hashcmp((unsigned char *)index + (24 * mi) + 4, sha1);
 		if (!cmp)
-			return ntohl(*((unsigned int *) ((char *) index + (24 * mi))));
+			return ntohl(*((uint32_t *)((char *)index + (24 * mi))));
 		if (cmp > 0)
 			hi = mi;
 		else
@@ -1458,21 +1469,20 @@
 {
 	struct pack_entry e;
 
-	if (!find_pack_entry(sha1, &e, NULL)) {
-		error("cannot read sha1_file for %s", sha1_to_hex(sha1));
+	if (!find_pack_entry(sha1, &e, NULL))
 		return NULL;
-	}
-	return unpack_entry(e.p, e.offset, type, size);
+	else
+		return unpack_entry(e.p, e.offset, type, size);
 }
 
 void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)
 {
 	unsigned long mapsize;
 	void *map, *buf;
-	struct pack_entry e;
 
-	if (find_pack_entry(sha1, &e, NULL))
-		return read_packed_sha1(sha1, type, size);
+	buf = read_packed_sha1(sha1, type, size);
+	if (buf)
+		return buf;
 	map = map_sha1_file(sha1, &mapsize);
 	if (map) {
 		buf = unpack_sha1_file(map, mapsize, type, size);
@@ -1480,9 +1490,7 @@
 		return buf;
 	}
 	reprepare_packed_git();
-	if (find_pack_entry(sha1, &e, NULL))
-		return read_packed_sha1(sha1, type, size);
-	return NULL;
+	return read_packed_sha1(sha1, type, size);
 }
 
 void *read_object_with_reference(const unsigned char *sha1,
@@ -1770,6 +1778,8 @@
 
 	/* need to unpack and recompress it by itself */
 	unpacked = read_packed_sha1(sha1, type, &len);
+	if (!unpacked)
+		error("cannot read sha1_file for %s", sha1_to_hex(sha1));
 
 	hdrlen = sprintf(hdr, "%s %lu", type, len) + 1;
 
@@ -2038,3 +2048,24 @@
 	}
 	return 0;
 }
+
+int read_pack_header(int fd, struct pack_header *header)
+{
+	char *c = (char*)header;
+	ssize_t remaining = sizeof(struct pack_header);
+	do {
+		ssize_t r = xread(fd, c, remaining);
+		if (r <= 0)
+			/* "eof before pack header was fully read" */
+			return PH_ERROR_EOF;
+		remaining -= r;
+		c += r;
+	} while (remaining > 0);
+	if (header->hdr_signature != htonl(PACK_SIGNATURE))
+		/* "protocol error (pack signature mismatch detected)" */
+		return PH_ERROR_PACK_SIGNATURE;
+	if (!pack_version_ok(header->hdr_version))
+		/* "protocol error (pack version unsupported)" */
+		return PH_ERROR_PROTOCOL;
+	return 0;
+}
diff --git a/sha1_name.c b/sha1_name.c
index 6d7cd78..9dfb3ac 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -235,7 +235,7 @@
 	return slash;
 }
 
-static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
+int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref)
 {
 	static const char *fmt[] = {
 		"%.*s",
@@ -246,13 +246,32 @@
 		"refs/remotes/%.*s/HEAD",
 		NULL
 	};
+	const char **p, *r;
+	int refs_found = 0;
+
+	*ref = NULL;
+	for (p = fmt; *p; p++) {
+		unsigned char sha1_from_ref[20];
+		unsigned char *this_result;
+
+		this_result = refs_found ? sha1_from_ref : sha1;
+		r = resolve_ref(mkpath(*p, len, str), this_result, 1, NULL);
+		if (r) {
+			if (!refs_found++)
+				*ref = xstrdup(r);
+			if (!warn_ambiguous_refs)
+				break;
+		}
+	}
+	return refs_found;
+}
+
+static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
+{
 	static const char *warning = "warning: refname '%.*s' is ambiguous.\n";
-	const char **p, *ref;
 	char *real_ref = NULL;
 	int refs_found = 0;
 	int at, reflog_len;
-	unsigned char *this_result;
-	unsigned char sha1_from_ref[20];
 
 	if (len == 40 && !get_sha1_hex(str, sha1))
 		return 0;
@@ -273,16 +292,7 @@
 	if (ambiguous_path(str, len))
 		return -1;
 
-	for (p = fmt; *p; p++) {
-		this_result = refs_found ? sha1_from_ref : sha1;
-		ref = resolve_ref(mkpath(*p, len, str), this_result, 1, NULL);
-		if (ref) {
-			if (!refs_found++)
-				real_ref = xstrdup(ref);
-			if (!warn_ambiguous_refs)
-				break;
-		}
-	}
+	refs_found = dwim_ref(str, len, sha1, &real_ref);
 
 	if (!refs_found)
 		return -1;
@@ -294,6 +304,9 @@
 		/* Is it asking for N-th entry, or approxidate? */
 		int nth, i;
 		unsigned long at_time;
+		unsigned long co_time;
+		int co_tz, co_cnt;
+
 		for (i = nth = 0; 0 <= nth && i < reflog_len; i++) {
 			char ch = str[at+2+i];
 			if ('0' <= ch && ch <= '9')
@@ -305,7 +318,18 @@
 			at_time = 0;
 		else
 			at_time = approxidate(str + at + 2);
-		read_ref_at(real_ref, at_time, nth, sha1);
+		if (read_ref_at(real_ref, at_time, nth, sha1, NULL,
+				&co_time, &co_tz, &co_cnt)) {
+			if (at_time)
+				fprintf(stderr,
+					"warning: Log for '%.*s' only goes "
+					"back to %s.\n", len, str,
+					show_rfc2822_date(co_time, co_tz));
+			else
+				fprintf(stderr,
+					"warning: Log for '%.*s' only has "
+					"%d entries.\n", len, str, co_cnt);
+		}
 	}
 
 	free(real_ref);
diff --git a/shallow.c b/shallow.c
index 3d53d17..d178689 100644
--- a/shallow.c
+++ b/shallow.c
@@ -17,7 +17,7 @@
 	return register_commit_graft(graft, 0);
 }
 
-int is_repository_shallow()
+int is_repository_shallow(void)
 {
 	FILE *fp;
 	char buf[1024];
diff --git a/ssh-fetch.c b/ssh-fetch.c
index 4c172b6..bdf51a7 100644
--- a/ssh-fetch.c
+++ b/ssh-fetch.c
@@ -124,7 +124,6 @@
 	prog = getenv("GIT_SSH_PUSH");
 	if (!prog) prog = "git-ssh-upload";
 
-	setup_ident();
 	setup_git_directory();
 	git_config(git_default_config);
 
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index 4409b87..c090c96 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -106,4 +106,33 @@
 	cmp ../one ../original.one
 '
 
+test_expect_success 'no file/rev ambuguity check inside .git' '
+	cd $HERE &&
+	git commit -a -m 1 &&
+	cd $HERE/.git &&
+	git show -s HEAD
+'
+
+test_expect_success 'no file/rev ambuguity check inside a bare repo' '
+	cd $HERE &&
+	git clone -s --bare .git foo.git &&
+	cd foo.git && GIT_DIR=. git show -s HEAD
+'
+
+# This still does not work as it should...
+: test_expect_success 'no file/rev ambuguity check inside a bare repo' '
+	cd $HERE &&
+	git clone -s --bare .git foo.git &&
+	cd foo.git && git show -s HEAD
+'
+
+test_expect_success 'detection should not be fooled by a symlink' '
+	cd $HERE &&
+	rm -fr foo.git &&
+	git clone -s .git another &&
+	ln -s another yetanother &&
+	cd yetanother/.git &&
+	git show -s HEAD
+'
+
 test_done
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 60acdd3..49b5666 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -3,13 +3,13 @@
 # Copyright (c) 2005 Johannes Schindelin
 #
 
-test_description='Test git-repo-config in different settings'
+test_description='Test git-config in different settings'
 
 . ./test-lib.sh
 
 test -f .git/config && rm .git/config
 
-git-repo-config core.penguin "little blue"
+git-config core.penguin "little blue"
 
 cat > expect << EOF
 [core]
@@ -18,7 +18,7 @@
 
 test_expect_success 'initial' 'cmp .git/config expect'
 
-git-repo-config Core.Movie BadPhysics
+git-config Core.Movie BadPhysics
 
 cat > expect << EOF
 [core]
@@ -28,7 +28,7 @@
 
 test_expect_success 'mixed case' 'cmp .git/config expect'
 
-git-repo-config Cores.WhatEver Second
+git-config Cores.WhatEver Second
 
 cat > expect << EOF
 [core]
@@ -40,7 +40,7 @@
 
 test_expect_success 'similar section' 'cmp .git/config expect'
 
-git-repo-config CORE.UPPERCASE true
+git-config CORE.UPPERCASE true
 
 cat > expect << EOF
 [core]
@@ -54,10 +54,10 @@
 test_expect_success 'similar section' 'cmp .git/config expect'
 
 test_expect_success 'replace with non-match' \
-	'git-repo-config core.penguin kingpin !blue'
+	'git-config core.penguin kingpin !blue'
 
 test_expect_success 'replace with non-match (actually matching)' \
-	'git-repo-config core.penguin "very blue" !kingpin'
+	'git-config core.penguin "very blue" !kingpin'
 
 cat > expect << EOF
 [core]
@@ -86,7 +86,7 @@
 cp .git/config .git/config2
 
 test_expect_success 'multiple unset' \
-	'git-repo-config --unset-all beta.haha'
+	'git-config --unset-all beta.haha'
 
 cat > expect << EOF
 [beta] ; silly comment # another comment
@@ -102,7 +102,7 @@
 mv .git/config2 .git/config
 
 test_expect_success '--replace-all' \
-	'git-repo-config --replace-all beta.haha gamma'
+	'git-config --replace-all beta.haha gamma'
 
 cat > expect << EOF
 [beta] ; silly comment # another comment
@@ -116,7 +116,7 @@
 
 test_expect_success 'all replaced' 'cmp .git/config expect'
 
-git-repo-config beta.haha alpha
+git-config beta.haha alpha
 
 cat > expect << EOF
 [beta] ; silly comment # another comment
@@ -130,7 +130,7 @@
 
 test_expect_success 'really mean test' 'cmp .git/config expect'
 
-git-repo-config nextsection.nonewline wow
+git-config nextsection.nonewline wow
 
 cat > expect << EOF
 [beta] ; silly comment # another comment
@@ -145,8 +145,8 @@
 
 test_expect_success 'really really mean test' 'cmp .git/config expect'
 
-test_expect_success 'get value' 'test alpha = $(git-repo-config beta.haha)'
-git-repo-config --unset beta.haha
+test_expect_success 'get value' 'test alpha = $(git-config beta.haha)'
+git-config --unset beta.haha
 
 cat > expect << EOF
 [beta] ; silly comment # another comment
@@ -160,7 +160,7 @@
 
 test_expect_success 'unset' 'cmp .git/config expect'
 
-git-repo-config nextsection.NoNewLine "wow2 for me" "for me$"
+git-config nextsection.NoNewLine "wow2 for me" "for me$"
 
 cat > expect << EOF
 [beta] ; silly comment # another comment
@@ -176,18 +176,18 @@
 test_expect_success 'multivar' 'cmp .git/config expect'
 
 test_expect_success 'non-match' \
-	'git-repo-config --get nextsection.nonewline !for'
+	'git-config --get nextsection.nonewline !for'
 
 test_expect_success 'non-match value' \
-	'test wow = $(git-repo-config --get nextsection.nonewline !for)'
+	'test wow = $(git-config --get nextsection.nonewline !for)'
 
 test_expect_failure 'ambiguous get' \
-	'git-repo-config --get nextsection.nonewline'
+	'git-config --get nextsection.nonewline'
 
 test_expect_success 'get multivar' \
-	'git-repo-config --get-all nextsection.nonewline'
+	'git-config --get-all nextsection.nonewline'
 
-git-repo-config nextsection.nonewline "wow3" "wow$"
+git-config nextsection.nonewline "wow3" "wow$"
 
 cat > expect << EOF
 [beta] ; silly comment # another comment
@@ -202,15 +202,15 @@
 
 test_expect_success 'multivar replace' 'cmp .git/config expect'
 
-test_expect_failure 'ambiguous value' 'git-repo-config nextsection.nonewline'
+test_expect_failure 'ambiguous value' 'git-config nextsection.nonewline'
 
 test_expect_failure 'ambiguous unset' \
-	'git-repo-config --unset nextsection.nonewline'
+	'git-config --unset nextsection.nonewline'
 
 test_expect_failure 'invalid unset' \
-	'git-repo-config --unset somesection.nonewline'
+	'git-config --unset somesection.nonewline'
 
-git-repo-config --unset nextsection.nonewline "wow3$"
+git-config --unset nextsection.nonewline "wow3$"
 
 cat > expect << EOF
 [beta] ; silly comment # another comment
@@ -224,12 +224,12 @@
 
 test_expect_success 'multivar unset' 'cmp .git/config expect'
 
-test_expect_failure 'invalid key' 'git-repo-config inval.2key blabla'
+test_expect_failure 'invalid key' 'git-config inval.2key blabla'
 
-test_expect_success 'correct key' 'git-repo-config 123456.a123 987'
+test_expect_success 'correct key' 'git-config 123456.a123 987'
 
 test_expect_success 'hierarchical section' \
-	'git-repo-config Version.1.2.3eX.Alpha beta'
+	'git-config Version.1.2.3eX.Alpha beta'
 
 cat > expect << EOF
 [beta] ; silly comment # another comment
@@ -255,7 +255,7 @@
 EOF
 
 test_expect_success 'working --list' \
-	'git-repo-config --list > output && cmp output expect'
+	'git-config --list > output && cmp output expect'
 
 cat > expect << EOF
 beta.noindent sillyValue
@@ -263,9 +263,9 @@
 EOF
 
 test_expect_success '--get-regexp' \
-	'git-repo-config --get-regexp in > output && cmp output expect'
+	'git-config --get-regexp in > output && cmp output expect'
 
-git-repo-config --add nextsection.nonewline "wow4 for you"
+git-config --add nextsection.nonewline "wow4 for you"
 
 cat > expect << EOF
 wow2 for me
@@ -273,7 +273,7 @@
 EOF
 
 test_expect_success '--add' \
-	'git-repo-config --get-all nextsection.nonewline > output && cmp output expect'
+	'git-config --get-all nextsection.nonewline > output && cmp output expect'
 
 cat > .git/config << EOF
 [novalue]
@@ -281,9 +281,9 @@
 EOF
 
 test_expect_success 'get variable with no value' \
-	'git-repo-config --get novalue.variable ^$'
+	'git-config --get novalue.variable ^$'
 
-git-repo-config > output 2>&1
+git-config > output 2>&1
 
 test_expect_success 'no arguments, but no crash' \
 	"test $? = 129 && grep usage output"
@@ -293,7 +293,7 @@
 	c = d
 EOF
 
-git-repo-config a.x y
+git-config a.x y
 
 cat > expect << EOF
 [a.b]
@@ -304,8 +304,8 @@
 
 test_expect_success 'new section is partial match of another' 'cmp .git/config expect'
 
-git-repo-config b.x y
-git-repo-config a.b c
+git-config b.x y
+git-config a.b c
 
 cat > expect << EOF
 [a.b]
@@ -328,11 +328,11 @@
 ein.bahn=strasse
 EOF
 
-GIT_CONFIG=other-config git-repo-config -l > output
+GIT_CONFIG=other-config git-config -l > output
 
 test_expect_success 'alternative GIT_CONFIG' 'cmp output expect'
 
-GIT_CONFIG=other-config git-repo-config anwohner.park ausweis
+GIT_CONFIG=other-config git-config anwohner.park ausweis
 
 cat > expect << EOF
 [ein]
@@ -355,7 +355,7 @@
 EOF
 
 test_expect_success "rename section" \
-	"git-repo-config --rename-section branch.eins branch.zwei"
+	"git-config --rename-section branch.eins branch.zwei"
 
 cat > expect << EOF
 # Hallo
@@ -371,12 +371,12 @@
 test_expect_success "rename succeeded" "diff -u expect .git/config"
 
 test_expect_failure "rename non-existing section" \
-	'git-repo-config --rename-section branch."world domination" branch.drei'
+	'git-config --rename-section branch."world domination" branch.drei'
 
 test_expect_success "rename succeeded" "diff -u expect .git/config"
 
 test_expect_success "rename another section" \
-	'git-repo-config --rename-section branch."1 234 blabl/a" branch.drei'
+	'git-config --rename-section branch."1 234 blabl/a" branch.drei'
 
 cat > expect << EOF
 # Hallo
@@ -393,20 +393,20 @@
 
 test_expect_success numbers '
 
-	git-repo-config kilo.gram 1k &&
-	git-repo-config mega.ton 1m &&
-	k=$(git-repo-config --int --get kilo.gram) &&
+	git-config kilo.gram 1k &&
+	git-config mega.ton 1m &&
+	k=$(git-config --int --get kilo.gram) &&
 	test z1024 = "z$k" &&
-	m=$(git-repo-config --int --get mega.ton) &&
+	m=$(git-config --int --get mega.ton) &&
 	test z1048576 = "z$m"
 '
 
 rm .git/config
 
-git-repo-config quote.leading " test"
-git-repo-config quote.ending "test "
-git-repo-config quote.semicolon "test;test"
-git-repo-config quote.hash "test#test"
+git-config quote.leading " test"
+git-config quote.ending "test "
+git-config quote.semicolon "test;test"
+git-config quote.hash "test#test"
 
 cat > expect << EOF
 [quote]
@@ -418,5 +418,31 @@
 
 test_expect_success 'quoting' 'cmp .git/config expect'
 
+test_expect_failure 'key with newline' 'git config key.with\\\
+newline 123'
+
+test_expect_success 'value with newline' 'git config key.sub value.with\\\
+newline'
+
+cat > .git/config <<\EOF
+[section]
+	; comment \
+	continued = cont\
+inued
+	noncont   = not continued ; \
+	quotecont = "cont;\
+inued"
+EOF
+
+cat > expect <<\EOF
+section.continued=continued
+section.noncont=not continued
+section.quotecont=cont;inued
+EOF
+
+git config --list > result
+
+test_expect_success 'value continued on next line' 'cmp result expect'
+
 test_done
 
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 5637cb5..d0aba2c 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -93,8 +93,8 @@
 
 test_expect_success \
 	'enable core.logAllRefUpdates' \
-	'git-repo-config core.logAllRefUpdates true &&
-	 test true = $(git-repo-config --bool --get core.logAllRefUpdates)'
+	'git-config core.logAllRefUpdates true &&
+	 test true = $(git-config --bool --get core.logAllRefUpdates)'
 
 test_expect_success \
 	"create $m (logged by config)" \
@@ -138,19 +138,19 @@
 	'rm -f o e
 	 git-rev-parse --verify "master@{May 25 2005}" >o 2>e &&
 	 test '"$C"' = $(cat o) &&
-	 test "warning: Log .git/logs/'"$m only goes back to $ed"'." = "$(cat e)"'
+	 test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"'
 test_expect_success \
 	"Query master@{2005-05-25} (before history)" \
 	'rm -f o e
 	 git-rev-parse --verify master@{2005-05-25} >o 2>e &&
 	 test '"$C"' = $(cat o) &&
-	 echo test "warning: Log .git/logs/'"$m only goes back to $ed"'." = "$(cat e)"'
+	 echo test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"'
 test_expect_success \
 	'Query "master@{May 26 2005 23:31:59}" (1 second before history)' \
 	'rm -f o e
 	 git-rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e &&
 	 test '"$C"' = $(cat o) &&
-	 test "warning: Log .git/logs/'"$m only goes back to $ed"'." = "$(cat e)"'
+	 test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"'
 test_expect_success \
 	'Query "master@{May 26 2005 23:32:00}" (exactly history start)' \
 	'rm -f o e
diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index 8e8d526..e5bbc38 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -20,7 +20,7 @@
 }
 
 check_fsck () {
-	output=$(git fsck-objects --full)
+	output=$(git fsck --full)
 	case "$1" in
 	'')
 		test -z "$output" ;;
@@ -71,7 +71,7 @@
 	check_fsck &&
 
 	chmod +x C &&
-	( test "`git repo-config --bool core.filemode`" != false ||
+	( test "`git config --bool core.filemode`" != false ||
 	  echo executable >>C ) &&
 	git add C &&
 	test_tick && git commit -m dragon &&
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index bb80e42..5565c27 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -94,7 +94,7 @@
          git-branch r &&
          git-branch -m q r/q'
 
-git-repo-config branch.s/s.dummy Hello
+git-config branch.s/s.dummy Hello
 
 test_expect_success \
     'git branch -m s/s s should work when s/t is deleted' \
@@ -107,8 +107,8 @@
         test -f .git/logs/refs/heads/s'
 
 test_expect_success 'config information was renamed, too' \
-	"test $(git-repo-config branch.s.dummy) = Hello &&
-	 ! git-repo-config branch.s/s/dummy"
+	"test $(git-config branch.s.dummy) = Hello &&
+	 ! git-config branch.s/s/dummy"
 
 test_expect_failure \
     'git-branch -m u v should fail when the reflog for u is a symlink' \
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index 16bdae4..f0c7e22 100755
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -96,4 +96,13 @@
      git-branch -d n/o/p &&
      git-branch n'
 
+test_expect_success 'pack, prune and repack' '
+	git-tag foo &&
+	git-pack-refs --all --prune &&
+	git-show-ref >all-of-them &&
+	git-pack-refs &&
+	git-show-ref >again &&
+	diff all-of-them again
+'
+
 test_done
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
new file mode 100755
index 0000000..552af1c
--- /dev/null
+++ b/t/t3501-revert-cherry-pick.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+test_description='test cherry-pick and revert with renames
+
+  --
+   + rename2: renames oops to opos
+  +  rename1: renames oops to spoo
+  +  added:   adds extra line to oops
+  ++ initial: has lines in oops
+
+'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+
+	for l in a b c d e f g h i j k l m n o
+	do
+		echo $l$l$l$l$l$l$l$l$l
+	done >oops &&
+
+	test_tick &&
+	git add oops &&
+	git commit -m initial &&
+	git tag initial &&
+
+	test_tick &&
+	echo "Add extra line at the end" >>oops &&
+	git commit -a -m added &&
+	git tag added &&
+
+	test_tick &&
+	git mv oops spoo &&
+	git commit -m rename1 &&
+	git tag rename1 &&
+
+	test_tick &&
+	git checkout -b side initial &&
+	git mv oops opos &&
+	git commit -m rename2 &&
+	git tag rename2
+'
+
+test_expect_success 'cherry-pick after renaming branch' '
+
+	git checkout rename2 &&
+	EDITOR=: VISUAL=: git cherry-pick added &&
+	test -f opos &&
+	grep "Add extra line at the end" opos
+
+'
+
+test_expect_success 'revert after renaming branch' '
+
+	git checkout rename1 &&
+	EDITOR=: VISUAL=: git revert added &&
+	test -f spoo &&
+	! grep "Add extra line at the end" spoo
+
+'
+
+test_done
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index e98786d..caaab26 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -21,7 +21,7 @@
 
 test_expect_success \
 	'git-add: Test that executable bit is not used if core.filemode=0' \
-	'git repo-config core.filemode 0 &&
+	'git config core.filemode 0 &&
 	 echo foo >xfoo1 &&
 	 chmod 755 xfoo1 &&
 	 git-add xfoo1 &&
@@ -32,7 +32,7 @@
 
 test_expect_success \
 	'git-update-index --add: Test that executable bit is not used...' \
-	'git repo-config core.filemode 0 &&
+	'git config core.filemode 0 &&
 	 echo foo >xfoo2 &&
 	 chmod 755 xfoo2 &&
 	 git-update-index --add xfoo2 &&
@@ -43,7 +43,7 @@
 
 test_expect_success \
 	'git-update-index --add: Test that executable bit is not used...' \
-	'git repo-config core.filemode 0 &&
+	'git config core.filemode 0 &&
 	 ln -s xfoo2 xfoo3 &&
 	 git-update-index --add xfoo3 &&
 	 case "`git-ls-files --stage xfoo3`" in
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index 5b23b77..ede4d42 100755
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
@@ -88,7 +88,7 @@
 #  5. type line eol check
 
 echo "object 779e9b33986b1c2670fff52c5067603117b3e895" >tag.sig
-echo -n "type tagsssssssssssssssssssssssssssssss" >>tag.sig
+printf "type tagsssssssssssssssssssssssssssssss" >>tag.sig
 
 cat >expect.pat <<EOF
 ^error: char48: .*"[\]n"$
diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh
index 6714b0d..e54fe0f 100755
--- a/t/t3900-i18n-commit.sh
+++ b/t/t3900-i18n-commit.sh
@@ -29,7 +29,7 @@
 for H in ISO-8859-1 EUCJP ISO-2022-JP
 do
 	test_expect_success "$H setup" '
-		git-repo-config i18n.commitencoding $H &&
+		git-config i18n.commitencoding $H &&
 		git-checkout -b $H C0 &&
 		echo $H >F &&
 		git-commit -a -F ../t3900/$H.txt
@@ -44,16 +44,16 @@
 	'
 done
 
-test_expect_success 'repo-config to remove customization' '
-	git-repo-config --unset-all i18n.commitencoding &&
-	if Z=$(git-repo-config --get-all i18n.commitencoding)
+test_expect_success 'config to remove customization' '
+	git-config --unset-all i18n.commitencoding &&
+	if Z=$(git-config --get-all i18n.commitencoding)
 	then
 		echo Oops, should have failed.
 		false
 	else
 		test z = "z$Z"
 	fi &&
-	git-repo-config i18n.commitencoding utf-8
+	git-config i18n.commitencoding utf-8
 '
 
 test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' '
@@ -67,9 +67,9 @@
 	'
 done
 
-test_expect_success 'repo-config to add customization' '
-	git-repo-config --unset-all i18n.commitencoding &&
-	if Z=$(git-repo-config --get-all i18n.commitencoding)
+test_expect_success 'config to add customization' '
+	git-config --unset-all i18n.commitencoding &&
+	if Z=$(git-config --get-all i18n.commitencoding)
 	then
 		echo Oops, should have failed.
 		false
@@ -81,13 +81,13 @@
 for H in ISO-8859-1 EUCJP ISO-2022-JP
 do
 	test_expect_success "$H should be shown in itself now" '
-		git-repo-config i18n.commitencoding '$H' &&
+		git-config i18n.commitencoding '$H' &&
 		compare_with '$H' ../t3900/'$H'.txt
 	'
 done
 
-test_expect_success 'repo-config to tweak customization' '
-	git-repo-config i18n.logoutputencoding utf-8
+test_expect_success 'config to tweak customization' '
+	git-config i18n.logoutputencoding utf-8
 '
 
 test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' '
@@ -103,7 +103,7 @@
 
 for J in EUCJP ISO-2022-JP
 do
-	git-repo-config i18n.logoutputencoding $J
+	git-config i18n.logoutputencoding $J
 	for H in EUCJP ISO-2022-JP
 	do
 		test_expect_success "$H should be shown in $J now" '
diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh
index eda0e2d..a881797 100755
--- a/t/t3901-i18n-patch.sh
+++ b/t/t3901-i18n-patch.sh
@@ -31,7 +31,7 @@
 }
 
 test_expect_success setup '
-	git-repo-config i18n.commitencoding UTF-8 &&
+	git-config i18n.commitencoding UTF-8 &&
 
 	# use UTF-8 in author and committer name to match the
 	# i18n.commitencoding settings
@@ -55,7 +55,7 @@
 	git commit -s -m "Second on side" &&
 
 	# the second one on the side branch is ISO-8859-1
-	git-repo-config i18n.commitencoding ISO-8859-1 &&
+	git-config i18n.commitencoding ISO-8859-1 &&
 	# use author and committer name in ISO-8859-1 to match it.
 	. ../t3901-8859-1.txt &&
 	test_tick &&
@@ -64,11 +64,11 @@
 	git commit -s -m "Third on side" &&
 
 	# Back to default
-	git-repo-config i18n.commitencoding UTF-8
+	git-config i18n.commitencoding UTF-8
 '
 
 test_expect_success 'format-patch output (ISO-8859-1)' '
-	git-repo-config i18n.logoutputencoding ISO-8859-1 &&
+	git-config i18n.logoutputencoding ISO-8859-1 &&
 
 	git format-patch --stdout master..HEAD^ >out-l1 &&
 	git format-patch --stdout HEAD^ >out-l2 &&
@@ -79,7 +79,7 @@
 '
 
 test_expect_success 'format-patch output (UTF-8)' '
-	git repo-config i18n.logoutputencoding UTF-8 &&
+	git config i18n.logoutputencoding UTF-8 &&
 
 	git format-patch --stdout master..HEAD^ >out-u1 &&
 	git format-patch --stdout HEAD^ >out-u2 &&
@@ -91,13 +91,13 @@
 
 test_expect_success 'rebase (U/U)' '
 	# We want the result of rebase in UTF-8
-	git-repo-config i18n.commitencoding UTF-8 &&
+	git-config i18n.commitencoding UTF-8 &&
 
 	# The test is about logoutputencoding not affecting the
 	# final outcome -- it is used internally to generate the
 	# patch and the log.
 
-	git repo-config i18n.logoutputencoding UTF-8 &&
+	git config i18n.logoutputencoding UTF-8 &&
 
 	# The result will be committed by GIT_COMMITTER_NAME --
 	# we want UTF-8 encoded name.
@@ -109,8 +109,8 @@
 '
 
 test_expect_success 'rebase (U/L)' '
-	git-repo-config i18n.commitencoding UTF-8 &&
-	git repo-config i18n.logoutputencoding ISO-8859-1 &&
+	git-config i18n.commitencoding UTF-8 &&
+	git config i18n.logoutputencoding ISO-8859-1 &&
 	. ../t3901-utf8.txt &&
 
 	git reset --hard side &&
@@ -121,8 +121,8 @@
 
 test_expect_success 'rebase (L/L)' '
 	# In this test we want ISO-8859-1 encoded commits as the result
-	git-repo-config i18n.commitencoding ISO-8859-1 &&
-	git repo-config i18n.logoutputencoding ISO-8859-1 &&
+	git-config i18n.commitencoding ISO-8859-1 &&
+	git config i18n.logoutputencoding ISO-8859-1 &&
 	. ../t3901-8859-1.txt &&
 
 	git reset --hard side &&
@@ -134,8 +134,8 @@
 test_expect_success 'rebase (L/U)' '
 	# This is pathological -- use UTF-8 as intermediate form
 	# to get ISO-8859-1 results.
-	git-repo-config i18n.commitencoding ISO-8859-1 &&
-	git repo-config i18n.logoutputencoding UTF-8 &&
+	git-config i18n.commitencoding ISO-8859-1 &&
+	git config i18n.logoutputencoding UTF-8 &&
 	. ../t3901-8859-1.txt &&
 
 	git reset --hard side &&
@@ -147,8 +147,8 @@
 test_expect_success 'cherry-pick(U/U)' '
 	# Both the commitencoding and logoutputencoding is set to UTF-8.
 
-	git-repo-config i18n.commitencoding UTF-8 &&
-	git repo-config i18n.logoutputencoding UTF-8 &&
+	git-config i18n.commitencoding UTF-8 &&
+	git config i18n.logoutputencoding UTF-8 &&
 	. ../t3901-utf8.txt &&
 
 	git reset --hard master &&
@@ -162,8 +162,8 @@
 test_expect_success 'cherry-pick(L/L)' '
 	# Both the commitencoding and logoutputencoding is set to ISO-8859-1
 
-	git-repo-config i18n.commitencoding ISO-8859-1 &&
-	git repo-config i18n.logoutputencoding ISO-8859-1 &&
+	git-config i18n.commitencoding ISO-8859-1 &&
+	git config i18n.logoutputencoding ISO-8859-1 &&
 	. ../t3901-8859-1.txt &&
 
 	git reset --hard master &&
@@ -177,8 +177,8 @@
 test_expect_success 'cherry-pick(U/L)' '
 	# Commitencoding is set to UTF-8 but logoutputencoding is ISO-8859-1
 
-	git-repo-config i18n.commitencoding UTF-8 &&
-	git repo-config i18n.logoutputencoding ISO-8859-1 &&
+	git-config i18n.commitencoding UTF-8 &&
+	git config i18n.logoutputencoding ISO-8859-1 &&
 	. ../t3901-utf8.txt &&
 
 	git reset --hard master &&
@@ -193,8 +193,8 @@
 	# Again, the commitencoding is set to ISO-8859-1 but
 	# logoutputencoding is set to UTF-8.
 
-	git-repo-config i18n.commitencoding ISO-8859-1 &&
-	git repo-config i18n.logoutputencoding UTF-8 &&
+	git-config i18n.commitencoding ISO-8859-1 &&
+	git config i18n.logoutputencoding UTF-8 &&
 	. ../t3901-8859-1.txt &&
 
 	git reset --hard master &&
@@ -206,8 +206,8 @@
 '
 
 test_expect_success 'rebase --merge (U/U)' '
-	git-repo-config i18n.commitencoding UTF-8 &&
-	git repo-config i18n.logoutputencoding UTF-8 &&
+	git-config i18n.commitencoding UTF-8 &&
+	git config i18n.logoutputencoding UTF-8 &&
 	. ../t3901-utf8.txt &&
 
 	git reset --hard side &&
@@ -217,8 +217,8 @@
 '
 
 test_expect_success 'rebase --merge (U/L)' '
-	git-repo-config i18n.commitencoding UTF-8 &&
-	git repo-config i18n.logoutputencoding ISO-8859-1 &&
+	git-config i18n.commitencoding UTF-8 &&
+	git config i18n.logoutputencoding ISO-8859-1 &&
 	. ../t3901-utf8.txt &&
 
 	git reset --hard side &&
@@ -229,8 +229,8 @@
 
 test_expect_success 'rebase --merge (L/L)' '
 	# In this test we want ISO-8859-1 encoded commits as the result
-	git-repo-config i18n.commitencoding ISO-8859-1 &&
-	git repo-config i18n.logoutputencoding ISO-8859-1 &&
+	git-config i18n.commitencoding ISO-8859-1 &&
+	git config i18n.logoutputencoding ISO-8859-1 &&
 	. ../t3901-8859-1.txt &&
 
 	git reset --hard side &&
@@ -242,8 +242,8 @@
 test_expect_success 'rebase --merge (L/U)' '
 	# This is pathological -- use UTF-8 as intermediate form
 	# to get ISO-8859-1 results.
-	git-repo-config i18n.commitencoding ISO-8859-1 &&
-	git repo-config i18n.logoutputencoding UTF-8 &&
+	git-config i18n.commitencoding ISO-8859-1 &&
+	git config i18n.logoutputencoding UTF-8 &&
 	. ../t3901-8859-1.txt &&
 
 	git reset --hard side &&
diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh
index 67b9681..9c58d77 100755
--- a/t/t4000-diff-format.sh
+++ b/t/t4000-diff-format.sh
@@ -28,7 +28,7 @@
     'git-diff-files -p >current'
 
 # that's as far as it comes
-if [ "$(git repo-config --get core.filemode)" = false ]
+if [ "$(git config --get core.filemode)" = false ]
 then
 	say 'filemode disabled on the filesystem'
 	test_done
diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh
index 8ad69d1..ca342f4 100755
--- a/t/t4006-diff-mode.sh
+++ b/t/t4006-diff-mode.sh
@@ -15,7 +15,7 @@
      tree=`git-write-tree` &&
      echo $tree'
 
-if [ "$(git repo-config --get core.filemode)" = false ]
+if [ "$(git config --get core.filemode)" = false ]
 then
 	say 'filemode disabled on the filesystem, using update-index --chmod=+x'
 	test_expect_success \
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index ed37141..3d85cea 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -73,7 +73,7 @@
 	for i in 1 2; do echo $i; done >>dir/sub &&
 	git update-index file0 dir/sub &&
 
-	git repo-config log.showroot false &&
+	git config log.showroot false &&
 	git commit --amend &&
 	git show-branch
 '
diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master b/t/t4013/diff.format-patch_--attach_--stdout_initial..master
index b4745e1..e5ddd6f 100644
--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..master
+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master
@@ -19,6 +19,7 @@
  file0   |    3 +++
  file2   |    3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
+ delete mode 100644 file2
 --------------g-i-t--v-e-r-s-i-o-n
 Content-Type: text/x-patch;
  name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
@@ -77,6 +78,7 @@
  dir/sub |    2 ++
  file1   |    3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
+ create mode 100644 file1
 --------------g-i-t--v-e-r-s-i-o-n
 Content-Type: text/x-patch;
  name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
@@ -126,6 +128,7 @@
  file0   |    3 +++
  file3   |    4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
+ create mode 100644 file3
 --------------g-i-t--v-e-r-s-i-o-n
 Content-Type: text/x-patch;
  name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master^ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^
index a9d1cd3..d0dd19b 100644
--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..master^
+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^
@@ -19,6 +19,7 @@
  file0   |    3 +++
  file2   |    3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
+ delete mode 100644 file2
 --------------g-i-t--v-e-r-s-i-o-n
 Content-Type: text/x-patch;
  name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
@@ -77,6 +78,7 @@
  dir/sub |    2 ++
  file1   |    3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
+ create mode 100644 file1
 --------------g-i-t--v-e-r-s-i-o-n
 Content-Type: text/x-patch;
  name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..side b/t/t4013/diff.format-patch_--attach_--stdout_initial..side
index 57b9d0b..67a95c5 100644
--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..side
+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..side
@@ -17,6 +17,7 @@
  file0   |    3 +++
  file3   |    4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
+ create mode 100644 file3
 --------------g-i-t--v-e-r-s-i-o-n
 Content-Type: text/x-patch;
  name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
diff --git a/t/t4013/diff.format-patch_--stdout_initial..master b/t/t4013/diff.format-patch_--stdout_initial..master
index c33302e..8b88ca4 100644
--- a/t/t4013/diff.format-patch_--stdout_initial..master
+++ b/t/t4013/diff.format-patch_--stdout_initial..master
@@ -10,6 +10,7 @@
  file0   |    3 +++
  file2   |    3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
+ delete mode 100644 file2
 
 diff --git a/dir/sub b/dir/sub
 index 35d242b..8422d40 100644
@@ -53,6 +54,7 @@
  dir/sub |    2 ++
  file1   |    3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
+ create mode 100644 file1
 
 diff --git a/dir/sub b/dir/sub
 index 8422d40..cead32e 100644
@@ -87,6 +89,7 @@
  file0   |    3 +++
  file3   |    4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
+ create mode 100644 file3
 
 diff --git a/dir/sub b/dir/sub
 index 35d242b..7289e35 100644
diff --git a/t/t4013/diff.format-patch_--stdout_initial..master^ b/t/t4013/diff.format-patch_--stdout_initial..master^
index 03d0f96..47a4b88 100644
--- a/t/t4013/diff.format-patch_--stdout_initial..master^
+++ b/t/t4013/diff.format-patch_--stdout_initial..master^
@@ -10,6 +10,7 @@
  file0   |    3 +++
  file2   |    3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
+ delete mode 100644 file2
 
 diff --git a/dir/sub b/dir/sub
 index 35d242b..8422d40 100644
@@ -53,6 +54,7 @@
  dir/sub |    2 ++
  file1   |    3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
+ create mode 100644 file1
 
 diff --git a/dir/sub b/dir/sub
 index 8422d40..cead32e 100644
diff --git a/t/t4013/diff.format-patch_--stdout_initial..side b/t/t4013/diff.format-patch_--stdout_initial..side
index d10a465..e765088 100644
--- a/t/t4013/diff.format-patch_--stdout_initial..side
+++ b/t/t4013/diff.format-patch_--stdout_initial..side
@@ -9,6 +9,7 @@
  file0   |    3 +++
  file3   |    4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
+ create mode 100644 file3
 
 diff --git a/dir/sub b/dir/sub
 index 35d242b..7289e35 100644
diff --git a/t/t4102-apply-rename.sh b/t/t4102-apply-rename.sh
index 22da6a0..b4662b0 100755
--- a/t/t4102-apply-rename.sh
+++ b/t/t4102-apply-rename.sh
@@ -31,7 +31,7 @@
 test_expect_success apply \
     'git-apply --index --stat --summary --apply test-patch'
 
-if [ "$(git repo-config --get core.filemode)" = false ]
+if [ "$(git config --get core.filemode)" = false ]
 then
 	say 'filemode disabled on the filesystem'
 else
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index 5ee5b23..91be272 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -120,29 +120,29 @@
 	just_over_15_days_ago=$(($now-1-15*86400))
 	almost_60_days_ago=$(($now+60-60*86400))
 	just_over_60_days_ago=$(($now-1-60*86400))
-	predate1="$(date -d "@$almost_60_days_ago" +%c)"
-	predate2="$(date -d "@$almost_15_days_ago" +%c)"
-	postdate1="$(date -d "@$just_over_60_days_ago" +%c)"
-	postdate2="$(date -d "@$just_over_15_days_ago" +%c)"
+	predate1="$(date -d "@$almost_60_days_ago" +%Y%m%d%H%M.%S)"
+	predate2="$(date -d "@$almost_15_days_ago" +%Y%m%d%H%M.%S)"
+	postdate1="$(date -d "@$just_over_60_days_ago" +%Y%m%d%H%M.%S)"
+	postdate2="$(date -d "@$just_over_15_days_ago" +%Y%m%d%H%M.%S)"
 	;;
 *)
 	# it is not GNU date. oh, well.
-	predate1="$(date)"
-	predate2="$(date)"
-	postdate1='1 Oct 2006 00:00:00'
-	postdate2='1 Dec 2006 00:00:00'
+	predate1="$(date +%Y%m%d%H%M.%S)"
+	predate2="$(date +%Y%m%d%H%M.%S)"
+	postdate1='200610010000.00'
+	postdate2='200612010000.00'
 esac
 
-touch -m -d "$predate1" $rr/preimage
-touch -m -d "$predate2" $rr2/preimage
+touch -m -t "$predate1" $rr/preimage
+touch -m -t "$predate2" $rr2/preimage
 
 test_expect_success 'garbage collection (part1)' 'git rerere gc'
 
 test_expect_success 'young records still live' \
 	"test -f $rr/preimage -a -f $rr2/preimage"
 
-touch -m -d "$postdate1" $rr/preimage
-touch -m -d "$postdate2" $rr2/preimage
+touch -m -t "$postdate1" $rr/preimage
+touch -m -t "$postdate2" $rr2/preimage
 
 test_expect_success 'garbage collection (part2)' 'git rerere gc'
 
diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh
index 5a7232a..a6dbb04 100755
--- a/t/t5301-sliding-window.sh
+++ b/t/t5301-sliding-window.sh
@@ -30,19 +30,19 @@
 
 test_expect_success \
     'verify-pack -v, packedGitWindowSize == 1 page' \
-    'git-repo-config core.packedGitWindowSize 512 &&
+    'git-config core.packedGitWindowSize 512 &&
      git-verify-pack -v "$pack1"'
 
 test_expect_success \
     'verify-pack -v, packedGit{WindowSize,Limit} == 1 page' \
-    'git-repo-config core.packedGitWindowSize 512 &&
-     git-repo-config core.packedGitLimit 512 &&
+    'git-config core.packedGitWindowSize 512 &&
+     git-config core.packedGitLimit 512 &&
      git-verify-pack -v "$pack1"'
 
 test_expect_success \
     'repack -a -d, packedGit{WindowSize,Limit} == 1 page' \
-    'git-repo-config core.packedGitWindowSize 512 &&
-     git-repo-config core.packedGitLimit 512 &&
+    'git-config core.packedGitWindowSize 512 &&
+     git-config core.packedGitLimit 512 &&
      commit2=`git-commit-tree $tree -p $commit1 </dev/null` &&
      git-update-ref HEAD $commit2 &&
      git-repack -a -d &&
@@ -53,8 +53,8 @@
 
 test_expect_success \
     'verify-pack -v, defaults' \
-    'git-repo-config --unset core.packedGitWindowSize &&
-     git-repo-config --unset core.packedGitLimit &&
+    'git-config --unset core.packedGitWindowSize &&
+     git-config --unset core.packedGitLimit &&
      git-verify-pack -v "$pack2"'
 
 test_done
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index 2c15191..7d93d0d 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -106,7 +106,7 @@
 test_expect_success \
         'pushing with --force should be denied with denyNonFastforwards' '
 	cd victim &&
-	git-repo-config receive.denyNonFastforwards true &&
+	git-config receive.denyNonFastforwards true &&
 	cd .. &&
 	git-update-ref refs/heads/master master^ &&
 	git-send-pack --force ./victim/.git/ master &&
diff --git a/t/t5401-update-hooks.sh b/t/t5401-update-hooks.sh
index cd8cee6..0514056 100755
--- a/t/t5401-update-hooks.sh
+++ b/t/t5401-update-hooks.sh
@@ -23,7 +23,7 @@
 cat >victim/.git/hooks/update <<'EOF'
 #!/bin/sh
 echo "$@" >$GIT_DIR/update.args
-read x; echo -n "$x" >$GIT_DIR/update.stdin
+read x; printf "$x" >$GIT_DIR/update.stdin
 echo STDOUT update
 echo STDERR update >&2
 EOF
@@ -32,7 +32,7 @@
 cat >victim/.git/hooks/post-update <<'EOF'
 #!/bin/sh
 echo "$@" >$GIT_DIR/post-update.args
-read x; echo -n "$x" >$GIT_DIR/post-update.stdin
+read x; printf "$x" >$GIT_DIR/post-update.stdin
 echo STDOUT post-update
 echo STDERR post-update >&2
 EOF
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index ef78df6..48e3d17 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -63,13 +63,13 @@
 	case "$heads" in *B*) echo $BTIP > .git/refs/heads/B;; esac
 	git-symbolic-ref HEAD refs/heads/`echo $heads | sed -e 's/^\(.\).*$/\1/'`
 
-	test_expect_success "fsck" 'git-fsck-objects --full > fsck.txt 2>&1'
+	test_expect_success "fsck" 'git-fsck --full > fsck.txt 2>&1'
 
 	test_expect_success 'check downloaded results' \
 	'mv .git/objects/pack/pack-* . &&
 	 p=`ls -1 pack-*.pack` &&
 	 git-unpack-objects <$p &&
-	 git-fsck-objects --full'
+	 git-fsck --full'
 
 	test_expect_success "new object count after $number pull" \
 	'idx=`echo pack-*.idx` &&
@@ -97,7 +97,8 @@
 (
 	mkdir client &&
 	cd client &&
-	git-init 2>> log2.txt
+	git-init 2>> log2.txt &&
+	git config transfer.unpacklimit 0
 )
 
 add A1
@@ -144,7 +145,7 @@
 '
 
 test_expect_success "fsck in shallow repo" \
-	"(cd shallow; git-fsck-objects --full)"
+	"(cd shallow; git-fsck --full)"
 
 #test_done; exit
 
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 3ce9446..50c6485 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -22,14 +22,14 @@
 	cd .. &&
 	git clone . two &&
 	cd two &&
-	git repo-config branch.master.remote one &&
-	git repo-config remote.one.url ../one/.git/ &&
-	git repo-config remote.one.fetch refs/heads/master:refs/heads/one &&
+	git config branch.master.remote one &&
+	git config remote.one.url ../one/.git/ &&
+	git config remote.one.fetch refs/heads/master:refs/heads/one &&
 	cd .. &&
 	git clone . three &&
 	cd three &&
-	git repo-config branch.master.remote two &&
-	git repo-config branch.master.merge refs/heads/one &&
+	git config branch.master.remote two &&
+	git config branch.master.merge refs/heads/one &&
 	mkdir -p .git/remotes &&
 	{
 		echo "URL: ../two/.git/"
diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh
index b9f6d96..2f8e97c 100755
--- a/t/t5710-info-alternate.sh
+++ b/t/t5710-info-alternate.sh
@@ -17,7 +17,7 @@
 }
 
 test_valid_repo() {
-	git fsck-objects --full > fsck.log &&
+	git fsck --full > fsck.log &&
 	test `wc -l < fsck.log` = 0
 }
 
diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
index 1c21d8c..f3cd3db 100644
--- a/t/t6023-merge-file.sh
+++ b/t/t6023-merge-file.sh
@@ -52,7 +52,7 @@
 animam meam convertit,
 deduxit me super semitas jusitiae,
 EOF
-echo -n "propter nomen suum." >> new4.txt
+printf "propter nomen suum." >> new4.txt
 
 cp new1.txt test.txt
 test_expect_success "merge without conflict" \
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
new file mode 100755
index 0000000..3e9edda
--- /dev/null
+++ b/t/t6120-describe.sh
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+test_description='test describe
+
+                       B
+        .--------------o----o----o----x
+       /                   /    /
+ o----o----o----o----o----.    /
+       \        A    c        /
+        .------------o---o---o
+                     D   e
+'
+. ./test-lib.sh
+
+check_describe () {
+	expect="$1"
+	shift
+	R=$(git describe "$@") &&
+	test_expect_success "describe $*" '
+	case "$R" in
+	$expect)	echo happy ;;
+	*)	echo "Oops - $R is not $expect";
+		false ;;
+	esac
+	'
+}
+
+test_expect_success setup '
+
+	test_tick &&
+	echo one >file && git-add file && git-commit -m initial &&
+	one=$(git-rev-parse HEAD) &&
+
+	test_tick &&
+	echo two >file && git-add file && git-commit -m second &&
+	two=$(git-rev-parse HEAD) &&
+
+	test_tick &&
+	echo three >file && git-add file && git-commit -m third &&
+
+	test_tick &&
+	echo A >file && git-add file && git-commit -m A &&
+	test_tick &&
+	git-tag -a -m A A &&
+
+	test_tick &&
+	echo c >file && git-add file && git-commit -m c &&
+	test_tick &&
+	git-tag c &&
+
+	git reset --hard $two &&
+	test_tick &&
+	echo B >side && git-add side && git-commit -m B &&
+	test_tick &&
+	git-tag -a -m B B &&
+
+	test_tick &&
+	git-merge -m Merged c &&
+	merged=$(git-rev-parse HEAD) &&
+
+	git reset --hard $two &&
+	test_tick &&
+	echo D >another && git-add another && git-commit -m D &&
+	test_tick &&
+	git-tag -a -m D D &&
+
+	test_tick &&
+	echo DD >another && git commit -a -m another &&
+
+	test_tick &&
+	git-tag e &&
+
+	test_tick &&
+	echo DDD >another && git commit -a -m "yet another" &&
+
+	test_tick &&
+	git-merge -m Merged $merged &&
+
+	test_tick &&
+	echo X >file && echo X >side && git-add file side &&
+	git-commit -m x
+
+'
+
+check_describe A-* HEAD
+check_describe A-* HEAD^
+check_describe D-* HEAD^^
+check_describe A-* HEAD^^2
+check_describe B HEAD^^2^
+
+check_describe A-* --tags HEAD
+check_describe A-* --tags HEAD^
+check_describe D-* --tags HEAD^^
+check_describe A-* --tags HEAD^^2
+check_describe B --tags HEAD^^2^
+
+test_done
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 63e49f3..ea14023 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -108,7 +108,7 @@
 
 test_expect_success 'merge-msg test #3' '
 
-	git repo-config merge.summary true &&
+	git config merge.summary true &&
 
 	git checkout master &&
 	setdate &&
@@ -138,7 +138,7 @@
 
 test_expect_success 'merge-msg test #4' '
 
-	git repo-config merge.summary true &&
+	git config merge.summary true &&
 
 	git checkout master &&
 	setdate &&
@@ -150,7 +150,7 @@
 
 test_expect_success 'merge-msg test #5' '
 
-	git repo-config merge.summary yes &&
+	git config merge.summary yes &&
 
 	git checkout master &&
 	setdate &&
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 085d4a0..867bbd2 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -14,15 +14,23 @@
 	done
 }
 
+
 test_expect_success setup '
 
-	fill 1 2 3 4 5 >one &&
+	fill 1 2 3 4 5 6 7 8 >one &&
 	fill a b c d e >two &&
 	git add one two &&
 	git commit -m "Initial A one, A two" &&
 
-	git checkout -b side &&
-	fill 1 2 3 >one &&
+	git checkout -b renamer &&
+	rm -f one &&
+	fill 1 3 4 5 6 7 8 >uno &&
+	git add uno &&
+	fill a b c d e f >two &&
+	git commit -a -m "Renamer R one->uno, M two" &&
+
+	git checkout -b side master &&
+	fill 1 2 3 4 5 6 7 >one &&
 	fill A B C D E >three &&
 	rm -f two &&
 	git update-index --add --remove one two three &&
@@ -42,7 +50,7 @@
 
 test_expect_success "checkout with dirty tree without -m" '
 
-	fill 0 1 2 3 4 5 >one &&
+	fill 0 1 2 3 4 5 6 7 8 >one &&
 	if git checkout side
 	then
 		echo Not happy
@@ -58,12 +66,10 @@
 	git checkout -f master &&
 	git clean &&
 
-	fill 0 1 2 3 4 5 >one &&
+	fill 0 1 2 3 4 5 6 7 8 >one &&
 	git checkout -m side &&
 
-	fill "  master" "* side" >expect.branch &&
-	git branch >current.branch &&
-	diff expect.branch current.branch &&
+	test "$(git symbolic-ref HEAD)" = "refs/heads/side" &&
 
 	fill "M	one" "A	three" "D	two" >expect.master &&
 	git diff --name-status master >current.master &&
@@ -78,4 +84,49 @@
 	diff expect.index current.index
 '
 
+test_expect_success "checkout -m with dirty tree, renamed" '
+
+	git checkout -f master && git clean &&
+
+	fill 1 2 3 4 5 7 8 >one &&
+	if git checkout renamer
+	then
+		echo Not happy
+		false
+	else
+		echo "happy - failed correctly"
+	fi &&
+
+	git checkout -m renamer &&
+	fill 1 3 4 5 7 8 >expect &&
+	diff expect uno &&
+	! test -f one &&
+	git diff --cached >current &&
+	! test -s current
+
+'
+
+test_expect_success 'checkout -m with merge conflict' '
+
+	git checkout -f master && git clean &&
+
+	fill 1 T 3 4 5 6 S 8 >one &&
+	if git checkout renamer
+	then
+		echo Not happy
+		false
+	else
+		echo "happy - failed correctly"
+	fi &&
+
+	git checkout -m renamer &&
+
+	git diff master:one :3:uno |
+	sed -e "1,/^@@/d" -e "/^ /d" -e "s/^-/d/" -e "s/^+/a/" >current &&
+	fill d2 aT d7 aS >expect &&
+	diff current expect &&
+	git diff --cached two >current &&
+	! test -s current
+'
+
 test_done
diff --git a/t/t9102-git-svn-deep-rmdir.sh b/t/t9102-git-svn-deep-rmdir.sh
index 572aaed..4e08083 100755
--- a/t/t9102-git-svn-deep-rmdir.sh
+++ b/t/t9102-git-svn-deep-rmdir.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
 test_description='git-svn rmdir'
 . ./lib-git-svn.sh
 
diff --git a/t/t9103-git-svn-graft-branches.sh b/t/t9103-git-svn-graft-branches.sh
index b5f7677..4e55778 100755
--- a/t/t9103-git-svn-graft-branches.sh
+++ b/t/t9103-git-svn-graft-branches.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
 test_description='git-svn graft-branches'
 . ./lib-git-svn.sh
 
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index 315119a..c443f32 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Robin Rosenberg
 #
@@ -169,19 +169,19 @@
       test "$(echo $(sort "G g/CVS/Entries"|cut -d/ -f2,3,5))" = "with spaces.png/1.2/-kb with spaces.txt/1.2/"
       )'
 
-# This test contains ISO-8859-1 characters
+# This test contains UTF-8 characters
 test_expect_success \
      'File with non-ascii file name' \
-     'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
-      echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
-      git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
-      cp ../test9200a.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
-      git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
-      git commit -a -m "Går det så går det" && \
+     'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
+      echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
+      git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
+      cp ../test9200a.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
+      git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
+      git commit -a -m "Går det så går det" && \
       id=$(git rev-list --max-count=1 HEAD) &&
       (cd "$CVSWORK" &&
       git-cvsexportcommit -v -c $id &&
-      test "$(echo $(sort Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/CVS/Entries|cut -d/ -f2,3,5))" = "gårdetsågårdet.png/1.1/-kb gårdetsågårdet.txt/1.1/"
+      test "$(echo $(sort Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/CVS/Entries|cut -d/ -f2,3,5))" = "gårdetsågårdet.png/1.1/-kb gårdetsågårdet.txt/1.1/"
       )'
 
 test_expect_success \
@@ -197,6 +197,10 @@
       ! git-cvsexportcommit -c $id
       )'
 
+case "$(git repo-config --bool core.filemode)" in
+false)
+	;;
+*)
 test_expect_success \
      'Retain execute bit' \
      'mkdir G &&
@@ -211,5 +215,7 @@
       test -x G/on &&
       ! test -x G/off
       )'
+	;;
+esac
 
 test_done
diff --git a/templates/hooks--update b/templates/hooks--update
index 9863a80..4bd9d96 100644
--- a/templates/hooks--update
+++ b/templates/hooks--update
@@ -1,89 +1,285 @@
 #!/bin/sh
 #
 # An example hook script to mail out commit update information.
-# It also blocks tags that aren't annotated.
+# It can also blocks tags that aren't annotated.
 # Called by git-receive-pack with arguments: refname sha1-old sha1-new
 #
-# To enable this hook:
-# (1) change the recipient e-mail address
-# (2) make this file executable by "chmod +x update".
+# To enable this hook, make this file executable by "chmod +x update".
 #
+# Config
+# ------
+# hooks.mailinglist
+#   This is the list that all pushes will go to; leave it blank to not send
+#   emails frequently.  The log email will list every log entry in full between
+#   the old ref value and the new ref value.
+# hooks.announcelist
+#   This is the list that all pushes of annotated tags will go to.  Leave it
+#   blank to just use the mailinglist field.  The announce emails list the
+#   short log summary of the changes since the last annotated tag
+# hooks.allowunannotated
+#   This boolean sets whether unannotated tags will be allowed into the
+#   repository.  By default they won't be.
+#
+# Notes
+# -----
+# All emails have their subjects prefixed with "[SCM]" to aid filtering.
+# All emails include the headers "X-Git-Refname", "X-Git-Oldrev",
+# "X-Git-Newrev", and "X-Git-Reftype" to enable fine tuned filtering and info.
 
-project=$(cat $GIT_DIR/description)
-recipients="commit-list@somewhere.com commit-list@somewhereelse.com"
+# --- Constants
+EMAILPREFIX="[SCM] "
+LOGBEGIN="- Log -----------------------------------------------------------------"
+LOGEND="-----------------------------------------------------------------------"
+DATEFORMAT="%F %R %z"
 
-ref_type=$(git cat-file -t "$3")
+# --- Command line
+refname="$1"
+oldrev="$2"
+newrev="$3"
 
-# Only allow annotated tags in a shared repo
-# Remove this code to treat dumb tags the same as everything else
-case "$1","$ref_type" in
-refs/tags/*,commit)
-	echo "*** Un-annotated tags are not allowed in this repo" >&2
-	echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
-	exit 1;;
-refs/tags/*,tag)
-	echo "### Pushing version '${1##refs/tags/}' to the masses" >&2
-	# recipients="release-announce@somwehere.com announce@somewhereelse.com"
-	;;
-esac
+# --- Safety check
+if [ -z "$GIT_DIR" ]; then
+	echo "Don't run this script from the command line." >&2
+	echo " (if you want, you could supply GIT_DIR then run" >&2
+	echo "  $0 <ref> <oldrev> <newrev>)" >&2
+	exit 1
+fi
 
-# set this  to 'cat' to get a very detailed listing.
-# short only kicks in when an annotated tag is added
-short='git shortlog'
+if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
+	echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
+	exit 1
+fi
 
-# see 'date --help' for info on how to write this
-# The default is a human-readable iso8601-like format with minute
-# precision ('2006-01-25 15:58 +0100' for example)
-date_format="%F %R %z"
+# --- Config
+projectdesc=$(cat $GIT_DIR/description)
+recipients=$(git-repo-config hooks.mailinglist)
+announcerecipients=$(git-repo-config hooks.announcelist)
+allowunannotated=$(git-repo-config --bool hooks.allowunannotated)
 
-(if expr "$2" : '0*$' >/dev/null
-then
-	# new ref
-	case "$1" in
-	refs/tags/*)
-		# a pushed and annotated tag (usually) means a new version
-		tag="${1##refs/tags/}"
-		if [ "$ref_type" = tag ]; then
-			eval $(git cat-file tag $3 | \
-				sed -n '4s/tagger \([^>]*>\)[^0-9]*\([0-9]*\).*/tagger="\1" ts="\2"/p')
-			date=$(date --date="1970-01-01 00:00:00 $ts seconds" +"$date_format")
-			echo "Tag '$tag' created by $tagger at $date"
-			git cat-file tag $3 | sed -n '5,$p'
-			echo
-		fi
-		prev=$(git describe "$3^" | sed 's/-g.*//')
-		# the first tag in a repo will yield no $prev
-		if [ -z "$prev" ]; then
-			echo "Changes since the dawn of time:"
-			git rev-list --pretty $3 | $short
-		else
-			echo "Changes since $prev:"
-			git rev-list --pretty $prev..$3 | $short
-			echo ---
-			git diff --stat $prev..$3
-			echo ---
+# --- Check types
+newrev_type=$(git-cat-file -t "$newrev")
+
+case "$refname","$newrev_type" in
+	refs/tags/*,commit)
+		# un-annoted tag
+		refname_type="tag"
+		short_refname=${refname##refs/tags/}
+		if [ $allowunannotated != "true" ]; then
+			echo "*** The un-annotated tag, $short_refname is not allowed in this repository" >&2
+			echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
+			exit 1
 		fi
 		;;
-
-	refs/heads/*)
-		branch="${1##refs/heads/}"
-		echo "New branch '$branch' available with the following commits:"
-		git-rev-list --pretty "$3" $(git-rev-parse --not --all)
+	refs/tags/*,tag)
+		# annotated tag
+		refname_type="annotated tag"
+		short_refname=${refname##refs/tags/}
+		# change recipients
+		if [ -n "$announcerecipients" ]; then
+			recipients="$announcerecipients"
+		fi
 		;;
-	esac
-else
-	base=$(git-merge-base "$2" "$3")
-	case "$base" in
-	"$2")
-		git diff --stat "$3" "^$base"
-		echo
-		echo "New commits:"
+	refs/heads/*,commit)
+		# branch
+		refname_type="branch"
+		short_refname=${refname##refs/heads/}
+		;;
+	refs/remotes/*,commit)
+		# tracking branch
+		refname_type="tracking branch"
+		short_refname=${refname##refs/remotes/}
+		# Should this even be allowed?
+		echo "*** Push-update of tracking branch, $refname.  No email generated." >&2
+		exit 0
 		;;
 	*)
-		echo "Rebased ref, commits from common ancestor:"
+		# Anything else (is there anything else?)
+		echo "*** Update hook: unknown type of update, \"$newrev_type\", to ref $refname" >&2
+		exit 1
 		;;
-	esac
-	git-rev-list --pretty "$3" "^$base"
-fi) |
-mail -s "$project: Changes to '${1##refs/heads/}'" $recipients
+esac
+
+# Check if we've got anyone to send to
+if [ -z "$recipients" ]; then
+	# If the email isn't sent, then at least give the user some idea of what command
+	# would generate the email at a later date
+	echo "*** No recipients found - no email will be sent, but the push will continue" >&2
+	echo "*** for $0 $1 $2 $3" >&2
+	exit 0
+fi
+
+# --- Email parameters
+committer=$(git show --pretty=full -s $newrev | grep "^Commit: " | sed -e "s/^Commit: //")
+describe=$(git describe $newrev 2>/dev/null)
+if [ -z "$describe" ]; then
+	describe=$newrev
+fi
+
+# --- Email (all stdout will be the email)
+(
+# Generate header
+cat <<-EOF
+From: $committer
+To: $recipients
+Subject: ${EMAILPREFIX}$projectdesc $refname_type, $short_refname now at $describe
+X-Git-Refname: $refname
+X-Git-Reftype: $refname_type
+X-Git-Oldrev: $oldrev
+X-Git-Newrev: $newrev
+
+Hello,
+
+This is an automated email from the git hooks/update script, it was
+generated because a ref change was pushed to the repository.
+
+Updating $refname_type, $short_refname,
+EOF
+
+case "$refname_type" in
+	"tracking branch"|branch)
+		if expr "$oldrev" : '0*$' >/dev/null
+		then
+			# If the old reference is "0000..0000" then this is a new branch
+			# and so oldrev is not valid
+			echo "  as a new  $refname_type"
+		    echo "        to  $newrev ($newrev_type)"
+			echo ""
+			echo $LOGBEGIN
+			# This shows all log entries that are not already covered by
+			# another ref - i.e. commits that are now accessible from this
+			# ref that were previously not accessible
+			git-rev-list --pretty $newref $(git-rev-parse --not --all)
+			echo $LOGEND
+		else
+			# oldrev is valid
+			oldrev_type=$(git-cat-file -t "$oldrev")
+
+			# Now the problem is for cases like this:
+			#   * --- * --- * --- * (oldrev)
+			#          \
+			#           * --- * --- * (newrev)
+			# i.e. there is no guarantee that newrev is a strict subset
+			# of oldrev - (would have required a force, but that's allowed).
+			# So, we can't simply say rev-list $oldrev..$newrev.  Instead
+			# we find the common base of the two revs and list from there
+			baserev=$(git-merge-base $oldrev $newrev)
+
+			# Commit with a parent
+			for rev in $(git-rev-list $newrev ^$baserev)
+			do
+				revtype=$(git-cat-file -t "$rev")
+				echo "       via  $rev ($revtype)"
+			done
+			if [ "$baserev" = "$oldrev" ]; then
+				echo "      from  $oldrev ($oldrev_type)"
+			else
+				echo "  based on  $baserev"
+				echo "      from  $oldrev ($oldrev_type)"
+				echo ""
+				echo "This ref update crossed a branch point; i.e. the old rev is not a strict subset"
+				echo "of the new rev.  This occurs, when you --force push a change in a situation"
+				echo "like this:"
+				echo ""
+				echo " * -- * -- B -- O -- O -- O ($oldrev)"
+				echo "            \\"
+				echo "             N -- N -- N ($newrev)"
+				echo ""
+				echo "Therefore, we assume that you've already had alert emails for all of the O"
+				echo "revisions, and now give you all the revisions in the N branch from the common"
+				echo "base, B ($baserev), up to the new revision."
+			fi
+			echo ""
+			echo $LOGBEGIN
+			git-rev-list --pretty $newrev ^$baserev
+			echo $LOGEND
+			echo ""
+			echo "Diffstat:"
+			git-diff-tree --no-color --stat -M -C --find-copies-harder $newrev ^$baserev
+		fi
+		;;
+	"annotated tag")
+		# Should we allow changes to annotated tags?
+		if expr "$oldrev" : '0*$' >/dev/null
+		then
+			# If the old reference is "0000..0000" then this is a new atag
+			# and so oldrev is not valid
+			echo "        to  $newrev ($newrev_type)"
+		else
+			echo "        to  $newrev ($newrev_type)"
+			echo "      from  $oldrev"
+		fi
+
+		# If this tag succeeds another, then show which tag it replaces
+		prevtag=$(git describe $newrev^ 2>/dev/null | sed 's/-g.*//')
+		if [ -n "$prevtag" ]; then
+			echo "  replaces  $prevtag"
+		fi
+
+		# Read the tag details
+		eval $(git cat-file tag $newrev | \
+			sed -n '4s/tagger \([^>]*>\)[^0-9]*\([0-9]*\).*/tagger="\1" ts="\2"/p')
+		tagged=$(date --date="1970-01-01 00:00:00 +0000 $ts seconds" +"$DATEFORMAT")
+
+		echo " tagged by  $tagger"
+		echo "        on  $tagged"
+
+		echo ""
+		echo $LOGBEGIN
+		echo ""
+
+		if [ -n "$prevtag" ]; then
+			git rev-list --pretty=short "$prevtag..$newrev" | git shortlog
+		else
+			git rev-list --pretty=short $newrev | git shortlog
+		fi
+
+		echo $LOGEND
+		echo ""
+		;;
+	*)
+		# By default, unannotated tags aren't allowed in; if
+		# they are though, it's debatable whether we would even want an
+		# email to be generated; however, I don't want to add another config
+		# option just for that.
+		#
+		# Unannotated tags are more about marking a point than releasing
+		# a version; therefore we don't do the shortlog summary that we
+		# do for annotated tags above - we simply show that the point has
+		# been marked, and print the log message for the marked point for
+		# reference purposes
+		#
+		# Note this section also catches any other reference type (although
+		# there aren't any) and deals with them in the same way.
+		if expr "$oldrev" : '0*$' >/dev/null
+		then
+			# If the old reference is "0000..0000" then this is a new tag
+			# and so oldrev is not valid
+			echo "  as a new  $refname_type"
+			echo "        to  $newrev ($newrev_type)"
+		else
+			echo "        to  $newrev ($newrev_type)"
+			echo "      from  $oldrev"
+		fi
+		echo ""
+		echo $LOGBEGIN
+		git-show --no-color --root -s $newrev
+		echo $LOGEND
+		echo ""
+		;;
+esac
+
+# Footer
+cat <<-EOF
+
+hooks/update
+---
+Git Source Code Management System
+$0 $1 \\
+  $2 \\
+  $3
+EOF
+#) | cat >&2
+) | /usr/sbin/sendmail -t
+
+# --- Finished
 exit 0
diff --git a/upload-pack.c b/upload-pack.c
index 3a466c6..3648aae 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -672,7 +672,8 @@
 
 	if (!enter_repo(dir, strict))
 		die("'%s': unable to chdir or not a git archive", dir);
-
+	if (is_repository_shallow())
+		die("attempt to fetch/clone from a shallow repository");
 	upload_pack();
 	return 0;
 }
diff --git a/var.c b/var.c
index 39977b9..e585e59 100644
--- a/var.c
+++ b/var.c
@@ -56,7 +56,6 @@
 	}
 
 	setup_git_directory();
-	setup_ident();
 	val = NULL;
 
 	if (strcmp(argv[1], "-l") == 0) {
diff --git a/write_or_die.c b/write_or_die.c
index 046e79d..5c4bc85 100644
--- a/write_or_die.c
+++ b/write_or_die.c
@@ -23,7 +23,7 @@
 	ssize_t total = 0;
 
 	while (count > 0) {
-		size_t written = xwrite(fd, p, count);
+		ssize_t written = xwrite(fd, p, count);
 		if (written < 0)
 			return -1;
 		if (!written) {
diff --git a/wt-status.c b/wt-status.c
index b7250e4..5567868 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -351,7 +351,7 @@
 		wt_status_use_color = git_config_colorbool(k, v);
 		return 0;
 	}
-	if (!strncmp(k, "status.color.", 13) || !strncmp(k, "color.status", 13)) {
+	if (!strncmp(k, "status.color.", 13) || !strncmp(k, "color.status.", 13)) {
 		int slot = parse_status_slot(k, 13);
 		color_parse(v, k, wt_status_colors[slot]);
 	}