Merge branch 'maint'
* maint: Include a git-push example for creating a remote branch Cleanup unnecessary file modifications in t1400-update-ref Makefile: Add cache-tree.h to the headers list Don't allow contrib/workdir/git-new-workdir to trash existing dirs git-apply: do not read past the end of buffer
This commit is contained in:
commit
7e2e69b7f6
@ -117,6 +117,12 @@ git push origin master:satellite/master::
|
||||
the ref that matches `satellite/master` (most likely, it would
|
||||
be `refs/remotes/satellite/master`) in `origin` repository with it.
|
||||
|
||||
git push origin master:refs/heads/experimental::
|
||||
Create the branch `experimental` in the `origin` repository
|
||||
by copying the current `master` branch. This form is usually
|
||||
needed to create a new branch in the remote repository as
|
||||
there is no `experimental` branch to match.
|
||||
|
||||
Author
|
||||
------
|
||||
Written by Junio C Hamano <junkio@cox.net>, later rewritten in C
|
||||
|
2
Makefile
2
Makefile
@ -281,7 +281,7 @@ LIB_FILE=libgit.a
|
||||
XDIFF_LIB=xdiff/lib.a
|
||||
|
||||
LIB_H = \
|
||||
archive.h blob.h cache.h commit.h csum-file.h delta.h grep.h \
|
||||
archive.h blob.h cache.h cache-tree.h commit.h csum-file.h delta.h grep.h \
|
||||
diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \
|
||||
run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
|
||||
tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \
|
||||
|
@ -1514,7 +1514,8 @@ static int find_offset(const char *buf, unsigned long size, const char *fragment
|
||||
}
|
||||
|
||||
/* Exact line number? */
|
||||
if (!memcmp(buf + start, fragment, fragsize))
|
||||
if ((start + fragsize <= size) &&
|
||||
!memcmp(buf + start, fragment, fragsize))
|
||||
return start;
|
||||
|
||||
/*
|
||||
|
@ -48,6 +48,12 @@ then
|
||||
"a complete repository."
|
||||
fi
|
||||
|
||||
# don't recreate a workdir over an existing repository
|
||||
if test -e "$new_workdir"
|
||||
then
|
||||
die "destination directory '$new_workdir' already exists."
|
||||
fi
|
||||
|
||||
# make sure the the links use full paths
|
||||
git_dir=$(cd "$git_dir"; pwd)
|
||||
|
||||
|
@ -198,11 +198,9 @@ test_expect_success \
|
||||
GIT_AUTHOR_DATE="2005-05-26 23:41" \
|
||||
GIT_COMMITTER_DATE="2005-05-26 23:41" git-commit -F M -a &&
|
||||
h_OTHER=$(git rev-parse --verify HEAD) &&
|
||||
echo FIXED >F &&
|
||||
GIT_AUTHOR_DATE="2005-05-26 23:44" \
|
||||
GIT_COMMITTER_DATE="2005-05-26 23:44" git-commit --amend &&
|
||||
h_FIXED=$(git rev-parse --verify HEAD) &&
|
||||
echo TEST+FIXED >F &&
|
||||
echo Merged initial commit and a later commit. >M &&
|
||||
echo $h_TEST >.git/MERGE_HEAD &&
|
||||
GIT_AUTHOR_DATE="2005-05-26 23:45" \
|
||||
|
58
t/t4123-apply-shrink.sh
Executable file
58
t/t4123-apply-shrink.sh
Executable file
@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='apply a patch that is larger than the preimage'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
cat >F <<\EOF
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
999999
|
||||
A
|
||||
B
|
||||
C
|
||||
D
|
||||
E
|
||||
F
|
||||
G
|
||||
H
|
||||
I
|
||||
J
|
||||
|
||||
EOF
|
||||
|
||||
test_expect_success setup '
|
||||
|
||||
git add F &&
|
||||
mv F G &&
|
||||
sed -e "s/1/11/" -e "s/999999/9/" -e "s/H/HH/" <G >F &&
|
||||
git diff >patch &&
|
||||
sed -e "/^\$/d" <G >F &&
|
||||
git add F
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'apply should fail gracefully' '
|
||||
|
||||
if git apply --index patch
|
||||
then
|
||||
echo Oops, should not have succeeded
|
||||
false
|
||||
else
|
||||
status=$?
|
||||
echo "Status was $status"
|
||||
if test -f .git/index.lock
|
||||
then
|
||||
echo Oops, should not have crashed
|
||||
false
|
||||
fi
|
||||
fi
|
||||
'
|
||||
|
||||
test_done
|
Loading…
Reference in New Issue
Block a user