提交 07cdbb35 编写于 作者: H H. Peter Anvin
......@@ -9,7 +9,7 @@
unset CDPATH
usage() {
echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] <repo> <dir>"
echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> <dir>"
exit 1
}
......@@ -61,10 +61,12 @@ Perhaps git-update-server-info needs to be run there?"
quiet=
use_local=no
local_shared=no
no_checkout=
upload_pack=
while
case "$#,$1" in
0,*) break ;;
*,-n) no_checkout=yes ;;
*,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;
*,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared)
local_shared=yes ;;
......@@ -186,9 +188,16 @@ yes,yes)
;;
esac
# Update origin.
mkdir -p "$D/.git/remotes/" &&
rm -f "$D/.git/remotes/origin" &&
echo >"$D/.git/remotes/origin" \
"URL: $repo
cd $D || exit
if test -f ".git/HEAD"
then
mkdir -p .git/remotes || exit
echo >.git/remotes/origin \
"URL: $repo
Pull: master:origin"
case "$no_checkout" in
'')
git checkout
esac
fi
......@@ -141,6 +141,9 @@ t)
esac
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
test -f "$GIT_DIR/MERGE_MSG" && cat "$GIT_DIR/MERGE_MSG"
echo "#"
echo "# It looks like your may be committing a MERGE."
echo "# If this is not correct, please remove the file"
......
......@@ -9,7 +9,7 @@ URL: http://kernel.org/pub/software/scm/git/
Source: http://kernel.org/pub/software/scm/git/%{name}-%{version}.tar.gz
BuildRequires: zlib-devel, openssl-devel, curl-devel %{!?_without_docs:, xmlto, asciidoc > 6.0.3}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: rsync, rcs, curl, less, openssh-clients, python >= 2.3, tk
Requires: rsync, rcs, curl, less, openssh-clients, python >= 2.3, tk >= 8.4
%description
This is a stupid (but extremely fast) directory content manager. It
......
......@@ -178,7 +178,7 @@ do
head=$(curl -nsf $curl_extra_args "$remote/$remote_name") &&
expr "$head" : "$_x40\$" >/dev/null ||
die "Failed to fetch $remote_name from $remote"
echo Fetching "$remote_name from $remote" using http
echo >&2 Fetching "$remote_name from $remote" using http
git-http-fetch -v -a "$head" "$remote/" || exit
;;
rsync://*)
......
......@@ -18,8 +18,22 @@ all_strategies='recursive octopus resolve stupid'
default_strategies='resolve octopus'
use_strategies=
dropheads() {
rm -f -- "$GIT_DIR/MERGE_HEAD" || exit 1
dropsave() {
rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
"$GIT_DIR/MERGE_SAVE" || exit 1
}
savestate() {
git diff -r -z --name-only $head | cpio -0 -o >"$GIR_DIR/MERGE_SAVE"
}
restorestate() {
if test -f "$GIT_DIR/MERGE_SAVE"
then
git reset --hard $head
cpio -iuv <"$GIT_DIR/MERGE_SAVE"
git-update-index --refresh >/dev/null
fi
}
summary() {
......@@ -93,7 +107,7 @@ case "$#,$common" in
# If head can reach all the merge then we are up to date.
# but first the most common case of merging one remote
echo "Already up-to-date. Yeeah!"
dropheads
dropsave
exit 0
;;
1,"$head")
......@@ -103,7 +117,7 @@ case "$#,$common" in
git-read-tree -u -m $head "$1" || exit 1
git-rev-parse --verify "$1^0" > "$GIT_DIR/HEAD"
summary "$1"
dropheads
dropsave
exit 0
;;
1,*)
......@@ -125,30 +139,52 @@ case "$#,$common" in
if test "$up_to_date" = t
then
echo "Already up-to-date. Yeeah!"
dropheads
dropsave
exit 0
fi
;;
esac
# At this point we need a real merge. Require that the tree matches
# exactly our head.
# At this point, we need a real merge. No matter what strategy
# we use, it would operate on the index, possibly affecting the
# working tree, and when resolved cleanly, have the desired tree
# in the index -- this means that the index must be in sync with
# the $head commit.
files=$(git-diff-index --cached --name-only $head) || exit
if [ "$files" ]; then
echo >&2 "Dirty index: cannot merge (dirty: $files)"
exit 1
fi
git-update-index --refresh &&
test '' = "`git-diff-index --cached --name-only $head`" || {
die "Need real merge but the working tree has local changes."
}
case "$use_strategies" in
?*' '?*)
# Stash away the local changes so that we can try more than one.
savestate
single_strategy=no
;;
*)
rm -f "$GIT_DIR/MERGE_SAVE"
single_strategy=yes
;;
esac
result_tree= best_cnt=-1 best_strategy= wt_strategy=
for strategy in $use_strategies
do
test "$wt_strategy" = '' || {
echo "Rewinding the tree to pristine..."
git reset --hard $head
restorestate
}
echo "Trying merge strategy $strategy..."
case "$single_strategy" in
no)
echo "Trying merge strategy $strategy..."
;;
esac
# Remember which strategy left the state in the working tree
wt_strategy=$strategy
git-merge-$strategy $common -- $head_arg "$@" || {
git-merge-$strategy $common -- "$head_arg" "$@" || {
# The backend exits with 1 when conflicts are left to be resolved,
# with 2 when it does not handle the given merge at all.
......@@ -186,14 +222,14 @@ then
echo "Committed merge $result_commit, made by $wt_strategy."
echo $result_commit >"$GIT_DIR/HEAD"
summary $result_commit
dropheads
dropsave
exit 0
fi
# Pick the result from the best strategy and have the user fix it up.
case "$best_strategy" in
'')
git reset --hard $head
restorestate
die "No merge strategy handled the merge."
;;
"$wt_strategy")
......@@ -201,13 +237,15 @@ case "$best_strategy" in
;;
*)
echo "Rewinding the tree to pristine..."
git reset --hard $head
restorestate
echo "Using the $best_strategy to prepare resolving by hand."
git-merge-$best_strategy $common -- $head_arg "$@"
git-merge-$best_strategy $common -- "$head_arg" "$@"
;;
esac
for remote
do
echo $remote
done >"$GIT_DIR/MERGE_HEAD"
echo $merge_msg >"$GIT_DIR/MERGE_MSG"
die "Automatic merge failed; fix up by hand"
......@@ -56,9 +56,12 @@ t)
die "Your index file is unmerged."
;;
*)
check_clean_tree || die "Cannot run $me from a dirty tree."
head=$(git-rev-parse --verify HEAD) ||
die "You do not have a valid HEAD"
files=$(git-diff-index --cached --name-only $head) || exit
if [ "$files" ]; then
die "Dirty index: cannot $me (dirty: $files)"
fi
;;
esac
......
......@@ -17,17 +17,6 @@ die() {
exit 1
}
check_clean_tree() {
dirty1_=`git-update-index -q --refresh` && {
dirty2_=`git-diff-index --name-only --cached HEAD`
case "$dirty2_" in '') : ;; *) (exit 1) ;; esac
} || {
echo >&2 "$dirty1_"
echo "$dirty2_" | sed >&2 -e 's/^/modified: /'
(exit 1)
}
}
[ -h "$GIT_DIR/HEAD" ] &&
[ -d "$GIT_DIR/refs" ] &&
[ -d "$GIT_OBJECT_DIRECTORY/00" ]
#!/bin/sh
# Tcl ignores the next line -*- tcl -*- \
exec wish "$0" -- "${1+$@}"
exec wish "$0" -- "$@"
# Copyright (C) 2005 Paul Mackerras. All rights reserved.
# This program is free software; it may be used, copied, modified
......@@ -486,6 +486,8 @@ proc makewindow {} {
bindall <B2-Motion> "allcanvs scan dragto 0 %y"
bind . <Key-Up> "selnextline -1"
bind . <Key-Down> "selnextline 1"
bind . <Key-Right> "goforw"
bind . <Key-Left> "goback"
bind . <Key-Prior> "allcanvs yview scroll -1 pages"
bind . <Key-Next> "allcanvs yview scroll 1 pages"
bindkey <Key-Delete> "$ctext yview scroll -1 pages"
......@@ -493,6 +495,12 @@ proc makewindow {} {
bindkey <Key-space> "$ctext yview scroll 1 pages"
bindkey p "selnextline -1"
bindkey n "selnextline 1"
bindkey z "goback"
bindkey x "goforw"
bindkey i "selnextline -1"
bindkey k "selnextline 1"
bindkey j "goback"
bindkey l "goforw"
bindkey b "$ctext yview scroll -1 pages"
bindkey d "$ctext yview scroll 18 units"
bindkey u "$ctext yview scroll -18 units"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册