Merge branch 'ff/svnimport'
authorJunio C Hamano <junkio@cox.net>
Sun, 4 Jun 2006 06:58:26 +0000 (23:58 -0700)
committerJunio C Hamano <junkio@cox.net>
Sun, 4 Jun 2006 06:58:26 +0000 (23:58 -0700)
* ff/svnimport:
  git-svnimport: Improved detection of merges.

45 files changed:
Documentation/config.txt
Documentation/core-tutorial.txt
Documentation/cvs-migration.txt
Documentation/git-apply.txt
Documentation/git-blame.txt
Documentation/git-commit.txt
Documentation/git-cvsserver.txt
Documentation/git-daemon.txt
Documentation/git-diff-index.txt
Documentation/git-diff-tree.txt
Documentation/git-diff.txt
Documentation/git-format-patch.txt
Documentation/git-fsck-objects.txt
Documentation/git-grep.txt
Documentation/git-merge-index.txt
Documentation/git-patch-id.txt
Documentation/git-read-tree.txt
Documentation/git-repo-config.txt
Documentation/git-reset.txt
Documentation/git-rev-parse.txt
Documentation/git-send-email.txt
Documentation/git-send-pack.txt
Documentation/git-sh-setup.txt
Documentation/git-tools.txt
Documentation/git-update-index.txt
Documentation/hooks.txt
Documentation/technical/pack-heuristics.txt
Documentation/tutorial-2.txt
Documentation/tutorial.txt
Makefile
builtin-log.c
builtin-read-tree.c
builtin-rev-parse.c [new file with mode: 0644]
builtin.h
git-commit.sh
git-fetch.sh
git-send-email.perl
git.c
gitk
http-fetch.c
http.c
log-tree.c
rev-parse.c [deleted file]
revision.h
sha1_file.c

index d1a4bec..cd56afd 100644 (file)
@@ -2,7 +2,7 @@ CONFIGURATION FILE
 ------------------
 
 The git configuration file contains a number of variables that affect
-the git commands behaviour. They can be used by both the git plumbing
+the git commands behavior. They can be used by both the git plumbing
 and the porcelains. The variables are divided to 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
@@ -53,7 +53,7 @@ core.gitProxy::
        may be set multiple times and is matched in the given order;
        the first match wins.
 
-       Can be overriden by the 'GIT_PROXY_COMMAND' environment variable
+       Can be overridden by the 'GIT_PROXY_COMMAND' environment variable
        (which always applies universally, without the special "for"
        handling).
 
@@ -115,12 +115,12 @@ http.sslCert::
 
 http.sslKey::
        File containing the SSL private key when fetching or pushing
-       over HTTPS. Can be overriden by the 'GIT_SSL_KEY' environment
+       over HTTPS. Can be overridden by the 'GIT_SSL_KEY' environment
        variable.
 
 http.sslCAInfo::
        File containing the certificates to verify the peer with when
-       fetching or pushing over HTTPS. Can be overriden by the
+       fetching or pushing over HTTPS. Can be overridden by the
        'GIT_SSL_CAINFO' environment variable.
 
 http.sslCAPath::
@@ -129,13 +129,13 @@ http.sslCAPath::
        by the 'GIT_SSL_CAPATH' environment variable.
 
 http.maxRequests::
-       How many HTTP requests to launch in parallel. Can be overriden
+       How many HTTP requests to launch in parallel. Can be overridden
        by the 'GIT_HTTP_MAX_REQUESTS' environment variable. Default is 5.
 
 http.lowSpeedLimit, http.lowSpeedTime::
        If the HTTP transfer speed is less than 'http.lowSpeedLimit'
        for longer than 'http.lowSpeedTime' seconds, the transfer is aborted.
-       Can be overriden by the 'GIT_HTTP_LOW_SPEED_LIMIT' and
+       Can be overridden by the 'GIT_HTTP_LOW_SPEED_LIMIT' and
        'GIT_HTTP_LOW_SPEED_TIME' environment variables.
 
 i18n.commitEncoding::
@@ -166,12 +166,12 @@ showbranch.default::
 
 user.email::
        Your email address to be recorded in any newly created commits.
-       Can be overriden by the 'GIT_AUTHOR_EMAIL' and 'GIT_COMMITTER_EMAIL'
+       Can be overridden by the 'GIT_AUTHOR_EMAIL' and 'GIT_COMMITTER_EMAIL'
        environment variables.  See gitlink:git-commit-tree[1].
 
 user.name::
        Your full name to be recorded in any newly created commits.
-       Can be overriden by the 'GIT_AUTHOR_NAME' and 'GIT_COMMITTER_NAME'
+       Can be overridden by the 'GIT_AUTHOR_NAME' and 'GIT_COMMITTER_NAME'
        environment variables.  See gitlink:git-commit-tree[1].
 
 whatchanged.difftree::
index 5a831ad..1185897 100644 (file)
@@ -184,7 +184,7 @@ $ git-cat-file -t 557db03de997c86a4a028e1ebd3a1ceb225be238
 ----------------
 
 where the `-t` tells `git-cat-file` to tell you what the "type" of the
