Merge branch 'js/shallow'
authorJunio C Hamano <junkio@cox.net>
Thu, 28 Dec 2006 09:25:43 +0000 (01:25 -0800)
committerJunio C Hamano <junkio@cox.net>
Thu, 28 Dec 2006 09:25:43 +0000 (01:25 -0800)
* js/shallow:
fetch-pack: Do not fetch tags for shallow clones.
get_shallow_commits: Avoid memory leak if a commit has been reached already.
git-fetch: Reset shallow_depth before auto-following tags.
upload-pack: Check for NOT_SHALLOW flag before sending a shallow to the client.
fetch-pack: Properly remove the shallow file when it becomes empty.
shallow clone: unparse and reparse an unshallowed commit
Why didn't we mark want_obj as ~UNINTERESTING in the old code?
Why does it mean we do not have to register shallow if we have one?
We should make sure that the protocol is still extensible.
add tests for shallow stuff
Shallow clone: do not ignore shallowness when following tags
allow deepening of a shallow repository
allow cloning a repository "shallowly"
support fetching into a shallow repository
upload-pack: no longer call rev-list

21 files changed:
.gitignore
Documentation/config.txt
Documentation/everyday.txt
Documentation/git-gc.txt [new file with mode: 0644]
Documentation/git-merge.txt
Documentation/git-reflog.txt [new file with mode: 0644]
Documentation/git-rerere.txt
Documentation/git.txt
Makefile
builtin-reflog.c
builtin-rerere.c
git-am.sh
git-fetch.sh
git-gc.sh [new file with mode: 0755]
git-merge.sh
git-pull.sh
git-rebase.sh
git-reset.sh
git-send-email.perl
git-sh-setup.sh
gitweb/gitweb.perl
index 60e5002bd55bfc5565cfc5f77084bfc900ae8f4e..2904f123496ddf8f69473675c183999d07838170 100644 (file)
@@ -42,6 +42,7 @@ git-fmt-merge-msg
 git-for-each-ref
 git-format-patch
 git-fsck-objects
+git-gc
 git-get-tar-commit-id
 git-grep
 git-hash-object
index 22482d6a94e88544935eee5f560089b9a4bf0dfa..6452a8be144f92f9140fb133acda4d9fd32f2b15 100644 (file)
@@ -192,6 +192,25 @@ format.headers::
        Additional email headers to include in a patch to be submitted
        by mail.  See gitlink:git-format-patch[1].
 
+gc.reflogexpire::
+       `git reflog expire` removes reflog entries older than
+       this time; defaults to 90 days.
+
+gc.reflogexpireunreachable::
+       `git reflog expire` removes reflog entries older than
+       this time and are not reachable from the current tip;
+       defaults to 30 days.
+
+gc.rerereresolved::
+       Records of conflicted merge you resolved earlier are
+       kept for this many days when `git rerere gc` is run.
+       The default is 60 days.  See gitlink:git-rerere[1].
+
+gc.rerereunresolved::
+       Records of conflicted merge you have not resolved are
+       kept for this many days when `git rerere gc` is run.
+       The default is 15 days.  See gitlink:git-rerere[1].
+
 gitcvs.enabled::
        Whether the cvs pserver interface is enabled for this repository.
        See gitlink:git-cvsserver[1].
index 5d17ace721d1ec4c031a4a1f96374559002a93c9..2105a3d2e7337105263c8a9fef466609c63fc163 100644 (file)
@@ -34,6 +34,9 @@ Everybody uses these commands to maintain git repositories.
 
   * gitlink:git-repack[1] to pack loose objects for efficiency.
 
+  * gitlink:git-gc[1] to do common housekeeping tasks such as
+    repack and prune.
+
 Examples
 ~~~~~~~~
 
@@ -41,10 +44,9 @@ Check health and remove cruft.::
 +
 ------------
 $ git fsck-objects <1>
-$ git prune
 $ git count-objects <2>
 $ git repack <3>
-$ git prune <4>
+$ git gc <4>
 ------------
 +
 <1> running without `\--full` is usually cheap and assures the
