Skip to content

Commit 7e2e69b

Browse files
committed
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
2 parents ad00a3b + 4e56015 commit 7e2e69b

File tree

6 files changed

+73
-4
lines changed

6 files changed

+73
-4
lines changed

Documentation/git-push.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ git push origin master:satellite/master::
117117
the ref that matches `satellite/master` (most likely, it would
118118
be `refs/remotes/satellite/master`) in `origin` repository with it.
119119

120+
git push origin master:refs/heads/experimental::
121+
Create the branch `experimental` in the `origin` repository
122+
by copying the current `master` branch. This form is usually
123+
needed to create a new branch in the remote repository as
124+
there is no `experimental` branch to match.
125+
120126
Author
121127
------
122128
Written by Junio C Hamano <junkio@cox.net>, later rewritten in C

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ LIB_FILE=libgit.a
281281
XDIFF_LIB=xdiff/lib.a
282282

283283
LIB_H = \
284-
archive.h blob.h cache.h commit.h csum-file.h delta.h grep.h \
284+
archive.h blob.h cache.h cache-tree.h commit.h csum-file.h delta.h grep.h \
285285
diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \
286286
run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
287287
tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \

builtin-apply.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,8 @@ static int find_offset(const char *buf, unsigned long size, const char *fragment
15141514
}
15151515

15161516
/* Exact line number? */
1517-
if (!memcmp(buf + start, fragment, fragsize))
1517+
if ((start + fragsize <= size) &&
1518+
!memcmp(buf + start, fragment, fragsize))
15181519
return start;
15191520

15201521
/*

contrib/workdir/git-new-workdir

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ then
4848
"a complete repository."
4949
fi
5050

51+
# don't recreate a workdir over an existing repository
52+
if test -e "$new_workdir"
53+
then
54+
die "destination directory '$new_workdir' already exists."
55+
fi
56+
5157
# make sure the the links use full paths
5258
git_dir=$(cd "$git_dir"; pwd)
5359

t/t1400-update-ref.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,9 @@ test_expect_success \
198198
GIT_AUTHOR_DATE="2005-05-26 23:41" \
199199
GIT_COMMITTER_DATE="2005-05-26 23:41" git-commit -F M -a &&
200200
h_OTHER=$(git rev-parse --verify HEAD) &&
201-
echo FIXED >F &&
202201
GIT_AUTHOR_DATE="2005-05-26 23:44" \
203202
GIT_COMMITTER_DATE="2005-05-26 23:44" git-commit --amend &&
204203
h_FIXED=$(git rev-parse --verify HEAD) &&
205-
echo TEST+FIXED >F &&
206204
echo Merged initial commit and a later commit. >M &&
207205
echo $h_TEST >.git/MERGE_HEAD &&
208206
GIT_AUTHOR_DATE="2005-05-26 23:45" \

t/t4123-apply-shrink.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/sh
2+
3+
test_description='apply a patch that is larger than the preimage'
4+
5+
. ./test-lib.sh
6+
7+
cat >F <<\EOF
8+
1
9+
2
10+
3
11+
4
12+
5
13+
6
14+
7
15+
8
16+
999999
17+
A
18+
B
19+
C
20+
D
21+
E
22+
F
23+
G
24+
H
25+
I
26+
J
27+
28+
EOF
29+
30+
test_expect_success setup '
31+
32+
git add F &&
33+
mv F G &&
34+
sed -e "s/1/11/" -e "s/999999/9/" -e "s/H/HH/" <G >F &&
35+
git diff >patch &&
36+
sed -e "/^\$/d" <G >F &&
37+
git add F
38+
39+
'
40+
41+
test_expect_success 'apply should fail gracefully' '
42+
43+
if git apply --index patch
44+
then
45+
echo Oops, should not have succeeded
46+
false
47+
else
48+
status=$?
49+
echo "Status was $status"
50+
if test -f .git/index.lock
51+
then
52+
echo Oops, should not have crashed
53+
false
54+
fi
55+
fi
56+
'
57+
58+
test_done

0 commit comments

Comments
 (0)