From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: [PATCH 1/4] Move check_base() shell function to git-sh-setup
Date: Sun, 08 Apr 2007 23:13:33 -0700 [thread overview]
Message-ID: <7v3b3a5b3m.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 7vps6e5b93.fsf_-_@assigned-by-dhcp.cox.net
The scripts that attempt to make a commit on top of the current
HEAD need to use the same logic in check_base() to make sure the
current index is based on the HEAD commit we are going to build
on top of. Move this function from git-commit to git-sh-setup,
so that it is available to everybody else.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
git-commit.sh | 16 ----------------
git-sh-setup.sh | 16 ++++++++++++++++
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/git-commit.sh b/git-commit.sh
index 42f1c93..6b4c784 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -25,22 +25,6 @@ refuse_partial () {
exit 1
}
-check_base () {
- quiet="$1"
- if HEAD=`git rev-parse --verify HEAD 2>/dev/null` &&
- BASE=`git update-index --get-base` &&
- test -n "$BASE" &&
- test "$BASE" != "$HEAD"
- then
- test -z "$quiet" || exit 1
- ours=`git show -s --pretty=oneline --abbrev-commit $BASE`
- theirs=`git show -s --pretty=oneline --abbrev-commit $HEAD`
- echo >&2 "* The index is based on '$ours', however, the HEAD"
- echo >&2 " points at different commit '$theirs'"
- exit 1
- fi
-}
-
THIS_INDEX="$GIT_DIR/index"
NEXT_INDEX="$GIT_DIR/next-index$$"
rm -f "$NEXT_INDEX"
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index f24c7f2..0797acd 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -28,6 +28,22 @@ set_reflog_action() {
fi
}
+check_base () {
+ quiet="$1"
+ if HEAD=`git rev-parse --verify HEAD 2>/dev/null` &&
+ BASE=`git update-index --get-base` &&
+ test -n "$BASE" &&
+ test "$BASE" != "$HEAD"
+ then
+ test -z "$quiet" || exit 1
+ ours=`git show -s --pretty=oneline --abbrev-commit $BASE`
+ theirs=`git show -s --pretty=oneline --abbrev-commit $HEAD`
+ echo >&2 "* The index is based on '$ours', however, the HEAD"
+ echo >&2 " points at different commit '$theirs'"
+ exit 1
+ fi
+}
+
is_bare_repository () {
git-config --bool --get core.bare ||
case "$GIT_DIR" in
--
1.5.1.730.g0d43be
next prev parent reply other threads:[~2007-04-09 6:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-03 5:41 What's cooking in git.git (topics) Junio C Hamano
2007-04-05 7:03 ` Junio C Hamano
2007-04-09 6:10 ` The index is based on blah, however, the HEAD points at different commit Junio C Hamano
2007-04-09 6:13 ` Junio C Hamano [this message]
2007-04-09 6:13 ` [PATCH 2/4] Use BASE index extension in git-am Junio C Hamano
2007-04-09 6:13 ` [PATCH 3/4] git-read-tree --set-base=<commit> Junio C Hamano
2007-04-09 6:13 ` [PATCH 4/4] Teach git-reset to use index BASE extension Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v3b3a5b3m.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.