@@ -53,7 +55,8 @@ repository health reasonably well.
 disk space is wasted by not repacking.
 <3> without `-a` repacks incrementally.  repacking every 4-5MB
 of loose objects accumulation may be a good rule of thumb.
-<4> after repack, prune removes the duplicate loose objects.
+<4> it is easier to use `git gc` than individual housekeeping commands
+such as `prune` and `repack`.  This runs `repack -a -d`.
 
 Repack a small project into single pack.::
 +
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
new file mode 100644 (file)
index 0000000..73d78c1
--- /dev/null
@@ -0,0 +1,64 @@
+git-gc(1)
+=========
+
+NAME
+----
+git-gc - Cleanup unnecessary files and optimize the local repository
+
+
+SYNOPSIS
+--------
+'git-gc'
+
+DESCRIPTION
+-----------
+Runs a number of housekeeping tasks within the current repository,
+such as compressing file revisions (to reduce disk space and increase
+performance) and removing unreachable objects which may have been
+created from prior invocations of gitlink:git-add[1].
+
+Users are encouraged to run this task on a regular basis within
+each repository to maintain good disk space utilization and good
+operating performance.
+
+Configuration
+-------------
+
+The optional configuration variable 'gc.reflogExpire' can be
+set to indicate how long historical entries within each branch's
+reflog should remain available in this repository.  The setting is
+expressed as a length of time, for example '90 days' or '3 months'.
+It defaults to '90 days'.
+
+The optional configuration variable 'gc.reflogExpireUnreachable'
+can be set to indicate how long historical reflog entries which
+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
+are not part of the current project most users will want to expire
+them sooner.  This option defaults to '30 days'.
+
+The optional configuration variable 'gc.rerereresolved' indicates
+how long records of conflicted merge you resolved earlier are
+kept.  This defaults to 60 days.
+
+The optional configuration variable 'gc.rerereunresolved' indicates
+how long records of conflicted merge you have not resolved are
+kept.  This defaults to 15 days.
+
+
+See Also
+--------
+gitlink:git-prune[1]
+gitlink:git-reflog[1]
+gitlink:git-repack[1]
+gitlink:git-rerere[1]
+
+Author
+------
+Written by Shawn O. Pearce <spearce@spearce.org>
+
+GIT
+---
+Part of the gitlink:git[7] suite
index e2954aa76eef46101f38683eb346bd31bf711a40..0f79665ea6e6bf1ffd4ff67f7aee2fcbddec0555 100644 (file)
@@ -10,7 +10,6 @@ SYNOPSIS
 --------
 [verse]
 'git-merge' [-n] [--no-commit] [--squash] [-s <strategy>]...
-       [--reflog-action=<action>]
        -m=<msg> <remote> <remote>...
 
 DESCRIPTION
@@ -37,11 +36,6 @@ include::merge-options.txt[]
        least one <remote>.  Specifying more than one <remote>
        obviously means you are trying an Octopus.
 
---reflog-action=<action>::
-       This is used internally when `git-pull` calls this command
-       to record that the merge was created by `pull` command
-       in the `ref-log` entry that results from the merge.
-
 include::merge-strategies.txt[]
 
 
diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt
new file mode 100644 (file)
index 0000000..55a24d3
--- /dev/null
@@ -0,0 +1,59 @@
+git-reflog(1)
+=============
+
+NAME
+----
+git-reflog - Manage reflog information
+
+
+SYNOPSIS
+--------
+[verse]
+'git-reflog' expire [--dry-run]
+       [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...
+
+
+DESCRIPTION
+-----------
+
+Reflog is a mechanism to record when the tip of branches are
+updated.  This command is to manage the information recorded in it.
+
+The subcommand "expire" is used to prune older reflog entries.
+Entries older than `expire` time, or entries older than
+`expire-unreachable` time and are not reachable from the current
+tip, are removed from the reflog.  This is typically not used
+directly by the end users -- instead, see gitlink:git-gc[1].
+
+
+
+OPTIONS
+-------
+
+--expire=<time>::
+       Entries older than this time are pruned.  Without the
+       option it is taken from configuration `gc.reflogExpire`,
+       which in turn defaults to 90 days.
+
+--expire-unreachable=<time>::
+       Entries older than this time and are not reachable from
+       the current tip of the branch are pruned.  Without the
+       option it is taken from configuration
+       `gc.reflogExpireUnreachable`, which in turn defaults to
+       30 days.
+
+--all::
+       Instead of listing <refs> explicitly, prune all refs.
+
+Author
+------
+Written by Junio C Hamano <junkio@cox.net>
+
+Documentation
+--------------
+Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
index 116dca4c0668488a0ba55b43a10e89c40f087b59..b57a72bdd776c2ecd38adeb97497a3b19be704e7 100644 (file)
@@ -7,7 +7,7 @@ git-rerere - Reuse recorded resolve
 
 SYNOPSIS
 --------
-'git-rerere' [clear|diff|status]
+'git-rerere' [clear|diff|status|gc]
 
 DESCRIPTION
 -----------
@@ -55,7 +55,11 @@ for resolutions.
 'gc'::
 
 This command is used to prune records of conflicted merge that
-occurred long time ago.
+occurred long time ago.  By default, conflicts older than 15
+days that you have not recorded their resolution, and conflicts
+older than 60 days, are pruned.  These are controlled with
+`gc.rerereunresolved` and `gc.rerereresolved` configuration
+variables.
 
 
 DISCUSSION
index 2a9e97dac1e2c21a8a4aa7a6501a054fcefbef35..36b2126d847bf86f9efe5bdb1ce88acef9046633 100644 (file)
@@ -212,6 +212,9 @@ gitlink:git-cvsexportcommit[1]::
 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.
 
@@ -224,6 +227,9 @@ gitlink:git-prune[1]::
 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.
 
index c21b91bfab2e8665be728593c64352137c857fd4..544385f3e38727ab59b531978d63aaf5ee119712 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -157,7 +157,7 @@ BASIC_LDFLAGS =
 SCRIPT_SH = \
        git-bisect.sh git-checkout.sh \
        git-clean.sh git-clone.sh git-commit.sh \
-       git-fetch.sh \
+       git-fetch.sh git-gc.sh \
        git-ls-remote.sh \
        git-merge-one-file.sh git-parse-remote.sh \
        git-pull.sh git-rebase.sh \
@@ -359,8 +359,8 @@ ifeq ($(uname_O),Cygwin)
        NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
        # There are conflicting reports about this.
        # On some boxes NO_MMAP is needed, and not so elsewhere.
-       # Try uncommenting this if you see things break -- YMMV.
-       NO_MMAP = YesPlease
+       # Try commenting this out if you suspect MMAP is more efficient
+       NO_MMAP = YesPlease
        NO_IPV6 = YesPlease
        X = .exe
 endif
index de31967b99e89e21fe0ddd6aaacb17364d6f3a4b..d3f2f50d2bc7b4ef0f0e4801c70c5a15ff869f1f 100644 (file)
@@ -5,6 +5,9 @@
 #include "dir.h"
 #include "tree-walk.h"
 
+static unsigned long default_reflog_expire;
+static unsigned long default_reflog_expire_unreachable;
+
 struct expire_reflog_cb {
        FILE *newlog;
        const char *ref;
@@ -150,6 +153,17 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
        return status;
 }
 
+static int reflog_expire_config(const char *var, const char *value)
+{
+       if (!strcmp(var, "gc.reflogexpire"))
+               default_reflog_expire = approxidate(value);
+       else if (!strcmp(var, "gc.reflogexpireunreachable"))
+               default_reflog_expire_unreachable = approxidate(value);
+       else
+               return git_default_config(var, value);
+       return 0;
+}
+
 static const char reflog_expire_usage[] =
 "git-reflog expire [--dry-run] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
 
@@ -159,11 +173,18 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
        unsigned long now = time(NULL);
        int i, status, do_all;
 
+       git_config(reflog_expire_config);
+
        save_commit_buffer = 0;
        do_all = status = 0;
        memset(&cb, 0, sizeof(cb));
-       cb.expire_total = now - 90 * 24 * 3600;
-       cb.expire_unreachable = now - 30 * 24 * 3600;
+
+       if (!default_reflog_expire_unreachable)
+               default_reflog_expire_unreachable = now - 30 * 24 * 3600;
+       if (!default_reflog_expire)
+               default_reflog_expire = now - 90 * 24 * 3600;
+       cb.expire_total = default_reflog_expire;
+       cb.expire_unreachable = default_reflog_expire_unreachable;
 
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];
index d064bd8bf0218feb7d4ad01b39be6a143757499e..7442498deedfef1f6be9e550f3c0259aaa82e0ba 100644 (file)
@@ -362,6 +362,17 @@ static int do_plain_rerere(struct path_list *rr, int fd)
        return write_rr(rr, fd);
 }
 
