summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Documentation/config.txt19
-rw-r--r--Documentation/everyday.txt9
-rw-r--r--Documentation/git-gc.txt64
-rw-r--r--Documentation/git-merge.txt6
-rw-r--r--Documentation/git-reflog.txt59
-rw-r--r--Documentation/git-rerere.txt8
-rw-r--r--Documentation/git.txt6
-rw-r--r--Makefile6
-rw-r--r--builtin-reflog.c25
-rw-r--r--builtin-rerere.c13
-rwxr-xr-xgit-am.sh7
-rwxr-xr-xgit-fetch.sh21
-rwxr-xr-xgit-gc.sh15
-rwxr-xr-xgit-merge.sh29
-rwxr-xr-xgit-pull.sh24
-rwxr-xr-xgit-rebase.sh21
-rwxr-xr-xgit-reset.sh3
-rwxr-xr-xgit-send-email.perl5
-rwxr-xr-xgit-sh-setup.sh8
-rwxr-xr-xgitweb/gitweb.perl17
21 files changed, 284 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore
index 60e5002bd5..2904f12349 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 22482d6a94..6452a8be14 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -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].
diff --git a/Documentation/everyday.txt b/Documentation/everyday.txt
index 5d17ace721..2105a3d2e7 100644
--- a/Documentation/everyday.txt
+++ b/Documentation/everyday.txt
@@ -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
index 0000000000..73d78c15e8
--- /dev/null
+++ b/Documentation/git-gc.txt
@@ -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
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index e2954aa76e..0f79665ea6 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -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
index 0000000000..55a24d3266
--- /dev/null
+++ b/Documentation/git-reflog.txt
@@ -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
+
diff --git a/Documentation/git-rerere.txt b/Documentation/git-rerere.txt
index 116dca4c06..b57a72bdd7 100644
--- a/Documentation/git-rerere.txt
+++ b/Documentation/git-rerere.txt
@@ -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
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 2a9e97dac1..36b2126d84 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -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.
diff --git a/Makefile b/Makefile
index c21b91bfab..544385f3e3 100644
--- 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
diff --git a/builtin-reflog.c b/builtin-reflog.c
index de31967b99..d3f2f50d2b 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -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];
diff --git a/builtin-rerere.c b/builtin-rerere.c
index d064bd8bf0..7442498dee 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -362,6 +362,17 @@ tail_optimization:
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);
diff --git a/git-am.sh b/git-am.sh
index 0126a77b92..c3bbd78eab 100755
--- 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
diff --git a/git-fetch.sh b/git-fetch.sh
index 5f316053fb..8bd11f8b60 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -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
index 0000000000..6de55f7292
--- /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
diff --git a/git-merge.sh b/git-merge.sh
index 7dd0a11236..ba42260426 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -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
diff --git a/git-pull.sh b/git-pull.sh
index 1703091bbb..28d08195f0 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -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
diff --git a/git-rebase.sh b/git-rebase.sh
index ece31425d0..828c59ce61 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -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"
diff --git a/git-reset.sh b/git-reset.sh
index 2379db082f..a9693701a3 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -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
diff --git a/git-send-email.perl b/git-send-email.perl
index 4c87c20c15..ba39d39384 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -178,11 +178,10 @@ my $prompting = 0;
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++;
}
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 42f9b1c125..87b939c0e4 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -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"
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 65fcdb0f28..d845e91e20 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -18,6 +18,10 @@ use File::Find qw();
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