Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Sep 6, 2007
2 parents ad00a3b + 4e56015 commit 7e2e69b
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Documentation/git-push.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
3 changes: 2 additions & 1 deletion builtin-apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand Down
6 changes: 6 additions & 0 deletions contrib/workdir/git-new-workdir
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 0 additions & 2 deletions t/t1400-update-ref.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
58 changes: 58 additions & 0 deletions t/t4123-apply-shrink.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7e2e69b

Please sign in to comment.