+static int git_rerere_config(const char *var, const char *value)
+{
+       if (!strcmp(var, "gc.rerereresolved"))
+               cutoff_resolve = git_config_int(var, value);
+       else if (!strcmp(var, "gc.rerereunresolved"))
+               cutoff_noresolve = git_config_int(var, value);
+       else
+               return git_default_config(var, value);
+       return 0;
+}
+
 int cmd_rerere(int argc, const char **argv, const char *prefix)
 {
        struct path_list merge_rr = { NULL, 0, 0, 1 };
@@ -371,6 +382,8 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
        if (stat(git_path("rr-cache"), &st) || !S_ISDIR(st.st_mode))
                return 0;
 
+       git_config(git_rerere_config);
+
        merge_rr_path = xstrdup(git_path("rr-cache/MERGE_RR"));
        fd = hold_lock_file_for_update(&write_lock, merge_rr_path, 1);
        read_rr(&merge_rr);
index 0126a77b924e7f1fe7f3913b84350ab35e6e043a..c3bbd78eabf6f3d5eaa0f31bb0c240a26f28e0c5 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -6,6 +6,7 @@ USAGE='[--signoff] [--dotest=<dir>] [--utf8] [--binary] [--3way]
   [--interactive] [--whitespace=<option>] <mbox>...
   or, when resuming [--skip | --resolved]'
 . git-sh-setup
+set_reflog_action am
 
 git var GIT_COMMITTER_IDENT >/dev/null || exit
 
@@ -101,7 +102,6 @@ It does not apply to blobs recorded in its index."
 }
 
 prec=4
-rloga=am
 dotest=.dotest sign= utf8= keep= skip= interactive= resolved= binary= ws= resolvemsg=
 
 while case "$#" in 0) break;; esac
@@ -141,9 +141,6 @@ do
        --resolvemsg=*)
        resolvemsg=$(echo "$1" | sed -e "s/^--resolvemsg=//"); shift ;;
 
-       --reflog-action=*)
-       rloga=`expr "z$1" : 'z-[^=]*=\(.*\)'`; shift ;;
-
        --)
        shift; break ;;
        -*)
@@ -452,7 +449,7 @@ do
        parent=$(git-rev-parse --verify HEAD) &&
        commit=$(git-commit-tree $tree -p $parent <"$dotest/final-commit") &&
        echo Committed: $commit &&
-       git-update-ref -m "$rloga: $SUBJECT" HEAD $commit $parent ||
+       git-update-ref -m "$GIT_REFLOG_ACTION: $SUBJECT" HEAD $commit $parent ||
        stop_here $this
 
        if test -x "$GIT_DIR"/hooks/post-applypatch
index 5f316053fb9ad146546ed0718cc98b772c48b07f..8bd11f8b60c0ffec8a67f59bc7e12e1f63adfc91 100755 (executable)
@@ -4,6 +4,8 @@
 USAGE='<fetch-options> <repository> <refspec>...'
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
+set_reflog_action "fetch $*"
+
 TOP=$(git-rev-parse --show-cdup)
 if test ! -z "$TOP"
 then
