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
This commit is contained in:
Shawn O. Pearce 2008-10-09 10:18:32 -07:00
commit 635536488c
5 changed files with 18 additions and 28 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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 ||