-object is. git will tell you that you have a "blob" object (ie just a
+object is. git will tell you that you have a "blob" object (i.e., just a
 regular file), and you can see the contents with
 
 ----------------
@@ -619,7 +619,7 @@ $ git tag -s <tagname>
 ----------------
 
 which will sign the current `HEAD` (but you can also give it another
-argument that specifies the thing to tag, ie you could have tagged the
+argument that specifies the thing to tag, i.e., you could have tagged the
 current `mybranch` point by using `git tag <tagname> mybranch`).
 
 You normally only do signed tags for major releases or things
@@ -1097,7 +1097,7 @@ commit object by downloading from `repo.git/objects/xx/xxx\...`
 using the object name of that commit object.  Then it reads the
 commit object to find out its parent commits and the associate
 tree object; it repeats this process until it gets all the
-necessary objects.  Because of this behaviour, they are
+necessary objects.  Because of this behavior, they are
 sometimes also called 'commit walkers'.
 +
 The 'commit walkers' are sometimes also called 'dumb
index fa94efd..826d089 100644 (file)
@@ -1,7 +1,7 @@
 git for CVS users
 =================
 
-So you're a CVS user. That's ok, it's a treatable condition.  The job of
+So you're a CVS user. That's OK, it's a treatable condition.  The job of
 this document is to put you on the road to recovery, by helping you
 convert an existing cvs repository to git, and by showing you how to use a
 git repository in a cvs-like fashion.
@@ -159,7 +159,7 @@ other than `master`.
 
 [NOTE]
 ============
-Because of this behaviour, if the shared repository and the developer's
+Because of this behavior, if the shared repository and the developer's
 repository both have branches named `origin`, then a push like the above
 attempts to update the `origin` branch in the shared repository from the
 developer's `origin` branch.  The results may be unexpected, so it's
index e93ea1f..9cc7c74 100644 (file)
@@ -113,7 +113,7 @@ OPTIONS
        When `git-apply` is used for statistics and not applying a
        patch, it defaults to `nowarn`.
        You can use different `<option>` to control this
-       behaviour:
+       behavior:
 +
 * `nowarn` turns off the trailing whitespace warning.
 * `warn` outputs warnings for a few such errors, but applies the
index 5189878..0a1fa00 100644 (file)
@@ -16,7 +16,7 @@ which introduced the line. Start annotation from the given revision.
 
 OPTIONS
 -------
--c, --compability::
+-c, --compatibility::
        Use the same output mode as git-annotate (Default: off).
 
 -l, --long::
index 38df59c..0fe66f2 100644 (file)
@@ -98,7 +98,7 @@ but can be used to amend a merge commit.
        Instead of committing only the files specified on the
        command line, update them in the index file and then
        commit the whole index.  This is the traditional
-       behaviour.
+       behavior.
 
 -o|--only::
        Commit only the files specified on the command line.
index 4dc13c3..952635d 100644 (file)
@@ -94,7 +94,7 @@ To get a checkout with the Eclipse CVS client:
 4. Pick 'HEAD' when it asks what branch/tag to check out. Untick the
    "launch commit wizard" to avoid committing the .project file.
 
-Protocol notes: If you are using anonymous acces via pserver, just select that.
+Protocol notes: If you are using anonymous access via pserver, just select that.
 Those using SSH access should choose the 'ext' protocol, and configure 'ext'
 access on the Preferences->Team->CVS->ExtConnection pane. Set CVS_SERVER to
 'git-cvsserver'. Not that password support is not good when using 'ext',
index 924a676..4c357da 100644 (file)
@@ -20,7 +20,7 @@ aka 9418. It waits for a connection, and will just execute "git-upload-pack"
 when it gets one.
 
 It's careful in that there's a magic request-line that gives the command and
-what directory to upload, and it verifies that the directory is ok.
+what directory to upload, and it verifies that the directory is OK.
 
 It verifies that the directory has the magic file "git-daemon-export-ok", and
 it will refuse to export any git directory that hasn't explicitly been marked
@@ -28,7 +28,7 @@ for export this way (unless the '--export-all' parameter is specified). If you
 pass some directory paths as 'git-daemon' arguments, you can further restrict
 the offers to a whitelist comprising of those.
 
-This is ideally suited for read-only updates, ie pulling from git repositories.
+This is ideally suited for read-only updates, i.e., pulling from git repositories.
 
 OPTIONS
 -------
index 5d2096a..9cd43f1 100644 (file)
@@ -101,7 +101,7 @@ have not actually done a "git-update-index" on it yet - there is no
   torvalds@ppc970:~/v2.6/linux> git-diff-index HEAD
   *100644->100664 blob    7476bb......->000000......      kernel/sched.c
 
-ie it shows that the tree has changed, and that `kernel/sched.c` has is
+i.e., it shows that the tree has changed, and that `kernel/sched.c` has is
 not up-to-date and may contain new stuff. The all-zero sha1 means that to
 get the real diff, you need to look at the object in the working directory
 directly rather than do an object-to-object diff.
index 906830d..f7e8ff2 100644 (file)
@@ -32,7 +32,7 @@ include::diff-options.txt[]
 <path>...::
        If provided, the results are limited to a subset of files
        matching one of these prefix strings.
-       ie file matches `/^<pattern1>|<pattern2>|.../`
+       i.e., file matches `/^<pattern1>|<pattern2>|.../`
        Note that this parameter does not provide any wildcard or regexp
        features.
 
@@ -54,7 +54,7 @@ include::diff-options.txt[]
 +
 When a single commit is given on one line of such input, it compares
 the commit with its parents.  The following flags further affects its
-behaviour.  This does not apply to the case where two <tree-ish>
+behavior.  This does not apply to the case where two <tree-ish>
 separated with a single space are given.
 
 -m::
index 7267bcd..7ab2080 100644 (file)
@@ -85,7 +85,7 @@ $ git diff arch/i386 include/asm-i386   <3>
 nor deletion.
 <2> show only names and the nature of change, but not actual
 diff output.  --name-status disables usual patch generation
-which in turn also disables recursive behaviour, so without -r
+which in turn also disables recursive behavior, so without -r
 you would only see the directory name if there is a change in a
 file in a subdirectory.
 <3> limit diff output to named subtrees.
index 7cc7faf..493cac2 100644 (file)
@@ -9,37 +9,46 @@ git-format-patch - Prepare patches for e-mail submission
 SYNOPSIS
 --------
 [verse]
-'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--attach] [-s] [-c]
-                [--diff-options] <his> [<mine>]
+'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--attach]
+                  [-s | --signoff] [--diff-options] [--start-number <n>]
+                  <since>[..<until>]
 
 DESCRIPTION
 -----------
-Prepare each commit with its patch since <mine> head forked from
-<his> head, one file per patch formatted to resemble UNIX mailbox
-format, for e-mail submission or use with gitlink:git-am[1].
+
+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.
+
+The output of this command is convenient for e-mail submission or
+for use with gitlink:git-am[1].
 
 Each output file is numbered sequentially from 1, and uses the
-first line of the commit message (massaged for pathname safety)
-as the filename.
+first line of the commit message (massaged for pathname safety) as
+the filename. The names of the output files are printed to standard
+output, unless the --stdout option is specified.
 
-When -o is specified, output files are created in <dir>; otherwise
-they are created in the current working directory.  This option
-is ignored if --stdout is specified.
+If -o is specified, output files are created in <dir>.  Otherwise
+they are created in the current working directory.
 
-When -n is specified, instead of "[PATCH] Subject", the first
-line is formatted as "[PATCH N/M] Subject", unless you have only
-one patch.
+If -n is specified, instead of "[PATCH] Subject", the first line
+is formatted as "[PATCH n/m] Subject".
 
 
 OPTIONS
 -------
 -o|--output-directory <dir>::
        Use <dir> to store the resulting files, instead of the
-       current working directory.
+       current working directory. This option is ignored if
+       --stdout is specified.
 
 -n|--numbered::
        Name output in '[PATCH n/m]' format.
 
+--start-number <n>::
+       Start numbering the patches at <n> instead of 1.
+
 -k|--keep-subject::
        Do not strip/add '[PATCH]' from the first line of the
        commit log message.
@@ -48,17 +57,9 @@ OPTIONS
        Add `Signed-off-by:` line to the commit message, using
        the committer identity of yourself.
 
--c|--check::
-        Display suspicious lines in the patch.  The definition
-        of 'suspicious lines' is currently the lines that has
-        trailing whitespaces, and the lines whose indentation
-        has a SP character immediately followed by a TAB
-        character.
-
 --stdout::
-       This flag generates the mbox formatted output to the
-       standard output, instead of saving them into a file per
-       patch and implies --mbox.
+       Print all commits to the standard output in mbox format,
+       instead of creating a file for each one.
 
 --attach::
        Create attachments instead of inlining patches.
@@ -82,18 +83,18 @@ git-format-patch -k --stdout R1..R2 | git-am -3 -k::
        cherry-pick them.
 
 git-format-patch origin::
-       Extract commits the current branch accumulated since it
-       pulled from origin the last time in a patch form for
-       e-mail submission.
+       Extract all commits which are in the current branch but
+       not in the origin branch.  For each commit a separate file
+       is created in the current directory.
 
 git-format-patch -M -B origin::
-       The same as the previous one, except detect and handle
-       renames and complete rewrites intelligently to produce
-       renaming patch.  A renaming patch reduces the amount of
-       text output, and generally makes it easier to review
-       it.  Note that the "patch" program does not understand
-       renaming patch well, so use it only when you know the
-       recipient uses git to apply your patch.
+       The same as the previous one.  Additionally, it detects
+       and handles renames and complete rewrites intelligently to
+       produce a renaming patch.  A renaming patch reduces the
+       amount of text output, and generally makes it easier to
+       review it.  Note that the "patch" program does not
+       understand renaming patches, so use it only when you know
+       the recipient uses git to apply your patch.
 
 
 See Also
index 93ce9dc..d0af99d 100644 (file)
@@ -71,7 +71,7 @@ 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
-(ie you can just remove them and do an "rsync" with some other site in
+(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
index 74102b7..7b810df 100644 (file)
@@ -30,7 +30,7 @@ OPTIONS
 -------
 --cached::
        Instead of searching in the working tree files, check
-       the blobs registerd in the index file.
+       the blobs registered in the index file.
 
 -a | --text::
        Process binary files as if they were text.
@@ -65,7 +65,7 @@ OPTIONS
 -[ABC] <context>::
        Show `context` trailing (`A` -- after), or leading (`B`
        -- before), or both (`C` -- context) lines, and place a
-       line containing `--` between continguous groups of
+       line containing `--` between contiguous groups of
        matches.
 
 -f <file>::
index 332e023..6cd0601 100644 (file)
@@ -69,7 +69,7 @@ or
   fatal: merge program failed
 
 where the latter example shows how "git-merge-index" will stop trying to
-merge once anything has returned an error (ie "cat" returned an error
+merge once anything has returned an error (i.e., "cat" returned an error
 for the AA file, because it didn't exist in the original, and thus
 "git-merge-index" didn't even try to merge the MM thing).
 
index 723b8cc..5389097 100644 (file)
@@ -13,7 +13,7 @@ DESCRIPTION
 -----------
 A "patch ID" is nothing but a SHA1 of the diff associated with a patch, with
 whitespace and line numbers ignored.  As such, it's "reasonably stable", but at
-the same time also reasonably unique, ie two patches that have the same "patch
+the same time also reasonably unique, i.e., two patches that have the same "patch
 ID" are almost guaranteed to be the same thing.
 
 IOW, you can use this thing to look for likely duplicate commits.
index 844cfda..02c7e99 100644 (file)
@@ -205,7 +205,7 @@ The `git-write-tree` command refuses to write a nonsensical tree, and it
 will complain about unmerged entries if it sees a single entry that is not
 stage 0.
 
-Ok, this all sounds like a collection of totally nonsensical rules,
+OK, this all sounds like a collection of totally nonsensical rules,
 but it's actually exactly what you want in order to do a fast
 merge. The different stages represent the "result tree" (stage 0, aka
 "merged"), the original tree (stage 1, aka "orig"), and the two trees
@@ -226,7 +226,7 @@ populated.  Here is an outline of how the algorithm works:
 
 - the index file saves and restores with all this information, so you
   can merge things incrementally, but as long as it has entries in
-  stages 1/2/3 (ie "unmerged entries") you can't write the result. So
+  stages 1/2/3 (i.e., "unmerged entries") you can't write the result. So
   now the merge algorithm ends up being really simple:
 
   * you walk the index in order, and ignore all entries of stage 0,
index 660c18f..d5142e0 100644 (file)
@@ -49,7 +49,7 @@ OPTIONS
 -------
 
 --replace-all::
-       Default behaviour is to replace at most one line. This replaces
+       Default behavior is to replace at most one line. This replaces
        all lines matching the key (and optionally the value_regex).
 
 --get::
index b27399d..73a0ffc 100644 (file)
@@ -24,7 +24,7 @@ gitlink:git-revert[1] is your friend.
 OPTIONS
 -------
 --mixed::
-       Resets the index but not the working tree (ie, the changed files
+       Resets the index but not the working tree (i.e., the changed files
        are preserved but not marked for commit) and reports what has not
        been updated. This is the default action.
 
index ab896fc..c4b0ff5 100644 (file)
@@ -13,7 +13,7 @@ SYNOPSIS
 DESCRIPTION
 -----------
 
-Many git Porcelainish commands take mixture of flags
+Many git porcelainish commands take mixture of flags
 (i.e. parameters that begin with a dash '-') and parameters
 meant for underlying `git-rev-list` command they use internally
 and flags and parameters for other commands they use as the
@@ -91,7 +91,7 @@ OPTIONS
 
 --short, --short=number::
        Instead of outputting the full SHA1 values of object names try to
-       abbriviate them to a shorter unique name. When no length is specified
+       abbreviate them to a shorter unique name. When no length is specified
        7 is used. The minimum length is 4.
 
 --since=datestring, --after=datestring::
index 8c58685..ad1b9cf 100644 (file)
@@ -52,7 +52,7 @@ The options available are:
        is not set, this will be prompted for.
 
 --no-signed-off-by-cc::
-       Do not add emails foudn in Signed-off-by: lines to the cc list.
+       Do not add emails found in Signed-off-by: lines to the cc list.
 
 --quiet::
        Make git-send-email less verbose.  One line per email should be
index 08e0705..9e67f17 100644 (file)
@@ -53,7 +53,7 @@ Specifying the Refs
 There are three ways to specify which refs to update on the
 remote end.
 
-With '--all' flag, all refs that exist locally are transfered to
+With '--all' flag, all refs that exist locally are transferred to
 the remote side.  You cannot specify any '<ref>' if you use
 this flag.
 
index 6742c9b..79217d8 100644 (file)
@@ -13,7 +13,7 @@ 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.
+(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:
 
index 00e57a6..d79523f 100644 (file)
@@ -12,7 +12,7 @@ This document presents a brief summary of each tool and the corresponding
 link.
 
 
-Alternative/Augmentative Procelains
+Alternative/Augmentative Porcelains
 -----------------------------------
 
    - *Cogito* (http://www.kernel.org/pub/software/scm/cogito/)
index d043e86..3ae6e74 100644 (file)
@@ -40,7 +40,7 @@ OPTIONS
 --remove::
        If a specified file is in the index but is missing then it's
        removed.
-       Default behaviour is to ignore removed file.
+       Default behavior is to ignore removed file.
 
 --refresh::
        Looks at the current index and checks to see if merges or
index 3824a95..e3dde39 100644 (file)
@@ -100,7 +100,7 @@ update
 This hook is invoked by `git-receive-pack` on the remote repository,
 which is happens when a `git push` is done on a local repository.
 Just before updating the ref on the remote repository, the update hook
-is invoked.  It's exit status determins the success or failure of
+is invoked.  It's exit status determines the success or failure of
 the ref update.
 
 The hook executes once for each ref to be updated, and takes
@@ -151,7 +151,7 @@ so it is a poor place to do log old..new.
 
 The default post-update hook, when enabled, runs
 `git-update-server-info` to keep the information used by dumb
-transports (eg, http) up-to-date.  If you are publishing
+transports (e.g., http) up-to-date.  If you are publishing
 a git repository that is accessible via http, you should
 probably enable this hook.
 
index eaab3ee..9aadd5c 100644 (file)
@@ -288,7 +288,7 @@ And of course there is the "Other Shoe" Factor too.
         - we actively try to generate deltas from a larger object to a
           smaller one
         - this means that the top-of-tree very seldom has deltas
-          (ie deltas in _practice_ are "backwards deltas")
+          (i.e. deltas in _practice_ are "backwards deltas")
 
 Again, we should reread that whole paragraph.  Not just because
 Linus has slipped Linus's Law in there on us, but because it is
index 9c9500c..82c6922 100644 (file)
@@ -49,7 +49,7 @@ tree
 
 A tree can refer to one or more "blob" objects, each corresponding to
 a file.  In addition, a tree can also refer to other tree objects,
-thus creating a directory heirarchy.  You can examine the contents of
+thus creating a directory hierarchy.  You can examine the contents of
 any tree using ls-tree (remember that a long enough initial portion
 of the SHA1 will also work):
 
index 039a859..db56312 100644 (file)
@@ -194,7 +194,7 @@ $ git clone /home/alice/project myrepo
 
 This creates a new directory "myrepo" containing a clone of Alice's
 repository.  The clone is on an equal footing with the original
-project, posessing its own copy of the original project's history.
+project, possessing its own copy of the original project's history.
 
 Bob then makes some changes and commits them:
 
@@ -240,7 +240,7 @@ $ git log -p master..bob-incoming
 shows a list of all the changes that Bob made since he branched from
 Alice's master branch.
 
-After examing those changes, and possibly fixing things, Alice can
+After examining those changes, and possibly fixing things, Alice can
 pull the changes into her master branch:
 
 -------------------------------------
@@ -374,7 +374,7 @@ project, so
 $ git grep "hello" v2.5
 -------------------------------------
 
-searches for all occurences of "hello" in v2.5.
+searches for all occurrences of "hello" in v2.5.
 
 If you leave out the commit name, git grep will search any of the
 files it manages in your current directory.  So
@@ -482,6 +482,6 @@ digressions that may be interesting at this point are:
     smart enough to perform a close-to-optimal search even in the
     case of complex non-linear history with lots of merged branches.
 
-  * link:everyday.html[Everday GIT with 20 Commands Or So]
+  * link:everyday.html[Everyday GIT with 20 Commands Or So]
 
   * link:cvs-migration.html[git for CVS users].
index b6fce39..004c216 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -154,8 +154,7 @@ PROGRAMS = \
        git-hash-object$X git-index-pack$X git-local-fetch$X \
        git-mailinfo$X git-merge-base$X \
        git-merge-index$X git-mktag$X git-mktree$X git-pack-objects$X git-patch-id$X \
-       git-peek-remote$X git-prune-packed$X \
-       git-receive-pack$X git-rev-parse$X \
+       git-peek-remote$X git-prune-packed$X git-receive-pack$X \
        git-send-pack$X git-shell$X \
        git-show-index$X git-ssh-fetch$X \
        git-ssh-upload$X git-unpack-file$X \
@@ -168,7 +167,7 @@ PROGRAMS = \
 BUILT_INS = git-log$X git-whatchanged$X git-show$X \
        git-count-objects$X git-diff$X git-push$X \
        git-grep$X git-add$X git-rm$X git-rev-list$X \
-       git-check-ref-format$X \
+       git-check-ref-format$X git-rev-parse$X \
        git-init-db$X git-tar-tree$X git-upload-tar$X git-format-patch$X \
        git-ls-files$X git-ls-tree$X \
        git-read-tree$X git-commit-tree$X \
@@ -222,7 +221,7 @@ LIB_OBJS = \
 BUILTIN_OBJS = \
        builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \
        builtin-grep.o builtin-add.o builtin-rev-list.o builtin-check-ref-format.o \
-       builtin-rm.o builtin-init-db.o \
+       builtin-rm.o builtin-init-db.o builtin-rev-parse.o \
        builtin-tar-tree.o builtin-upload-tar.o \
        builtin-ls-files.o builtin-ls-tree.o \
        builtin-read-tree.o builtin-commit-tree.o \
index db1912a..6612f4c 100644 (file)
@@ -85,6 +85,23 @@ static int istitlechar(char c)
                (c >= '0' && c <= '9') || c == '.' || c == '_';
 }
 
+static char *extra_headers = NULL;
+static int extra_headers_size = 0;
+
+static int git_format_config(const char *var, const char *value)
+{
+       if (!strcmp(var, "format.headers")) {
+               int len = strlen(value);
+               extra_headers_size += len + 1;
+               extra_headers = realloc(extra_headers, extra_headers_size);
+               extra_headers[extra_headers_size - len - 1] = 0;
+               strcat(extra_headers, value);
+               return 0;
+       }
+       return git_default_config(var, value);
+}
+
+
 static FILE *realstdout = NULL;
 static char *output_directory = NULL;
 
@@ -150,6 +167,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
        int numbered = 0;
        int start_number = -1;
        int keep_subject = 0;
+       char *add_signoff = NULL;
 
        init_revisions(&rev);
        rev.commit_format = CMIT_FMT_EMAIL;
@@ -161,6 +179,9 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
        rev.ignore_merges = 1;
        rev.diffopt.output_format = DIFF_FORMAT_PATCH;
 
+       git_config(git_format_config);
+       rev.extra_headers = extra_headers;
+
        /*
         * Parse the arguments before setup_revisions(), or something
         * like "git fmt-patch -o a123 HEAD^.." may fail; a123 is
@@ -179,11 +200,13 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
                        if (i == argc)
                                die("Need a number for --start-number");
                        start_number = strtol(argv[i], NULL, 10);
-               } else if (!strcmp(argv[i], "-k") ||
+               }
+               else if (!strcmp(argv[i], "-k") ||
                                !strcmp(argv[i], "--keep-subject")) {
                        keep_subject = 1;
                        rev.total = -1;
-               } else if (!strcmp(argv[i], "-o")) {
+               }
+               else if (!strcmp(argv[i], "-o")) {
                        if (argc < 3)
                                die ("Which directory?");
                        if (mkdir(argv[i + 1], 0777) < 0 && errno != EEXIST)
@@ -192,6 +215,16 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
                        output_directory = strdup(argv[i + 1]);
                        i++;
                }
+               else if (!strcmp(argv[i], "--signoff") ||
+                        !strcmp(argv[i], "-s")) {
+                       const char *committer = git_committer_info(1);
+                       const char *endpos = strchr(committer, '>');
+                       if (!endpos)
+                               die("bogos committer info %s\n", committer);
+                       add_signoff = xmalloc(endpos - committer + 2);
+                       memcpy(add_signoff, committer, endpos - committer + 1);
+                       add_signoff[endpos - committer + 1] = 0;
+               }
                else if (!strcmp(argv[i], "--attach"))
                        rev.mime_boundary = git_version_string;
                else if (!strncmp(argv[i], "--attach=", 9))
@@ -230,6 +263,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
        total = nr;
        if (numbered)
                rev.total = total + start_number - 1;
+       rev.add_signoff = add_signoff;
        while (0 <= --nr) {
                int shown;
                commit = list[nr];
index 716f792..21361df 100644 (file)
@@ -751,25 +751,26 @@ static int oneway_merge(struct cache_entry **src)
 
 static int read_cache_unmerged(void)
 {
-       int i, deleted;
+       int i;
        struct cache_entry **dst;
+       struct cache_entry *last = NULL;
 
        read_cache();
        dst = active_cache;
-       deleted = 0;
        for (i = 0; i < active_nr; i++) {
                struct cache_entry *ce = active_cache[i];
                if (ce_stage(ce)) {
-                       deleted++;
+                       if (last && !strcmp(ce->name, last->name))
+                               continue;
                        invalidate_ce_path(ce);
-                       continue;
+                       last = ce;
+                       ce->ce_mode = 0;
+                       ce->ce_flags &= ~htons(CE_STAGEMASK);
                }
-               if (deleted)
-                       *dst = ce;
-               dst++;
+               *dst++ = ce;
        }
-       active_nr -= deleted;
-       return deleted;
+       active_nr = dst - active_cache;
+       return !!last;
 }
 
 static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree)
@@ -850,7 +851,10 @@ int cmd_read_tree(int argc, const char **argv, char **envp)
                        continue;
                }
 
-               /* This differs from "-m" in that we'll silently ignore unmerged entries */
+               /* This differs from "-m" in that we'll silently ignore
+                * unmerged entries and overwrite working tree files that
+                * correspond to them.
+                */
                if (!strcmp(arg, "--reset")) {
                        if (stage || merge)
                                usage(read_tree_usage);
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
new file mode 100644 (file)
index 0000000..c353a48
--- /dev/null
@@ -0,0 +1,365 @@
+/*
+ * rev-parse.c
+ *
+ * Copyright (C) Linus Torvalds, 2005
+ */
+#include "cache.h"
+#include "commit.h"
+#include "refs.h"
+#include "quote.h"
+#include "builtin.h"
+
+#define DO_REVS                1
+#define DO_NOREV       2
+#define DO_FLAGS       4
+#define DO_NONFLAGS    8
+static int filter = ~0;
+
+static char *def = NULL;
+
+#define NORMAL 0
+#define REVERSED 1
+static int show_type = NORMAL;
+static int symbolic = 0;
+static int abbrev = 0;
+static int output_sq = 0;
+
+static int revs_count = 0;
+
+/*
+ * Some arguments are relevant "revision" arguments,
+ * others are about output format or other details.
+ * This sorts it all out.
+ */
+static int is_rev_argument(const char *arg)
+{
+       static const char *rev_args[] = {
+               "--all",
+               "--bisect",
+               "--dense",
+               "--branches",
+               "--header",
+               "--max-age=",
+               "--max-count=",
+               "--min-age=",
+               "--no-merges",
+               "--objects",
+               "--objects-edge",
+               "--parents",
+               "--pretty",
+               "--remotes",
+               "--sparse",
+               "--tags",
+               "--topo-order",
+               "--date-order",
+               "--unpacked",
+               NULL
+       };
+       const char **p = rev_args;
+
+       /* accept -<digit>, like traditional "head" */
+       if ((*arg == '-') && isdigit(arg[1]))
+               return 1;
+
+       for (;;) {
+               const char *str = *p++;
+               int len;
+               if (!str)
+                       return 0;
+               len = strlen(str);
+               if (!strcmp(arg, str) ||
+                   (str[len-1] == '=' && !strncmp(arg, str, len)))
+                       return 1;
+       }
+}
+
+/* Output argument as a string, either SQ or normal */
+static void show(const char *arg)
+{
+       if (output_sq) {
+               int sq = '\'', ch;
+
+               putchar(sq);
+               while ((ch = *arg++)) {
+                       if (ch == sq)
+                               fputs("'\\'", stdout);
+                       putchar(ch);
+               }
+               putchar(sq);
+               putchar(' ');
+       }
+       else
+               puts(arg);
+}
+
+/* Output a revision, only if filter allows it */
+static void show_rev(int type, const unsigned char *sha1, const char *name)
+{
+       if (!(filter & DO_REVS))
+               return;
+       def = NULL;
+       revs_count++;
+
+       if (type != show_type)
+               putchar('^');
+       if (symbolic && name)
+               show(name);
+       else if (abbrev)
+               show(find_unique_abbrev(sha1, abbrev));
+       else
+               show(sha1_to_hex(sha1));
+}
+
+/* Output a flag, only if filter allows it. */
+static int show_flag(char *arg)
+{
+       if (!(filter & DO_FLAGS))
+               return 0;
+       if (filter & (is_rev_argument(arg) ? DO_REVS : DO_NOREV)) {
+               show(arg);
+               return 1;
+       }
+       return 0;
+}
+
+static void show_default(void)
+{
+       char *s = def;
+
+       if (s) {
+               unsigned char sha1[20];
+
+               def = NULL;
+               if (!get_sha1(s, sha1)) {
+                       show_rev(NORMAL, sha1, s);
+                       return;
+               }
+       }
+}
+
+static int show_reference(const char *refname, const unsigned char *sha1)
+{
+       show_rev(NORMAL, sha1, refname);
+       return 0;
+}
+
+static void show_datestring(const char *flag, const char *datestr)
+{
+       static char buffer[100];
+
+       /* date handling requires both flags and revs */
+       if ((filter & (DO_FLAGS | DO_REVS)) != (DO_FLAGS | DO_REVS))
+               return;
+       snprintf(buffer, sizeof(buffer), "%s%lu", flag, approxidate(datestr));
+       show(buffer);
+}
+
+static int show_file(const char *arg)
+{
+       show_default();
+       if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV)) {
+               show(arg);
+               return 1;
+       }
+       return 0;
+}
+
+int cmd_rev_parse(int argc, const char **argv, char **envp)
+{
+       int i, as_is = 0, verify = 0;
+       unsigned char sha1[20];
+       const char *prefix = setup_git_directory();
+
+       git_config(git_default_config);
+
+       for (i = 1; i < argc; i++) {
+               char *arg = argv[i];
+               char *dotdot;
+
+               if (as_is) {
+                       if (show_file(arg) && as_is < 2)
+                               verify_filename(prefix, arg);
+                       continue;
+               }
+               if (!strcmp(arg,"-n")) {
+                       if (++i >= argc)
+                               die("-n requires an argument");
+                       if ((filter & DO_FLAGS) && (filter & DO_REVS)) {
+                               show(arg);
+                               show(argv[i]);
+                       }
+                       continue;
+               }
+               if (!strncmp(arg,"-n",2)) {
+                       if ((filter & DO_FLAGS) && (filter & DO_REVS))
+                               show(arg);
+                       continue;
+               }
+
+               if (*arg == '-') {
+                       if (!strcmp(arg, "--")) {
+                               as_is = 2;
+                               /* Pass on the "--" if we show anything but files.. */
+                               if (filter & (DO_FLAGS | DO_REVS))
+                                       show_file(arg);
+                               continue;
+                       }
+                       if (!strcmp(arg, "--default")) {
+                               def = argv[i+1];
+                               i++;
+                               continue;
+                       }
+                       if (!strcmp(arg, "--revs-only")) {
+                               filter &= ~DO_NOREV;
+                               continue;
+                       }
+                       if (!strcmp(arg, "--no-revs")) {
+                               filter &= ~DO_REVS;
+                               continue;
+                       }
+                       if (!strcmp(arg, "--flags")) {
+                               filter &= ~DO_NONFLAGS;
+                               continue;
+                       }
+                       if (!strcmp(arg, "--no-flags")) {
+                               filter &= ~DO_FLAGS;
+                               continue;
+                       }
+                       if (!strcmp(arg, "--verify")) {
+                               filter &= ~(DO_FLAGS|DO_NOREV);
+                               verify = 1;
+                               continue;
+                       }
+                       if (!strcmp(arg, "--short") ||
+                           !strncmp(arg, "--short=", 8)) {
+                               filter &= ~(DO_FLAGS|DO_NOREV);
+                               verify = 1;
+                               abbrev = DEFAULT_ABBREV;
+                               if (arg[7] == '=')
+                                       abbrev = strtoul(arg + 8, NULL, 10);
+                               if (abbrev < MINIMUM_ABBREV)
+                                       abbrev = MINIMUM_ABBREV;
+                               else if (40 <= abbrev)
+                                       abbrev = 40;
+                               continue;
+                       }
+                       if (!strcmp(arg, "--sq")) {
+                               output_sq = 1;
+                               continue;
+                       }
+                       if (!strcmp(arg, "--not")) {
+                               show_type ^= REVERSED;
+                               continue;
+                       }
+                       if (!strcmp(arg, "--symbolic")) {
+                               symbolic = 1;
+                               continue;
+                       }
+                       if (!strcmp(arg, "--all")) {
+                               for_each_ref(show_reference);
+                               continue;
+                       }
+                       if (!strcmp(arg, "--branches")) {
+                               for_each_branch_ref(show_reference);
+                               continue;
+                       }
+                       if (!strcmp(arg, "--tags")) {
+                               for_each_tag_ref(show_reference);
+                               continue;
+                       }
+                       if (!strcmp(arg, "--remotes")) {
+                               for_each_remote_ref(show_reference);
+                               continue;
+                       }
+                       if (!strcmp(arg, "--show-prefix")) {
+                               if (prefix)
+                                       puts(prefix);
+                               continue;
+                       }
+                       if (!strcmp(arg, "--show-cdup")) {
+                               const char *pfx = prefix;
+                               while (pfx) {
+                                       pfx = strchr(pfx, '/');
+                                       if (pfx) {
+                                               pfx++;
+                                               printf("../");
+                                       }
+                               }
+                               putchar('\n');
+                               continue;
+                       }
+                       if (!strcmp(arg, "--git-dir")) {
+                               const char *gitdir = getenv(GIT_DIR_ENVIRONMENT);
+                               static char cwd[PATH_MAX];
+                               if (gitdir) {
+                                       puts(gitdir);
+                                       continue;
+                               }
+                               if (!prefix) {
+                                       puts(".git");
+                                       continue;
+                               }
+                               if (!getcwd(cwd, PATH_MAX))
+                                       die("unable to get current working directory");
+                               printf("%s/.git\n", cwd);
+                               continue;
+                       }
+                       if (!strncmp(arg, "--since=", 8)) {
+                               show_datestring("--max-age=", arg+8);
+                               continue;
+                       }
+                       if (!strncmp(arg, "--after=", 8)) {
+                               show_datestring("--max-age=", arg+8);
+                               continue;
+                       }
+                       if (!strncmp(arg, "--before=", 9)) {
+                               show_datestring("--min-age=", arg+9);
+                               continue;
+                       }
+                       if (!strncmp(arg, "--until=", 8)) {
+                               show_datestring("--min-age=", arg+8);
+                               continue;
+                       }
+                       if (show_flag(arg) && verify)
+                               die("Needed a single revision");
+                       continue;
+               }
+
+               /* Not a flag argument */
+               dotdot = strstr(arg, "..");
+               if (dotdot) {
+                       unsigned char end[20];
+                       char *next = dotdot + 2;
+                       char *this = arg;
+                       *dotdot = 0;
+                       if (!*next)
+                               next = "HEAD";
+                       if (dotdot == arg)
+                               this = "HEAD";
+                       if (!get_sha1(this, sha1) && !get_sha1(next, end)) {
+                               show_rev(NORMAL, end, next);
+                               show_rev(REVERSED, sha1, this);
+                               continue;
+                       }
+                       *dotdot = '.';
+               }
+               if (!get_sha1(arg, sha1)) {
+                       show_rev(NORMAL, sha1, arg);
+                       continue;
+               }
+               if (*arg == '^' && !get_sha1(arg+1, sha1)) {
+                       show_rev(REVERSED, sha1, arg+1);
+                       continue;
+               }
+               as_is = 1;
+               if (!show_file(arg))
+                       continue;
+               if (verify)
+                       die("Needed a single revision");
+               verify_filename(prefix, arg);
+       }
+       show_default();
+       if (verify && revs_count != 1)
+               die("Needed a single revision");
+       return 0;
+}
index 738ec3d..ffa9340 100644 (file)
--- a/builtin.h
+++ b/builtin.h
@@ -43,5 +43,6 @@ extern int cmd_diff_index(int argc, const char **argv, char **envp);
 extern int cmd_diff_stages(int argc, const char **argv, char **envp);
 extern int cmd_diff_tree(int argc, const char **argv, char **envp);
 extern int cmd_cat_file(int argc, const char **argv, char **envp);
+extern int cmd_rev_parse(int argc, const char **argv, char **envp);
 
 #endif
index 1983d45..15482d2 100755 (executable)
@@ -260,20 +260,41 @@ do
   -m|--m|--me|--mes|--mess|--messa|--messag|--message)
       case "$#" in 1) usage ;; esac
       shift
-      log_given=t$log_given
-      log_message="$1"
+      log_given=m$log_given
+      if test "$log_message" = ''
+      then
+          log_message="$1"
+      else
+          log_message="$log_message
+
+$1"
+      fi
       no_edit=t
       shift
       ;;
   -m*)
-      log_given=t$log_given
-      log_message=`expr "$1" : '-m\(.*\)'`
+      log_given=m$log_given
+      if test "$log_message" = ''
+      then
+          log_message=`expr "$1" : '-m\(.*\)'`
+      else
+          log_message="$log_message
+
+`expr "$1" : '-m\(.*\)'`"
+      fi
       no_edit=t
       shift
       ;;
   --m=*|--me=*|--mes=*|--mess=*|--messa=*|--messag=*|--message=*)
-      log_given=t$log_given
-      log_message=`expr "$1" : '-[^=]*=\(.*\)'`
+      log_given=m$log_given
+      if test "$log_message" = ''
+      then
+          log_message=`expr "$1" : '-[^=]*=\(.*\)'`
+      else
+          log_message="$log_message
+
+`expr "$1" : '-[^=]*=\(.*\)'`"
+      fi
       no_edit=t
       shift
       ;;
@@ -378,7 +399,9 @@ esac
 
 case "$log_given" in
 tt*)
-  die "Only one of -c/-C/-F/-m can be used." ;;
+  die "Only one of -c/-C/-F can be used." ;;
+*tm*|*mt*)
+  die "Option -m cannot be combined with -c/-C/-F." ;;
 esac
 
 case "$#,$also,$only,$amend" in
