aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-09-05 23:37:02 -0700
committerJunio C Hamano <gitster@pobox.com>2007-09-05 23:37:02 -0700
commit7e2e69b7f67ba8b336be56508d0208117d9e22e3 (patch)
treef10cda2462596cb0939c5dd0d0373bff5a2aaee0
parentad00a3b8f8cabcf20aa6ac84ac88bea035fa7ce7 (diff)
parent4e560158c6de154fafab9fc3f6028d9edcc53e6b (diff)
downloadgit-7e2e69b7f67ba8b336be56508d0208117d9e22e3.tar.gz
git-7e2e69b7f67ba8b336be56508d0208117d9e22e3.tar.xz
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
-rw-r--r--Documentation/git-push.txt6
-rw-r--r--Makefile2
-rw-r--r--builtin-apply.c3
-rwxr-xr-xcontrib/workdir/git-new-workdir6
-rwxr-xr-xt/t1400-update-ref.sh2
-rwxr-xr-xt/t4123-apply-shrink.sh58
6 files changed, 73 insertions, 4 deletions
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 0dd9caf86..7b8e075c4 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -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
diff --git a/Makefile b/Makefile
index 51af531c9..dace2112f 100644
--- a/Makefile
+++ b/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 \
diff --git a/builtin-apply.c b/builtin-apply.c
index 25b144790..976ec7704 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -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;
/*
diff --git a/contrib/workdir/git-new-workdir b/contrib/workdir/git-new-workdir
index c6e154a84..2838546d1 100755
--- a/contrib/workdir/git-new-workdir
+++ b/contrib/workdir/git-new-workdir
@@ -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)
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index c4c0dfaab..ce045b2a5 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -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" \
diff --git a/t/t4123-apply-shrink.sh b/t/t4123-apply-shrink.sh
new file mode 100755
index 000000000..984157f03
--- /dev/null
+++ b/t/t4123-apply-shrink.sh
@@ -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