summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-10-09 10:18:32 -0700
committerShawn O. Pearce <spearce@spearce.org>2008-10-09 10:18:32 -0700
commit635536488c3efcf8495333b6a94e3e33c36fc055 (patch)
treedbe59109f95a57e008933d56ab28e72c7ae410ec
parent749bc58c5eab5b6947d2c01e02d12320005eba99 (diff)
parent44c33a5b9603fba7c9556512a72e4e392ba4ae2d (diff)
downloadgit-635536488c3efcf8495333b6a94e3e33c36fc055.tar.gz
Merge branch 'maint'
* maint: builtin-apply: fix typo leading to stack corruption git-stash.sh: fix flawed fix of invalid ref handling (commit da65e7c1) builtin-merge.c: allocate correct amount of memory Makefile: do not set NEEDS_LIBICONV for Solaris 8 rebase -i: remove leftover debugging rebase -i: proper prepare-commit-msg hook argument when squashing
-rw-r--r--Makefile1
-rw-r--r--builtin-apply.c2
-rw-r--r--builtin-merge.c4
-rwxr-xr-xgit-rebase--interactive.sh17
-rwxr-xr-xgit-stash.sh22
5 files changed, 18 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 15ca6599a7..dd31e339fb 100644
--- a/Makefile
+++ b/Makefile
@@ -650,7 +650,6 @@ ifeq ($(uname_S),SunOS)
NO_MKDTEMP = YesPlease
OLD_ICONV = UnfortunatelyYes
ifeq ($(uname_R),5.8)
- NEEDS_LIBICONV = YesPlease
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
NO_C99_FORMAT = YesPlease
diff --git a/builtin-apply.c b/builtin-apply.c
index 342f2fe5e6..bf80610506 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1697,7 +1697,7 @@ static int match_fragment(struct image *img,
fixlen = ws_fix_copy(buf, orig, oldlen, ws_rule, NULL);
/* Try fixing the line in the target */
- if (sizeof(tgtfixbuf) < tgtlen)
+ if (sizeof(tgtfixbuf) > tgtlen)
tgtfix = tgtfixbuf;
else
tgtfix = xmalloc(tgtlen);
diff --git a/builtin-merge.c b/builtin-merge.c
index dcf8987782..fa7c95472c 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -722,12 +722,12 @@ static void add_strategies(const char *string, unsigned attr)
static int merge_trivial(void)
{
unsigned char result_tree[20], result_commit[20];
- struct commit_list *parent = xmalloc(sizeof(struct commit_list *));
+ struct commit_list *parent = xmalloc(sizeof(*parent));
write_tree_trivial(result_tree);
printf("Wonderful.\n");
parent->item = lookup_commit(head);
- parent->next = xmalloc(sizeof(struct commit_list *));
+ parent->next = xmalloc(sizeof(*parent->next));
parent->next->item = remoteheads->item;
parent->next->next = NULL;
commit_tree(merge_msg.buf, result_tree, parent, result_commit, NULL);
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 3350f90cb1..bdec43c3f6 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -314,23 +314,28 @@ do_next () {
mark_action_done
make_squash_message $sha1 > "$MSG"
+ failed=f
+ author_script=$(get_author_ident_from_commit HEAD)
+ output git reset --soft HEAD^
+ pick_one -n $sha1 || failed=t
case "$(peek_next_command)" in
squash|s)
EDIT_COMMIT=
USE_OUTPUT=output
+ MSG_OPT=-F
+ MSG_FILE="$MSG"
cp "$MSG" "$SQUASH_MSG"
;;
*)
EDIT_COMMIT=-e
USE_OUTPUT=
+ MSG_OPT=
+ MSG_FILE=
rm -f "$SQUASH_MSG" || exit
+ cp "$MSG" "$GIT_DIR"/SQUASH_MSG
+ rm -f "$GIT_DIR"/MERGE_MSG || exit
;;
esac
-
- failed=f
- author_script=$(get_author_ident_from_commit HEAD)
- output git reset --soft HEAD^
- pick_one -n $sha1 || failed=t
echo "$author_script" > "$DOTEST"/author-script
if test $failed = f
then
@@ -339,7 +344,7 @@ do_next () {
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
- $USE_OUTPUT git commit --no-verify -F "$MSG" $EDIT_COMMIT || failed=t
+ $USE_OUTPUT git commit --no-verify $MSG_OPT "$MSG_FILE" $EDIT_COMMIT || failed=t
fi
if test $failed = t
then
diff --git a/git-stash.sh b/git-stash.sh
index 42f626f9d5..b9ace99704 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -145,16 +145,8 @@ show_stash () {
flags=--stat
fi
- if test $# = 0
- then
- set x "$ref_stash@{0}"
- shift
- fi
-
- s=$(git rev-parse --revs-only --no-flags "$@")
-
- w_commit=$(git rev-parse --verify "$s") &&
- b_commit=$(git rev-parse --verify "$s^") &&
+ w_commit=$(git rev-parse --verify --default $ref_stash "$@") &&
+ b_commit=$(git rev-parse --verify "$w_commit^") &&
git diff $flags $b_commit $w_commit
}
@@ -170,19 +162,13 @@ apply_stash () {
shift
esac
- if test $# = 0
- then
- set x "$ref_stash@{0}"
- shift
- fi
-
# current index state
c_tree=$(git write-tree) ||
die 'Cannot apply a stash in the middle of a merge'
# stash records the work tree, and is a merge between the
# base commit (first parent) and the index tree (second parent).
- s=$(git rev-parse --revs-only --no-flags "$@") &&
+ s=$(git rev-parse --verify --default $ref_stash "$@") &&
w_tree=$(git rev-parse --verify "$s:") &&
b_tree=$(git rev-parse --verify "$s^1:") &&
i_tree=$(git rev-parse --verify "$s^2:") ||
@@ -242,7 +228,7 @@ drop_stash () {
shift
fi
# Verify supplied argument looks like a stash entry
- s=$(git rev-parse --revs-only --no-flags "$@") &&
+ s=$(git rev-parse --verify "$@") &&
git rev-parse --verify "$s:" > /dev/null 2>&1 &&
git rev-parse --verify "$s^1:" > /dev/null 2>&1 &&
git rev-parse --verify "$s^2:" > /dev/null 2>&1 ||