index 69bd810..48818f8 100755 (executable)
@@ -166,7 +166,10 @@ fast_forward_local () {
            mb=$(git-merge-base "$local" "$2") &&
            case "$2,$mb" in
            $local,*)
-               echo >&2 "* $1: same as $3"
+               if test -n "$verbose"
+               then
+                       echo >&2 "* $1: same as $3"
+               fi
                ;;
            *,$local)
                echo >&2 "* $1: fast forward to $3"
index 0e368ff..ed1d89b 100755 (executable)
@@ -21,7 +21,6 @@ use warnings;
 use Term::ReadLine;
 use Getopt::Long;
 use Data::Dumper;
-use Net::SMTP;
 
 # most mail servers generate the Date: header, but not all...
 $ENV{LC_ALL} = 'C';
@@ -394,6 +393,7 @@ X-Mailer: git-send-email $gitversion
                print $sm "$header\n$message";
                close $sm or die $?;
        } else {
+               require Net::SMTP;
                $smtp ||= Net::SMTP->new( $smtp_server );
                $smtp->mail( $from ) or die $smtp->message;
                $smtp->to( @recipients ) or die $smtp->message;
diff --git a/git.c b/git.c
index 10ea934..bc463c9 100644 (file)
--- a/git.c
+++ b/git.c
@@ -69,7 +69,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
                { "diff-index", cmd_diff_index },
                { "diff-stages", cmd_diff_stages },
                { "diff-tree", cmd_diff_tree },
-               { "cat-file", cmd_cat_file }
+               { "cat-file", cmd_cat_file },
+               { "rev-parse", cmd_rev_parse }
        };
        int i;
 