@@ -17,7 +19,6 @@ LF='
 '
 IFS="$LF"
 
-rloga=fetch
 no_tags=
 tags=
 append=
@@ -60,9 +61,6 @@ do
        -k|--k|--ke|--kee|--keep)
                keep='-k -k'
                ;;
-       --reflog-action=*)
-               rloga=`expr "z$1" : 'z-[^=]*=\(.*\)'`
-               ;;
        --depth=*)
                shallow_depth="--depth=`expr "z$1" : 'z-[^=]*=\(.*\)'`"
                ;;
@@ -94,9 +92,6 @@ refs=
 rref=
 rsync_slurped_objects=
 
-rloga="$rloga $remote_nick"
-test "$remote_nick" = "$remote" || rloga="$rloga $remote"
-
 if test "" = "$append"
 then
        : >"$GIT_DIR/FETCH_HEAD"
@@ -180,12 +175,12 @@ update_local_ref () {
                else
                        echo >&2 "* $1: updating with $3"
                        echo >&2 "  $label_: $newshort_"
-                       git-update-ref -m "$rloga: updating tag" "$1" "$2"
+                       git-update-ref -m "$GIT_REFLOG_ACTION: updating tag" "$1" "$2"
                fi
        else
                echo >&2 "* $1: storing $3"
                echo >&2 "  $label_: $newshort_"
-               git-update-ref -m "$rloga: storing tag" "$1" "$2"
+               git-update-ref -m "$GIT_REFLOG_ACTION: storing tag" "$1" "$2"
        fi
        ;;
 
@@ -208,7 +203,7 @@ update_local_ref () {
            *,$local)
                echo >&2 "* $1: fast forward to $3"
                echo >&2 "  old..new: $oldshort_..$newshort_"
-               git-update-ref -m "$rloga: fast-forward" "$1" "$2" "$local"
+               git-update-ref -m "$GIT_REFLOG_ACTION: fast-forward" "$1" "$2" "$local"
                ;;
            *)
                false
@@ -218,7 +213,7 @@ update_local_ref () {
                *,t,*)
                        echo >&2 "* $1: forcing update to non-fast forward $3"
                        echo >&2 "  old...new: $oldshort_...$newshort_"
-                       git-update-ref -m "$rloga: forced-update" "$1" "$2" "$local"
+                       git-update-ref -m "$GIT_REFLOG_ACTION: forced-update" "$1" "$2" "$local"
                        ;;
                *)
                        echo >&2 "* $1: not updating to non-fast forward $3"
@@ -230,7 +225,7 @@ update_local_ref () {
        else
            echo >&2 "* $1: storing $3"
            echo >&2 "  $label_: $newshort_"
-           git-update-ref -m "$rloga: storing head" "$1" "$2"
+           git-update-ref -m "$GIT_REFLOG_ACTION: storing head" "$1" "$2"
        fi
        ;;
     esac
@@ -479,7 +474,7 @@ case "$orig_head" in
        if test "$curr_head" != "$orig_head"
        then
            git-update-ref \
-                       -m "$rloga: Undoing incorrectly fetched HEAD." \
+                       -m "$GIT_REFLOG_ACTION: Undoing incorrectly fetched HEAD." \
                        HEAD "$orig_head"
                die "Cannot fetch into the current branch."
        fi
diff --git a/git-gc.sh b/git-gc.sh
new file mode 100755 (executable)
index 0000000..6de55f7
--- /dev/null
+++ b/git-gc.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# Copyright (c) 2006, Shawn O. Pearce
+#
+# Cleanup unreachable files and optimize the repository.
+
+USAGE=''
+SUBDIRECTORY_OK=Yes
+. git-sh-setup
+
+git-pack-refs --prune &&
+git-reflog expire --all &&
+git-repack -a -d -l &&
+git-prune &&
+git-rerere gc || exit
index 7dd0a112368a8b3672a98fdfcdb5290146cefeba..ba42260426296b63070a1fbdc22a9b77ea5ac412 100755 (executable)
@@ -3,9 +3,10 @@
 # Copyright (c) 2005 Junio C Hamano
 #
 
-USAGE='[-n] [--no-commit] [--squash] [-s <strategy>] [--reflog-action=<action>] [-m=<merge-message>] <commit>+'
+USAGE='[-n] [--no-commit] [--squash] [-s <strategy>] [-m=<merge-message>] <commit>+'
 
 . git-sh-setup
+set_reflog_action "merge $*"
 
 LF='
 '
@@ -57,10 +58,10 @@ squash_message () {
 finish () {
        if test '' = "$2"
        then
-               rlogm="$rloga"
+               rlogm="$GIT_REFLOG_ACTION"
        else
                echo "$2"
-               rlogm="$rloga: $2"
+               rlogm="$GIT_REFLOG_ACTION: $2"
        fi
        case "$squash" in
        t)
@@ -109,7 +110,7 @@ merge_name () {
 
 case "$#" in 0) usage ;; esac
 
-rloga= have_message=
+have_message=
 while case "$#" in 0) break ;; esac
 do
        case "$1" in
@@ -139,9 +140,6 @@ do
                        die "available strategies are: $all_strategies" ;;
                esac
                ;;
-       --reflog-action=*)
-               rloga=`expr "z$1" : 'z-[^=]*=\(.*\)'`
-               ;;
        -m=*|--m=*|--me=*|--mes=*|--mess=*|--messa=*|--messag=*|--message=*)
                merge_msg=`expr "z$1" : 'z-[^=]*=\(.*\)'`
                have_message=t
@@ -213,7 +211,6 @@ head=$(git-rev-parse --verify "$head_arg"^0) || usage
 
 # All the rest are remote heads
 test "$#" = 0 && usage ;# we need at least one remote head.
-test "$rloga" = '' && rloga="merge: $@"
 
 remoteheads=
 for remote
@@ -230,9 +227,21 @@ case "$use_strategies" in
 '')
        case "$#" in
        1)
-               use_strategies="$default_twohead_strategies" ;;
+               var="`git-repo-config --get pull.twohead`"
+               if test -n "$var"
+               then
+                       use_strategies="$var"
+               else
+                       use_strategies="$default_twohead_strategies"
+               fi ;;
        *)
-               use_strategies="$default_octopus_strategies" ;;
+               var="`git-repo-config --get pull.octopus`"
+               if test -n "$var"
+               then
+                       use_strategies="$var"
+               else
+                       use_strategies="$default_octopus_strategies"
+               fi ;;
        esac
        ;;
 esac
index 1703091bbb988e22f39b2c8d4c70ec7340a2f109..28d08195f0c84b7f3a89a5c5cff9945bb64ddfb3 100755 (executable)
@@ -7,6 +7,7 @@
 USAGE='[-n | --no-summary] [--no-commit] [-s strategy]... [<fetch-options>] <repo> <head>...'
 LONG_USAGE='Fetch one or more remote refs and merge it/them into the current HEAD.'
 . git-sh-setup
+set_reflog_action "pull $*"
 
 strategy_args= no_summary= no_commit= squash=
 while case "$#,$1" in 0) break ;; *,-*) ;; *) break ;; esac
@@ -45,7 +46,7 @@ do
 done
 
 orig_head=$(git-rev-parse --verify HEAD 2>/dev/null)
-git-fetch --update-head-ok --reflog-action=pull "$@" || exit 1
+git-fetch --update-head-ok "$@" || exit 1
 
 curr_head=$(git-rev-parse --verify HEAD 2>/dev/null)
 if test "$curr_head" != "$orig_head"
@@ -89,18 +90,6 @@ case "$merge_head" in
                echo >&2 "Cannot merge multiple branches into empty head"
                exit 1
        fi