diff --git a/gitk b/gitk
index 4aa57c0..101cf9b 100755 (executable)
--- a/gitk
+++ b/gitk
@@ -34,10 +34,10 @@ proc start_rev_list {view} {
        set order "--date-order"
     }
     if {[catch {
-       set fd [open [concat | git-rev-list --header $order \
+       set fd [open [concat | git rev-list --header $order \
                          --parents --boundary --default HEAD $args] r]
     } err]} {
-       puts stderr "Error executing git-rev-list: $err"
+       puts stderr "Error executing git rev-list: $err"
        exit 1
     }
     set commfd($view) $fd
@@ -94,10 +94,10 @@ proc getcommitlines {fd view}  {
            }
            if {[string range $err 0 4] == "usage"} {
                set err "Gitk: error reading commits$fv:\
-                       bad arguments to git-rev-list."
+                       bad arguments to git rev-list."
                if {$viewname($view) eq "Command line"} {
                    append err \
-                       "  (Note: arguments to gitk are passed to git-rev-list\
+                       "  (Note: arguments to gitk are passed to git rev-list\
                         to allow selection of commits to be displayed.)"
                }
            } else {
@@ -148,7 +148,7 @@ proc getcommitlines {fd view}  {
            if {[string length $shortcmit] > 80} {
                set shortcmit "[string range $shortcmit 0 80]..."
            }
-           error_popup "Can't parse git-rev-list output: {$shortcmit}"
+           error_popup "Can't parse git rev-list output: {$shortcmit}"
            exit 1
        }
        set id [lindex $ids 0]
@@ -217,7 +217,7 @@ proc doupdate {} {
 }
 
 proc readcommit {id} {
-    if {[catch {set contents [exec git-cat-file commit $id]}]} return
+    if {[catch {set contents [exec git cat-file commit $id]}]} return
     parsecommit $id $contents 0
 }
 
@@ -276,8 +276,8 @@ proc parsecommit {id contents listed} {
        set headline $comment
     }
     if {!$listed} {
-       # git-rev-list indents the comment by 4 spaces;
-       # if we got this via git-cat-file, add the indentation
+       # git rev-list indents the comment by 4 spaces;
+       # if we got this via git cat-file, add the indentation
        set newcomment {}
        foreach line [split $comment "\n"] {
            append newcomment "    "
@@ -337,14 +337,14 @@ proc readrefs {} {
            set type {}
            set tag {}
            catch {
-               set commit [exec git-rev-parse "$id^0"]
+               set commit [exec git rev-parse "$id^0"]
                if {"$commit" != "$id"} {
                    set tagids($name) $commit
                    lappend idtags($commit) $name
                }
            }           
            catch {
-               set tagcontents($name) [exec git-cat-file tag "$id"]
+               set tagcontents($name) [exec git cat-file tag "$id"]
            }
        } elseif { $type == "heads" } {
            set headids($name) $id
@@ -357,21 +357,21 @@ proc readrefs {} {
     close $refd
 }
 
-proc show_error {w msg} {
+proc show_error {w top msg} {
     message $w.m -text $msg -justify center -aspect 400
     pack $w.m -side top -fill x -padx 20 -pady 20
-    button $w.ok -text OK -command "destroy $w"
+    button $w.ok -text OK -command "destroy $top"
     pack $w.ok -side bottom -fill x
-    bind $w <Visibility> "grab $w; focus $w"
-    bind $w <Key-Return> "destroy $w"
-    tkwait window $w
+    bind $top <Visibility> "grab $top; focus $top"
+    bind $top <Key-Return> "destroy $top"
+    tkwait window $top
 }
 
 proc error_popup msg {
     set w .error
     toplevel $w
     wm transient $w .
-    show_error $w $msg
+    show_error $w $w $msg
 }
 
 proc makewindow {} {
@@ -380,7 +380,7 @@ proc makewindow {} {
     global findtype findtypemenu findloc findstring fstring geometry
     global entries sha1entry sha1string sha1but
     global maincursor textcursor curtextcursor
-    global rowctxmenu mergemax
+    global rowctxmenu mergemax wrapcomment
 
     menu .bar
     .bar add cascade -label "File" -menu .bar.file
@@ -527,6 +527,7 @@ proc makewindow {} {
     pack $ctext -side left -fill both -expand 1
     .ctop.cdet add .ctop.cdet.left
 
+    $ctext tag conf comment -wrap $wrapcomment
     $ctext tag conf filesep -font [concat $textfont bold] -back "#aaaaaa"
     $ctext tag conf hunksep -fore blue
     $ctext tag conf d0 -fore red
@@ -696,7 +697,7 @@ proc savestuff {w} {
     global stuffsaved findmergefiles maxgraphpct
     global maxwidth
     global viewname viewfiles viewargs viewperm nextviewnum
-    global cmitmode
+    global cmitmode wrapcomment
 
     if {$stuffsaved} return
     if {![winfo viewable .]} return
@@ -709,6 +710,7 @@ proc savestuff {w} {
        puts $f [list set maxgraphpct $maxgraphpct]
        puts $f [list set maxwidth $maxwidth]
        puts $f [list set cmitmode $cmitmode]
+       puts $f [list set wrapcomment $wrapcomment]
        puts $f "set geometry(width) [winfo width .ctop]"
        puts $f "set geometry(height) [winfo height .ctop]"
        puts $f "set geometry(canv1) [expr {[winfo width $canv]-2}]"
@@ -1285,7 +1287,7 @@ proc vieweditor {top n title} {
     checkbutton $top.perm -text "Remember this view" -variable newviewperm($n)
     grid $top.perm - -pady 5 -sticky w
     message $top.al -aspect 1000 -font $uifont \
-       -text "Commits to include (arguments to git-rev-list):"
+       -text "Commits to include (arguments to git rev-list):"
     grid $top.al - -sticky w -pady 5
     entry $top.args -width 50 -textvariable newviewargs($n) \
        -background white
@@ -2939,7 +2941,7 @@ proc findpatches {} {
     }
 
     if {[catch {
-       set f [open [list | git-diff-tree --stdin -s -r -S$findstring \
+       set f [open [list | git diff-tree --stdin -s -r -S$findstring \
                         << $inputids] r]
     } err]} {
        error_popup "Error starting search process: $err"
@@ -2971,7 +2973,7 @@ proc readfindproc {} {
        return
     }
     if {![regexp {^[0-9a-f]{40}} $line id]} {
-       error_popup "Can't parse git-diff-tree output: $line"
+       error_popup "Can't parse git diff-tree output: $line"
        stopfindproc
        return
     }
@@ -3036,10 +3038,10 @@ proc findfiles {} {
        if {$l == $findstartline} break
     }
 
-    # start off a git-diff-tree process if needed
+    # start off a git diff-tree process if needed
     if {$diffsneeded ne {}} {
        if {[catch {
-           set df [open [list | git-diff-tree -r --stdin << $diffsneeded] r]
+           set df [open [list | git diff-tree -r --stdin << $diffsneeded] r]
        } err ]} {
            error_popup "Error starting search process: $err"
            return
@@ -3069,7 +3071,7 @@ proc readfilediffs {df} {
            if {[catch {close $df} err]} {
                stopfindproc
                bell
-               error_popup "Error in git-diff-tree: $err"
+               error_popup "Error in git diff-tree: $err"
            } elseif {[info exists findid]} {
                set id $findid
                stopfindproc
@@ -3096,7 +3098,7 @@ proc donefilediff {} {
     if {[info exists fdiffid]} {
        while {[lindex $fdiffsneeded $fdiffpos] ne $fdiffid
               && $fdiffpos < [llength $fdiffsneeded]} {
-           # git-diff-tree doesn't output anything for a commit
+           # git diff-tree doesn't output anything for a commit
            # which doesn't change anything
            set nullid [lindex $fdiffsneeded $fdiffpos]
            set treediffs($nullid) {}
@@ -3213,8 +3215,11 @@ proc selcanvline {w x y} {
 
 proc commit_descriptor {p} {
     global commitinfo
+    if {![info exists commitinfo($p)]} {
+       getcommit $p
+    }
     set l "..."
-    if {[info exists commitinfo($p)]} {
+    if {[llength $commitinfo($p)] > 1} {
        set l [lindex $commitinfo($p) 0]
     }
     return "$p ($l)"
@@ -3222,11 +3227,11 @@ proc commit_descriptor {p} {
 
 # append some text to the ctext widget, and make any SHA1 ID
 # that we know about be a clickable link.
-proc appendwithlinks {text} {
+proc appendwithlinks {text tags} {
     global ctext commitrow linknum curview
 
     set start [$ctext index "end - 1c"]
-    $ctext insert end $text
+    $ctext insert end $text $tags
     $ctext insert end "\n"
     set links [regexp -indices -all -inline {[0-9a-f]{40}} $text]
     foreach l $links {
@@ -3354,7 +3359,7 @@ proc selectline {l isnew} {
        $ctext insert end "\n"
     }
  
-    set comment {}
+    set headers {}
     set olds [lindex $parentlist $l]
     if {[llength $olds] > 1} {
        set np 0
@@ -3365,23 +3370,22 @@ proc selectline {l isnew} {
                set tag m$np
            }
            $ctext insert end "Parent: " $tag
-           appendwithlinks [commit_descriptor $p]
+           appendwithlinks [commit_descriptor $p] {}
            incr np
        }
     } else {
        foreach p $olds {
-           append comment "Parent: [commit_descriptor $p]\n"
+           append headers "Parent: [commit_descriptor $p]\n"
        }
     }
 
     foreach c [lindex $childlist $l] {
-       append comment "Child:  [commit_descriptor $c]\n"
+       append headers "Child:  [commit_descriptor $c]\n"
     }
-    append comment "\n"
-    append comment [lindex $info 5]
 
     # make anything that looks like a SHA1 ID be a clickable link
-    appendwithlinks $comment
+    appendwithlinks $headers {}
+    appendwithlinks [lindex $info 5] {comment}
 
     $ctext tag delete Comments
     $ctext tag remove found 1.0 end
@@ -3426,6 +3430,7 @@ proc selnextpage {dir} {
        set lpp 1
     }
     allcanvs yview scroll [expr {$dir * $lpp}] units
+    drawvisible
     if {![info exists selectedline]} return
     set l [expr {$selectedline + $dir * $lpp}]
     if {$l < 0} {
@@ -3521,7 +3526,7 @@ proc gettree {id} {
     catch {unset diffmergeid}
     if {![info exists treefilelist($id)]} {
        if {![info exists treepending]} {
-           if {[catch {set gtf [open [concat | git-ls-tree -r $id] r]}]} {
+           if {[catch {set gtf [open [concat | git ls-tree -r $id] r]}]} {
                return
            }
            set treepending $id
@@ -3569,7 +3574,7 @@ proc showfile {f} {
        return
     }
     set blob [lindex $treeidlist($diffids) $i]
-    if {[catch {set bf [open [concat | git-cat-file blob $blob] r]} err]} {
+    if {[catch {set bf [open [concat | git cat-file blob $blob] r]} err]} {
        puts "oops, error reading blob $blob: $err"
        return
     }
@@ -3611,7 +3616,7 @@ proc mergediff {id l} {
     set diffids $id
     # this doesn't seem to actually affect anything...
     set env(GIT_DIFF_OPTS) $diffopts
-    set cmd [concat | git-diff-tree --no-commit-id --cc $id]
+    set cmd [concat | git diff-tree --no-commit-id --cc $id]
     if {[catch {set mdf [open $cmd r]} err]} {
        error_popup "Error getting merge diffs: $err"
        return
@@ -3723,7 +3728,7 @@ proc gettreediffs {ids} {
     set treepending $ids
     set treediff {}
     if {[catch \
-        {set gdtf [open [concat | git-diff-tree --no-commit-id -r $ids] r]} \
+        {set gdtf [open [concat | git diff-tree --no-commit-id -r $ids] r]} \
        ]} return
     fconfigure $gdtf -blocking 0
     fileevent $gdtf readable [list gettreediffline $gdtf $ids]
@@ -3759,7 +3764,7 @@ proc getblobdiffs {ids} {
     global nextupdate diffinhdr treediffs
 
     set env(GIT_DIFF_OPTS) $diffopts
-    set cmd [concat | git-diff-tree --no-commit-id -r -p -C $ids]
+    set cmd [concat | git diff-tree --no-commit-id -r -p -C $ids]
     if {[catch {set bdf [open $cmd r]} err]} {
        puts "error getting diffs: $err"
        return
@@ -4296,7 +4301,7 @@ proc mkpatchgo {} {
     set oldid [$patchtop.fromsha1 get]
     set newid [$patchtop.tosha1 get]
     set fname [$patchtop.fname get]
-    if {[catch {exec git-diff-tree -p $oldid $newid >$fname &} err]} {
+    if {[catch {exec git diff-tree -p $oldid $newid >$fname &} err]} {
        error_popup "Error creating patch: $err"
     }
     catch {destroy $patchtop}
@@ -4504,7 +4509,7 @@ proc showtag {tag isnew} {
     } else {
        set text "Tag: $tag\nId:  $tagids($tag)"
     }
-    appendwithlinks $text
+    appendwithlinks $text {}
     $ctext conf -state disabled
     init_flist {}
 }
@@ -4863,11 +4868,11 @@ proc tcl_encoding {enc} {
 # defaults...
 set datemode 0
 set diffopts "-U 5 -p"
-set wrcomcmd "git-diff-tree --stdin -p --pretty"
+set wrcomcmd "git diff-tree --stdin -p --pretty"
 
 set gitencoding {}
 catch {
-    set gitencoding [exec git-repo-config --get i18n.commitencoding]
+    set gitencoding [exec git repo-config --get i18n.commitencoding]
 }
 if {$gitencoding == ""} {
     set gitencoding "utf-8"
@@ -4890,6 +4895,7 @@ set downarrowlen 7
 set mingaplen 30
 set flistmode "flat"
 set cmitmode "patch"
+set wrapcomment "none"
 
 set colors {green red blue magenta darkgrey brown orange}
 
@@ -4911,7 +4917,7 @@ foreach arg $argv {
 # check that we can find a .git directory somewhere...
 set gitdir [gitdir]
 if {![file isdirectory $gitdir]} {
-    show_error . "Cannot find the git directory \"$gitdir\"."
+    show_error {} . "Cannot find the git directory \"$gitdir\"."
     exit 1
 }
 
@@ -4922,7 +4928,7 @@ if {$i >= 0} {
     set revtreeargs [lrange $revtreeargs 0 [expr {$i - 1}]]
 } elseif {$revtreeargs ne {}} {
     if {[catch {
-       set f [eval exec git-rev-parse --no-revs --no-flags $revtreeargs]
+       set f [eval exec git rev-parse --no-revs --no-flags $revtreeargs]
        set cmdline_files [split $f "\n"]
        set n [llength $cmdline_files]
        set revtreeargs [lrange $revtreeargs 0 end-$n]
@@ -4931,9 +4937,9 @@ if {$i >= 0} {
        # so look for "fatal:".
        set i [string first "fatal:" $err]
        if {$i > 0} {
-           set err [string range [expr {$i + 6}] end]
+           set err [string range $err [expr {$i + 6}] end]
        }
-       show_error . "Bad arguments to gitk:\n$err"
+       show_error {} . "Bad arguments to gitk:\n$err"
        exit 1
     }
 }
index 861644b..178f1ee 100644 (file)
@@ -1269,10 +1269,10 @@ int main(int argc, char **argv)
        if (pull(commit_id))
                rc = 1;
 
-       curl_slist_free_all(no_pragma_header);
-
        http_cleanup();
 
+       curl_slist_free_all(no_pragma_header);
+
        if (corrupt_object_found) {
                fprintf(stderr,
 "Some loose object were found to be corrupt, but they might be just\n"
diff --git a/http.c b/http.c
index 0cb42a8..146cf7b 100644 (file)
--- a/http.c
+++ b/http.c
@@ -25,7 +25,6 @@ long curl_low_speed_limit = -1;
 long curl_low_speed_time = -1;
 
 struct curl_slist *pragma_header;
-struct curl_slist *no_range_header;
 
 struct active_request_slot *active_queue_head = NULL;
 
@@ -208,7 +207,6 @@ void http_init(void)
        curl_global_init(CURL_GLOBAL_ALL);
 
        pragma_header = curl_slist_append(pragma_header, "Pragma: no-cache");
-       no_range_header = curl_slist_append(no_range_header, "Range:");
 
 #ifdef USE_CURL_MULTI
        {
@@ -344,9 +342,14 @@ struct active_request_slot *get_active_slot(void)
        slot->finished = NULL;
        slot->callback_data = NULL;
        slot->callback_func = NULL;
+       curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, NULL);
        curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, pragma_header);
-       curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, no_range_header);
        curl_easy_setopt(slot->curl, CURLOPT_ERRORBUFFER, curl_errorstr);
+       curl_easy_setopt(slot->curl, CURLOPT_CUSTOMREQUEST, NULL);
+       curl_easy_setopt(slot->curl, CURLOPT_READFUNCTION, NULL);
+       curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, NULL);
+       curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
+       curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
 
        return slot;
 }
index 58b0163..ebb49f2 100644 (file)
@@ -12,6 +12,37 @@ static void show_parents(struct commit *commit, int abbrev)
        }
 }
 
+static int append_signoff(char *buf, int buf_sz, int at, const char *signoff)
+{
+       int signoff_len = strlen(signoff);
+       static const char signed_off_by[] = "Signed-off-by: ";
+       char *cp = buf;
+
+       /* Do we have enough space to add it? */
+       if (buf_sz - at <= strlen(signed_off_by) + signoff_len + 2)
+               return at;
+
+       /* First see if we already have the sign-off by the signer */
+       while (1) {
+               cp = strstr(cp, signed_off_by);
+               if (!cp)
+                       break;
+               cp += strlen(signed_off_by);
+               if ((cp + signoff_len < buf + at) &&
+                   !strncmp(cp, signoff, signoff_len) &&
+                   isspace(cp[signoff_len]))
+                       return at; /* we already have him */
+       }
+
+       strcpy(buf + at, signed_off_by);
+       at += strlen(signed_off_by);
+       strcpy(buf + at, signoff);
+       at += signoff_len;
+       buf[at++] = '\n';
+       buf[at] = 0;
+       return at;
+}
+
 void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
 {
        static char this_header[16384];
@@ -20,7 +51,7 @@ void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
        int abbrev_commit = opt->abbrev_commit ? opt->abbrev : 40;
        const char *extra;
        int len;
-       char *subject = NULL, *after_subject = NULL;
+       const char *subject = NULL, *extra_headers = opt->extra_headers;
 
        opt->loginfo = NULL;
        if (!opt->verbose_header) {
@@ -69,6 +100,7 @@ void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
                        static char subject_buffer[1024];
                        static char buffer[1024];
                        snprintf(subject_buffer, sizeof(subject_buffer) - 1,
+                                "%s"
                                 "MIME-Version: 1.0\n"
                                 "Content-Type: multipart/mixed;\n"
                                 " boundary=\"%s%s\"\n"
@@ -79,9 +111,10 @@ void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
                                 "Content-Type: text/plain; "
                                 "charset=UTF-8; format=fixed\n"
                                 "Content-Transfer-Encoding: 8bit\n\n",
+                                extra_headers ? extra_headers : "",
                                 mime_boundary_leader, opt->mime_boundary,
                                 mime_boundary_leader, opt->mime_boundary);
-                       after_subject = subject_buffer;
+                       extra_headers = subject_buffer;
 
                        snprintf(buffer, sizeof(buffer) - 1,
                                 "--%s%s\n"
@@ -110,7 +143,11 @@ void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
        /*
         * And then the pretty-printed message itself
         */
-       len = pretty_print_commit(opt->commit_format, commit, ~0u, this_header, sizeof(this_header), abbrev, subject, after_subject);
+       len = pretty_print_commit(opt->commit_format, commit, ~0u, this_header, sizeof(this_header), abbrev, subject, extra_headers);
+
+       if (opt->add_signoff)
+               len = append_signoff(this_header, sizeof(this_header), len,
+                                    opt->add_signoff);
        printf("%s%s%s", this_header, extra, sep);
 }
 
diff --git a/rev-parse.c b/rev-parse.c
deleted file mode 100644 (file)
index 4e2d9fb..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * rev-parse.c
- *
- * Copyright (C) Linus Torvalds, 2005
- */
-#include "cache.h"
-#include "commit.h"
-#include "refs.h"
-#include "quote.h"
-
-#define DO_REVS                1
-#define DO_NOREV       2
-#define DO_FLAGS       4
-#define DO_NONFLAGS    8
-static int filter = ~0;
-
-static char *def = NULL;
-
-#define NORMAL 0
-#define REVERSED 1
-static int show_type = NORMAL;
-static int symbolic = 0;
-static int abbrev = 0;
-static int output_sq = 0;
-
-static int revs_count = 0;
-
-/*
- * Some arguments are relevant "revision" arguments,
- * others are about output format or other details.
- * This sorts it all out.
- */
-static int is_rev_argument(const char *arg)
-{
-       static const char *rev_args[] = {
-               "--all",
-               "--bisect",
-               "--dense",
-               "--branches",
-               "--header",
-               "--max-age=",
-               "--max-count=",
-               "--min-age=",
-               "--no-merges",
-               "--objects",
-               "--objects-edge",
-               "--parents",
-               "--pretty",
-               "--remotes",
-               "--sparse",
-               "--tags",
-               "--topo-order",
-               "--date-order",
-               "--unpacked",
-               NULL
-       };
-       const char **p = rev_args;
-
-       /* accept -<digit>, like traditional "head" */
-       if ((*arg == '-') && isdigit(arg[1]))
-               return 1;
-
-       for (;;) {
-               const char *str = *p++;
-               int len;
-               if (!str)
-                       return 0;
-               len = strlen(str);
-               if (!strcmp(arg, str) ||
-                   (str[len-1] == '=' && !strncmp(arg, str, len)))
-                       return 1;
-       }
-}
-
-/* Output argument as a string, either SQ or normal */
-static void show(const char *arg)
-{
-       if (output_sq) {
-               int sq = '\'', ch;
-
-               putchar(sq);
-               while ((ch = *arg++)) {
-                       if (ch == sq)
-                               fputs("'\\'", stdout);
-                       putchar(ch);
-               }
-               putchar(sq);
-               putchar(' ');
-       }
-       else
-               puts(arg);
-}
-
-/* Output a revision, only if filter allows it */
-static void show_rev(int type, const unsigned char *sha1, const char *name)
-{
-       if (!(filter & DO_REVS))
-               return;
-       def = NULL;
-       revs_count++;
-
-       if (type != show_type)
-               putchar('^');
-       if (symbolic && name)
-               show(name);
-       else if (abbrev)
-               show(find_unique_abbrev(sha1, abbrev));
-       else
-               show(sha1_to_hex(sha1));
-}
-
-/* Output a flag, only if filter allows it. */
-static int show_flag(char *arg)
-{
-       if (!(filter & DO_FLAGS))
-               return 0;
-       if (filter & (is_rev_argument(arg) ? DO_REVS : DO_NOREV)) {
-               show(arg);
-               return 1;
-       }
-       return 0;
-}
-
-static void show_default(void)
-{
-       char *s = def;
-
-       if (s) {
-               unsigned char sha1[20];
-
-               def = NULL;
-               if (!get_sha1(s, sha1)) {
-                       show_rev(NORMAL, sha1, s);
-                       return;
-               }
-       }
-}
-
-static int show_reference(const char *refname, const unsigned char *sha1)
-{
-       show_rev(NORMAL, sha1, refname);
-       return 0;
-}
-
-static void show_datestring(const char *flag, const char *datestr)
-{
-       static char buffer[100];
-
-       /* date handling requires both flags and revs */
-       if ((filter & (DO_FLAGS | DO_REVS)) != (DO_FLAGS | DO_REVS))
-               return;
-       snprintf(buffer, sizeof(buffer), "%s%lu", flag, approxidate(datestr));
-       show(buffer);
-}
-
-static int show_file(const char *arg)
-{
-       show_default();
-       if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV)) {
-               show(arg);
-               return 1;
-       }
-       return 0;
-}
-
-int main(int argc, char **argv)
-{
-       int i, as_is = 0, verify = 0;
-       unsigned char sha1[20];
-       const char *prefix = setup_git_directory();
-
-       git_config(git_default_config);
-
-       for (i = 1; i < argc; i++) {
-               char *arg = argv[i];
-               char *dotdot;
-
-               if (as_is) {
-                       if (show_file(arg) && as_is < 2)
-                               verify_filename(prefix, arg);
-                       continue;
-               }
-               if (!strcmp(arg,"-n")) {
-                       if (++i >= argc)
-                               die("-n requires an argument");
-                       if ((filter & DO_FLAGS) && (filter & DO_REVS)) {
-                               show(arg);
-                               show(argv[i]);
-                       }
-                       continue;
-               }
-               if (!strncmp(arg,"-n",2)) {
-                       if ((filter & DO_FLAGS) && (filter & DO_REVS))
-                               show(arg);
-                       continue;
-               }
-
-               if (*arg == '-') {
-                       if (!strcmp(arg, "--")) {
-                               as_is = 2;
-                               /* Pass on the "--" if we show anything but files.. */
-                               if (filter & (DO_FLAGS | DO_REVS))
-                                       show_file(arg);
-                               continue;
-                       }
-                       if (!strcmp(arg, "--default")) {
-                               def = argv[i+1];
-                               i++;
-                               continue;
-                       }
-                       if (!strcmp(arg, "--revs-only")) {
-                               filter &= ~DO_NOREV;
-                               continue;
-                       }
-                       if (!strcmp(arg, "--no-revs")) {
-                               filter &= ~DO_REVS;
-                               continue;
-                       }
-                       if (!strcmp(arg, "--flags")) {
-                               filter &= ~DO_NONFLAGS;
-                               continue;
-                       }
-                       if (!strcmp(arg, "--no-flags")) {
-                               filter &= ~DO_FLAGS;
-                               continue;
-                       }
-                       if (!strcmp(arg, "--verify")) {
-                               filter &= ~(DO_FLAGS|DO_NOREV);
-                               verify = 1;
-                               continue;
-                       }
-                       if (!strcmp(arg, "--short") ||
-                           !strncmp(arg, "--short=", 8)) {
-                               filter &= ~(DO_FLAGS|DO_NOREV);
-                               verify = 1;
-                               abbrev = DEFAULT_ABBREV;
-                               if (arg[7] == '=')
-                                       abbrev = strtoul(arg + 8, NULL, 10);
-                               if (abbrev < MINIMUM_ABBREV)
-                                       abbrev = MINIMUM_ABBREV;
-                               else if (40 <= abbrev)
-                                       abbrev = 40;
-                               continue;
-                       }
-                       if (!strcmp(arg, "--sq")) {
-                               output_sq = 1;
-                               continue;
-                       }
-                       if (!strcmp(arg, "--not")) {
-                               show_type ^= REVERSED;
-                               continue;
-                       }
-                       if (!strcmp(arg, "--symbolic")) {
-                               symbolic = 1;
-                               continue;
-                       }
-                       if (!strcmp(arg, "--all")) {
-                               for_each_ref(show_reference);
-                               continue;
-                       }
-                       if (!strcmp(arg, "--branches")) {
-                               for_each_branch_ref(show_reference);
-                               continue;
-                       }
-                       if (!strcmp(arg, "--tags")) {
-                               for_each_tag_ref(show_reference);
-                               continue;
-                       }
-                       if (!strcmp(arg, "--remotes")) {
-                               for_each_remote_ref(show_reference);
-                               continue;
-                       }
-                       if (!strcmp(arg, "--show-prefix")) {
-                               if (prefix)
-                                       puts(prefix);
-                               continue;
-                       }
-                       if (!strcmp(arg, "--show-cdup")) {
-                               const char *pfx = prefix;
-                               while (pfx) {
-                                       pfx = strchr(pfx, '/');
-                                       if (pfx) {
-                                               pfx++;
-                                               printf("../");
-                                       }
-                               }
-                               putchar('\n');
-                               continue;
-                       }
-                       if (!strcmp(arg, "--git-dir")) {
-                               const char *gitdir = getenv(GIT_DIR_ENVIRONMENT);
-                               static char cwd[PATH_MAX];
-                               if (gitdir) {
-                                       puts(gitdir);
-                                       continue;
-                               }
-                               if (!prefix) {
-                                       puts(".git");
-                                       continue;
-                               }
-                               if (!getcwd(cwd, PATH_MAX))
-                                       die("unable to get current working directory");
-                               printf("%s/.git\n", cwd);
-                               continue;
-                       }
-                       if (!strncmp(arg, "--since=", 8)) {
-                               show_datestring("--max-age=", arg+8);
-                               continue;
-                       }
-                       if (!strncmp(arg, "--after=", 8)) {
-                               show_datestring("--max-age=", arg+8);
-                               continue;
-                       }
-                       if (!strncmp(arg, "--before=", 9)) {
-                               show_datestring("--min-age=", arg+9);
-                               continue;
-                       }
-                       if (!strncmp(arg, "--until=", 8)) {
-                               show_datestring("--min-age=", arg+8);
-                               continue;
-                       }
-                       if (show_flag(arg) && verify)
-                               die("Needed a single revision");
-                       continue;
-               }
-
-               /* Not a flag argument */
-               dotdot = strstr(arg, "..");
-               if (dotdot) {
-                       unsigned char end[20];
-                       char *next = dotdot + 2;
-                       char *this = arg;
-                       *dotdot = 0;
-                       if (!*next)
-                               next = "HEAD";
-                       if (dotdot == arg)
-                               this = "HEAD";
-                       if (!get_sha1(this, sha1) && !get_sha1(next, end)) {
-                               show_rev(NORMAL, end, next);
-                               show_rev(REVERSED, sha1, this);
-                               continue;
-                       }
-                       *dotdot = '.';
-               }
-               if (!get_sha1(arg, sha1)) {
-                       show_rev(NORMAL, sha1, arg);
-                       continue;
-               }
-               if (*arg == '^' && !get_sha1(arg+1, sha1)) {
-                       show_rev(REVERSED, sha1, arg+1);
-                       continue;
-               }
-               as_is = 1;
-               if (!show_file(arg))
-                       continue;
-               if (verify)
-                       die("Needed a single revision");
-               verify_filename(prefix, arg);
-       }
-       show_default();
-       if (verify && revs_count != 1)
-               die("Needed a single revision");
-       return 0;
-}
index bdbdd23..7d85b0f 100644 (file)
@@ -60,6 +60,8 @@ struct rev_info {
        struct log_info *loginfo;
        int             nr, total;
        const char      *mime_boundary;
+       const char      *add_signoff;
+       const char      *extra_headers;
 
        /* special limits */
        int max_count;
index f77c189..aea0f40 100644 (file)
@@ -617,6 +617,12 @@ static void prepare_packed_git_one(char *objdir, int local)
 
                /* we have .idx.  Is it a file we can map? */
                strcpy(path + len, de->d_name);
+               for (p = packed_git; p; p = p->next) {
+                       if (!memcmp(path, p->pack_name, len + namelen - 4))
+                               break;
+               }
+               if (p)
+                       continue;
                p = add_packed_git(path, len + namelen, local);
                if (!p)
                        continue;
@@ -626,12 +632,12 @@ static void prepare_packed_git_one(char *objdir, int local)
        closedir(dir);
 }
 
+static int prepare_packed_git_run_once = 0;
 void prepare_packed_git(void)
 {
-       static int run_once = 0;
        struct alternate_object_database *alt;
 
-       if (run_once)
+       if (prepare_packed_git_run_once)
                return;
        prepare_packed_git_one(get_object_directory(), 1);
        prepare_alt_odb();
@@ -640,7 +646,13 @@ void prepare_packed_git(void)
                prepare_packed_git_one(alt->base, 0);
                alt->name[-1] = '/';
        }
-       run_once = 1;
+       prepare_packed_git_run_once = 1;
+}
+
+static void reprepare_packed_git(void)
+{
+       prepare_packed_git_run_once = 0;
+       prepare_packed_git();
 }
 
 int check_sha1_signature(const unsigned char *sha1, void *map, unsigned long size, const char *type)
@@ -1212,9 +1224,12 @@ int sha1_object_info(const unsigned char *sha1, char *type, unsigned long *sizep
        if (!map) {
                struct pack_entry e;
 
-               if (!find_pack_entry(sha1, &e))
-                       return error("unable to find %s", sha1_to_hex(sha1));
-               return packed_object_info(&e, type, sizep);
+               if (find_pack_entry(sha1, &e))
+                       return packed_object_info(&e, type, sizep);
+               reprepare_packed_git();
+               if (find_pack_entry(sha1, &e))
+                       return packed_object_info(&e, type, sizep);
+               return error("unable to find %s", sha1_to_hex(sha1));
        }
        if (unpack_sha1_header(&stream, map, mapsize, hdr, sizeof(hdr)) < 0)
                status = error("unable to unpack %s header",
@@ -1256,6 +1271,9 @@ void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size
                munmap(map, mapsize);
                return buf;
        }
+       reprepare_packed_git();
+       if (find_pack_entry(sha1, &e))
+               return read_packed_sha1(sha1, type, size);
        return NULL;
 }