-       var=`git-repo-config --get pull.octopus`
-       if test -n "$var"
-       then
-               strategy_default_args="-s $var"
-       fi
-       ;;
-*)
-       var=`git-repo-config --get pull.twohead`
-       if test -n "$var"
-        then
-               strategy_default_args="-s $var"
-       fi
        ;;
 esac
 
@@ -111,13 +100,6 @@ then
        exit
 fi
 
-case "$strategy_args" in
-'')
-       strategy_args=$strategy_default_args
-       ;;
-esac
-
 merge_name=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit
-git-merge "--reflog-action=pull $*" \
-       $no_summary $no_commit $squash $strategy_args \
+exec git-merge $no_summary $no_commit $squash $strategy_args \
        "$merge_name" HEAD $merge_head
index ece31425d08a7fc2758b769afac65c37956d20cb..828c59ce61a8317f23ba9113e4de6e09a58e70ce 100755 (executable)
@@ -28,6 +28,7 @@ Example:       git-rebase master~1 topic
   D---E---F---G master          D---E---F---G master
 '
 . git-sh-setup
+set_reflog_action rebase
 
 RESOLVEMSG="
 When you have resolved this problem run \"git rebase --continue\".
@@ -80,10 +81,18 @@ continue_merge () {
 call_merge () {
        cmt="$(cat $dotest/cmt.$1)"
        echo "$cmt" > "$dotest/current"
-       git-merge-$strategy "$cmt^" -- HEAD "$cmt"
+       hd=$(git-rev-parse --verify HEAD)
+       cmt_name=$(git-symbolic-ref HEAD)
+       msgnum=$(cat $dotest/msgnum)
+       end=$(cat $dotest/end)
+       eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"'
+       eval GITHEAD_$hd='"$(cat $dotest/onto_name)"'
+       export GITHEAD_$cmt GITHEAD_$hd
+       git-merge-$strategy "$cmt^" -- "$hd" "$cmt"
        rv=$?
        case "$rv" in
        0)
+               unset GITHEAD_$cmt GITHEAD_$hd
                return
                ;;
        1)
@@ -132,8 +141,7 @@ do
                        finish_rb_merge
                        exit
                fi
-               git am --resolved --3way --resolvemsg="$RESOLVEMSG" \
-                       --reflog-action=rebase
+               git am --resolved --3way --resolvemsg="$RESOLVEMSG"
                exit
                ;;
        --skip)
@@ -156,8 +164,7 @@ do
                        finish_rb_merge
                        exit
                fi
-               git am -3 --skip --resolvemsg="$RESOLVEMSG" \
-                       --reflog-action=rebase
+               git am -3 --skip --resolvemsg="$RESOLVEMSG"
                exit
                ;;
        --abort)
@@ -306,8 +313,7 @@ fi
 if test -z "$do_merge"
 then
        git-format-patch -k --stdout --full-index --ignore-if-in-upstream "$upstream"..ORIG_HEAD |
-       git am --binary -3 -k --resolvemsg="$RESOLVEMSG" \
-               --reflog-action=rebase
+       git am --binary -3 -k --resolvemsg="$RESOLVEMSG"
        exit $?
 fi
 
@@ -316,6 +322,7 @@ fi
 
 mkdir -p "$dotest"
 echo "$onto" > "$dotest/onto"
+echo "$onto_name" > "$dotest/onto_name"
 prev_head=`git-rev-parse HEAD^0`
 echo "$prev_head" > "$dotest/prev_head"
 
index 2379db082f956e68a360cfbd667761490ecad5dd..a9693701a34dac623fcddb1943ffe326bdb05405 100755 (executable)
@@ -5,6 +5,7 @@
 USAGE='[--mixed | --soft | --hard]  [<commit-ish>] [ [--] <paths>...]'
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
+set_reflog_action "reset $*"
 
 update= reset_type=--mixed
 unset rev
@@ -81,7 +82,7 @@ then
 else
        rm -f "$GIT_DIR/ORIG_HEAD"
 fi
-git-update-ref -m "reset $reset_type $*" HEAD "$rev"
+git-update-ref -m "$GIT_REFLOG_ACTION" HEAD "$rev"
 update_ref_status=$?
 
 case "$reset_type" in
index 4c87c20c158fe3edfd0b770f1855e67e20038e3b..ba39d393843733b46f309deb105c90cabcee2cb1 100755 (executable)
@@ -178,11 +178,10 @@ sub format_2822_time {
 if (!defined $from) {
        $from = $author || $committer;
        do {
-               $_ = $term->readline("Who should the emails appear to be from? ",
-                       $from);
+               $_ = $term->readline("Who should the emails appear to be from? [$from] ");
        } while (!defined $_);
 
-       $from = $_;
+       $from = $_ if ($_);
        print "Emails will be sent from: ", $from, "\n";
        $prompting++;
 }
index 42f9b1c125578a7158392b53ec8792d6c6bbb273..87b939c0e4857ec9c9245c01f609a059788f656a 100755 (executable)
@@ -20,6 +20,14 @@ usage() {
        die "Usage: $0 $USAGE"
 }
 
+set_reflog_action() {
+       if [ -z "${GIT_REFLOG_ACTION:+set}" ]
+       then
+               GIT_REFLOG_ACTION="$*"
+               export GIT_REFLOG_ACTION
+       fi
+}
+
 if [ -z "$LONG_USAGE" ]
 then
        LONG_USAGE="Usage: $0 $USAGE"
index 65fcdb0f289c21b0824546884d826b48586ca712..d845e91e202233916a91a7095e4a81142687c9c7 100755 (executable)
 use File::Basename qw(basename);
 binmode STDOUT, ':utf8';
 
+BEGIN {
+       CGI->compile() if $ENV{MOD_PERL};
+}
+
 our $cgi = new CGI;
 our $version = "++GIT_VERSION++";
 our $my_url = $cgi->url();
@@ -1271,7 +1275,7 @@ sub parse_tag {
 }
 
 sub parse_commit_text {
-       my ($commit_text) = @_;
+       my ($commit_text, $withparents) = @_;
        my @commit_lines = split '\n', $commit_text;
        my %co;
 
@@ -1281,13 +1285,12 @@ sub parse_commit_text {
        if (!($header =~ m/^[0-9a-fA-F]{40}/)) {
                return;
        }
-       $co{'id'} = $header;
-       my @parents;
+       ($co{'id'}, my @parents) = split ' ', $header;
        while (my $line = shift @commit_lines) {
                last if $line eq "\n";
                if ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
                        $co{'tree'} = $1;
-               } elsif ($line =~ m/^parent ([0-9a-fA-F]{40})$/) {
+               } elsif ((!defined $withparents) && ($line =~ m/^parent ([0-9a-fA-F]{40})$/)) {
                        push @parents, $1;
                } elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
                        $co{'author'} = $1;
@@ -1373,12 +1376,13 @@ sub parse_commit {
        local $/ = "\0";
 
        open my $fd, "-|", git_cmd(), "rev-list",
+               "--parents",
                "--header",
                "--max-count=1",
                $commit_id,
                "--",
                or die_error(undef, "Open git-rev-list failed");
-       %co = parse_commit_text(<$fd>);
+       %co = parse_commit_text(<$fd>, 1);
        close $fd;
 
        return %co;
@@ -1711,6 +1715,7 @@ sub git_header_html {
        }
        print $cgi->header(-type=>$content_type, -charset => 'utf-8',
                           -status=> $status, -expires => $expires);
+       my $mod_perl_version = $ENV{'MOD_PERL'} ? " $ENV{'MOD_PERL'}" : '';
        print <<EOF;
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -1719,7 +1724,7 @@ sub git_header_html {
 <!-- git core binaries version $git_version -->
 <head>
 <meta http-equiv="content-type" content="$content_type; charset=utf-8"/>
-<meta name="generator" content="gitweb/$version git/$git_version"/>
+<meta name="generator" content="gitweb/$version git/$git_version$mod_perl_version"/>
 <meta name="robots" content="index, nofollow"/>
 <title>$title</title>
 EOF