
84 changed files with 1486 additions and 479 deletions
@ -0,0 +1,256 @@
@@ -0,0 +1,256 @@
|
||||
From: Rutger Nijlunsing <rutger@nospam.com> |
||||
Subject: Setting up a git repository which can be pushed into and pulled from over HTTP. |
||||
Date: Thu, 10 Aug 2006 22:00:26 +0200 |
||||
|
||||
Since Apache is one of those packages people like to compile |
||||
themselves while others prefer the bureaucrat's dream Debian, it is |
||||
impossible to give guidelines which will work for everyone. Just send |
||||
some feedback to the mailing list at git@vger.kernel.org to get this |
||||
document tailored to your favorite distro. |
||||
|
||||
|
||||
What's needed: |
||||
|
||||
- Have an Apache web-server |
||||
|
||||
On Debian: |
||||
$ apt-get install apache2 |
||||
To get apache2 by default started, |
||||
edit /etc/default/apache2 and set NO_START=0 |
||||
|
||||
- can edit the configuration of it. |
||||
|
||||
This could be found under /etc/httpd, or refer to your Apache documentation. |
||||
|
||||
On Debian: this means being able to edit files under /etc/apache2 |
||||
|
||||
- can restart it. |
||||
|
||||
'apachectl --graceful' might do. If it doesn't, just stop and |
||||
restart apache. Be warning that active connections to your server |
||||
might be aborted by this. |
||||
|
||||
On Debian: |
||||
$ /etc/init.d/apache2 restart |
||||
or |
||||
$ /etc/init.d/apache2 force-reload |
||||
(which seems to do the same) |
||||
This adds symlinks from the /etc/apache2/mods-enabled to |
||||
/etc/apache2/mods-available. |
||||
|
||||
- have permissions to chown a directory |
||||
|
||||
- have git installed at the server _and_ client |
||||
|
||||
In effect, this probably means you're going to be root. |
||||
|
||||
|
||||
Step 1: setup a bare GIT repository |
||||
----------------------------------- |
||||
|
||||
At the time of writing, git-http-push cannot remotely create a GIT |
||||
repository. So we have to do that at the server side with git. Another |
||||
option would be to generate an empty repository at the client and copy |
||||
it to the server with WebDAV. But then you're probably the first to |
||||
try that out :) |
||||
|
||||
Create the directory under the DocumentRoot of the directories served |
||||
by Apache. As an example we take /usr/local/apache2, but try "grep |
||||
DocumentRoot /where/ever/httpd.conf" to find your root: |
||||
|
||||
$ cd /usr/local/apache/htdocs |
||||
$ mkdir my-new-repo.git |
||||
|
||||
On Debian: |
||||
|
||||
$ cd /var/www |
||||
$ mkdir my-new-repo.git |
||||
|
||||
|
||||
Initialize a bare repository |
||||
|
||||
$ cd my-new-repo.git |
||||
$ git --bare init-db |
||||
|
||||
|
||||
Change the ownership to your web-server's credentials. Use "grep ^User |
||||
httpd.conf" and "grep ^Group httpd.conf" to find out: |
||||
|
||||
$ chown -R www.www . |
||||
|
||||
On Debian: |
||||
|
||||
$ chown -R www-data.www-data . |
||||
|
||||
|
||||
If you do not know which user Apache runs as, you can alternatively do |
||||
a "chmod -R a+w .", inspect the files which are created later on, and |
||||
set the permissions appropriately. |
||||
|
||||
Restart apache2, and check whether http://server/my-new-repo.git gives |
||||
a directory listing. If not, check whether apache started up |
||||
successfully. |
||||
|
||||
|
||||
Step 2: enable DAV on this repository |
||||
------------------------------------- |
||||
|
||||
First make sure the dav_module is loaded. For this, insert in httpd.conf: |
||||
|
||||
LoadModule dav_module libexec/httpd/libdav.so |
||||
AddModule mod_dav.c |
||||
|
||||
Also make sure that this line exists which is the file used for |
||||
locking DAV operations: |
||||
|
||||
DAVLockDB "/usr/local/apache2/temp/DAV.lock" |
||||
|
||||
On Debian these steps can be performed with: |
||||
|
||||
Enable the dav and dav_fs modules of apache: |
||||
$ a2enmod dav_fs |
||||
(just to be sure. dav_fs might be unneeded, I don't know) |
||||
$ a2enmod dav |
||||
The DAV lock is located in /etc/apache2/mods-available/dav_fs.conf: |
||||
DAVLockDB /var/lock/apache2/DAVLock |
||||
|
||||
Of course, it can point somewhere else, but the string is actually just a |
||||
prefix in some Apache configurations, and therefore the _directory_ has to |
||||
be writable by the user Apache runs as. |
||||
|
||||
Then, add something like this to your httpd.conf |
||||
|
||||
<Location /my-new-repo.git> |
||||
DAV on |
||||
AuthType Basic |
||||
AuthName "Git" |
||||
AuthUserFile /usr/local/apache2/conf/passwd.git |
||||
Require valid-user |
||||
</Location> |
||||
|
||||
On Debian: |
||||
Create (or add to) /etc/apache2/conf.d/git.conf : |
||||
|
||||
<Location /my-new-repo.git> |
||||
DAV on |
||||
AuthType Basic |
||||
AuthName "Git" |
||||
AuthUserFile /etc/apache2/passwd.git |
||||
Require valid-user |
||||
</Location> |
||||
|
||||
Debian automatically reads all files under /etc/apach2/conf.d. |
||||
|
||||
The password file can be somewhere else, but it has to be readable by |
||||
Apache and preferably not readable by the world. |
||||
|
||||
Create this file by |
||||
$ htpasswd -c /usr/local/apache2/conf/passwd.git <user> |
||||
|
||||
On Debian: |
||||
$ htpasswd -c /etc/apache2/passwd.git <user> |
||||
|
||||
You will be asked a password, and the file is created. Subsequent calls |
||||
to htpasswd should omit the '-c' option, since you want to append to the |
||||
existing file. |
||||
|
||||
You need to restart Apache. |
||||
|
||||
Now go to http://<username>@<servername>/my-new-repo.git in your |
||||
browser to check whether it asks for a password and accepts the right |
||||
password. |
||||
|
||||
On Debian: |
||||
|
||||
To test the WebDAV part, do: |
||||
|
||||
$ apt-get install litmus |
||||
$ litmus http://<servername>/my-new-repo.git <username> <password> |
||||
|
||||
Most tests should pass. |
||||
|
||||
A command line tool to test WebDAV is cadaver. |
||||
|
||||
If you're into Windows, from XP onwards Internet Explorer supports |
||||
WebDAV. For this, do Internet Explorer -> Open Location -> |
||||
http://<servername>/my-new-repo.git [x] Open as webfolder -> login . |
||||
|
||||
|
||||
Step 3: setup the client |
||||
------------------------ |
||||
|
||||
Make sure that you have HTTP support, i.e. your git was built with curl. |
||||
The easiest way to check is to look for the executable 'git-http-push'. |
||||
|
||||
Then, add the following to your $HOME/.netrc (you can do without, but will be |
||||
asked to input your password a _lot_ of times): |
||||
|
||||
machine <servername> |
||||
login <username> |
||||
password <password> |
||||
|
||||
...and set permissions: |
||||
chmod 600 ~/.netrc |
||||
|
||||
If you want to access the web-server by its IP, you have to type that in, |
||||
instead of the server name. |
||||
|
||||
To check whether all is OK, do: |
||||
|
||||
curl --netrc --location -v http://<username>@<servername>/my-new-repo.git/ |
||||
|
||||
...this should give a directory listing in HTML of /var/www/my-new-repo.git . |
||||
|
||||
|
||||
Now, add the remote in your existing repository which contains the project |
||||
you want to export: |
||||
|
||||
$ git-repo-config remote.upload.url \ |
||||
http://<username>@<servername>/my-new-repo.git/ |
||||
|
||||
It is important to put the last '/'; Without it, the server will send |
||||
a redirect which git-http-push does not (yet) understand, and git-http-push |
||||
will repeat the request infinitely. |
||||
|
||||
|
||||
Step 4: make the initial push |
||||
----------------------------- |
||||
|
||||
From your client repository, do |
||||
|
||||
$ git push upload master |
||||
|
||||
This pushes branch 'master' (which is assumed to be the branch you |
||||
want to export) to repository called 'upload', which we previously |
||||
defined with git-repo-config. |
||||
|
||||
|
||||
Troubleshooting: |
||||
---------------- |
||||
|
||||
If git-http-push says |
||||
|
||||
Error: no DAV locking support on remote repo http://... |
||||
|
||||
then it means the web-server did not accept your authentication. Make sure |
||||
that the user name and password matches in httpd.conf, .netrc and the URL |
||||
you are uploading to. |
||||
|
||||
If git-http-push shows you an error (22/502) when trying to MOVE a blob, |
||||
it means that your web-server somehow does not recognize its name in the |
||||
request; This can happen when you start Apache, but then disable the |
||||
network interface. A simple restart of Apache helps. |
||||
|
||||
Errors like (22/502) are of format (curl error code/http error |
||||
code). So (22/404) means something like 'not found' at the server. |
||||
|
||||
Reading /usr/local/apache2/logs/error_log is often helpful. |
||||
|
||||
On Debian: Read /var/log/apache2/error.log instead. |
||||
|
||||
|
||||
Debian References: http://www.debian-administration.org/articles/285 |
||||
|
||||
Authors |
||||
Johannes Schindelin <Johannes.Schindelin@gmx.de> |
||||
Rutger Nijlunsing <git@wingding.demon.nl> |
@ -1,87 +0,0 @@
@@ -1,87 +0,0 @@
|
||||
#!/bin/sh |
||||
|
||||
USAGE='[--all] [--tags] [--force] <repository> [<refspec>...]' |
||||
. git-sh-setup |
||||
|
||||
# Parse out parameters and then stop at remote, so that we can |
||||
# translate it using .git/branches information |
||||
has_all= |
||||
has_force= |
||||
has_exec= |
||||
has_thin=--thin |
||||
remote= |
||||
do_tags= |
||||
|
||||
while case "$#" in 0) break ;; esac |
||||
do |
||||
case "$1" in |
||||
--all) |
||||
has_all=--all ;; |
||||
--tags) |
||||
do_tags=yes ;; |
||||
--force) |
||||
has_force=--force ;; |
||||
--exec=*) |
||||
has_exec="$1" ;; |
||||
--thin) |
||||
;; # noop |
||||
--no-thin) |
||||
has_thin= ;; |
||||
-*) |
||||
usage ;; |
||||
*) |
||||
set x "$@" |
||||
shift |
||||
break ;; |
||||
esac |
||||
shift |
||||
done |
||||
case "$#" in |
||||
0) |
||||
echo "Where would you want to push today?" |
||||
usage ;; |
||||
esac |
||||
|
||||
. git-parse-remote |
||||
remote=$(get_remote_url "$@") |
||||
|
||||
case "$has_all" in |
||||
--all) |
||||
set x ;; |
||||
'') |
||||
case "$do_tags,$#" in |
||||
yes,1) |
||||
set x $(cd "$GIT_DIR/refs" && find tags -type f -print) ;; |
||||
yes,*) |
||||
set x $(cd "$GIT_DIR/refs" && find tags -type f -print) \ |
||||
$(get_remote_refs_for_push "$@") ;; |
||||
,*) |
||||
set x $(get_remote_refs_for_push "$@") ;; |
||||
esac |
||||
esac |
||||
|
||||
shift ;# away the initial 'x' |
||||
|
||||
# $# is now 0 if there was no explicit refspec on the command line |
||||
# and there was no default refspec to push from remotes/ file. |
||||
# we will let git-send-pack to do its "matching refs" thing. |
||||
|
||||
case "$remote" in |
||||
git://*) |
||||
die "Cannot use READ-ONLY transport to push to $remote" ;; |
||||
rsync://*) |
||||
die "Pushing with rsync transport is deprecated" ;; |
||||
esac |
||||
|
||||
set x "$remote" "$@"; shift |
||||
test "$has_all" && set x "$has_all" "$@" && shift |
||||
test "$has_force" && set x "$has_force" "$@" && shift |
||||
test "$has_exec" && set x "$has_exec" "$@" && shift |
||||
test "$has_thin" && set x "$has_thin" "$@" && shift |
||||
|
||||
case "$remote" in |
||||
http://* | https://*) |
||||
exec git-http-push "$@";; |
||||
*) |
||||
exec git-send-pack "$@";; |
||||
esac |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh |
||||
# |
||||
# Copyright (c) 2006 Junio C Hamano |
||||
# |
||||
|
||||
test_description='git-read-tree --prefix test. |
||||
' |
||||
|
||||
. ./test-lib.sh |
||||
|
||||
test_expect_success setup ' |
||||
echo hello >one && |
||||
git-update-index --add one && |
||||
tree=`git-write-tree` && |
||||
echo tree is $tree |
||||
' |
||||
|
||||
echo 'one |
||||
two/one' >expect |
||||
|
||||
test_expect_success 'read-tree --prefix' ' |
||||
git-read-tree --prefix=two/ $tree && |
||||
git-ls-files >actual && |
||||
cmp expect actual |
||||
' |
||||
|
||||
test_done |
@ -0,0 +1,109 @@
@@ -0,0 +1,109 @@
|
||||
#!/bin/sh |
||||
# |
||||
# Copyright (c) 2006 Junio C Hamano |
||||
# |
||||
|
||||
test_description='Try various core-level commands in subdirectory. |
||||
' |
||||
|
||||
. ./test-lib.sh |
||||
|
||||
test_expect_success setup ' |
||||
long="a b c d e f g h i j k l m n o p q r s t u v w x y z" && |
||||
for c in $long; do echo $c; done >one && |
||||
mkdir dir && |
||||
for c in x y z $long a b c; do echo $c; done >dir/two && |
||||
cp one original.one && |
||||
cp dir/two original.two |
||||
' |
||||
HERE=`pwd` |
||||
LF=' |
||||
' |
||||
|
||||
test_expect_success 'update-index and ls-files' ' |
||||
cd $HERE && |
||||
git-update-index --add one && |
||||
case "`git-ls-files`" in |
||||
one) echo ok one ;; |
||||
*) echo bad one; exit 1 ;; |
||||
esac && |
||||
cd dir && |
||||
git-update-index --add two && |
||||
case "`git-ls-files`" in |
||||
two) echo ok two ;; |
||||
*) echo bad two; exit 1 ;; |
||||
esac && |
||||
cd .. && |
||||
case "`git-ls-files`" in |
||||
dir/two"$LF"one) echo ok both ;; |
||||
*) echo bad; exit 1 ;; |
||||
esac |
||||
' |
||||
|
||||
test_expect_success 'cat-file' ' |
||||
cd $HERE && |
||||
two=`git-ls-files -s dir/two` && |
||||
two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` && |
||||
echo "$two" && |
||||
git-cat-file -p "$two" >actual && |
||||
cmp dir/two actual && |
||||
cd dir && |
||||
git-cat-file -p "$two" >actual && |
||||
cmp two actual |
||||
' |
||||
rm -f actual dir/actual |
||||
|
||||
test_expect_success 'diff-files' ' |
||||
cd $HERE && |
||||
echo a >>one && |
||||
echo d >>dir/two && |
||||
case "`git-diff-files --name-only`" in |
||||
dir/two"$LF"one) echo ok top ;; |
||||
*) echo bad top; exit 1 ;; |
||||
esac && |
||||
# diff should not omit leading paths |
||||
cd dir && |
||||
case "`git-diff-files --name-only`" in |
||||
dir/two"$LF"one) echo ok subdir ;; |
||||
*) echo bad subdir; exit 1 ;; |
||||
esac && |
||||
case "`git-diff-files --name-only .`" in |
||||
dir/two) echo ok subdir limited ;; |
||||
*) echo bad subdir limited; exit 1 ;; |
||||
esac |
||||
' |
||||
|
||||
test_expect_success 'write-tree' ' |
||||
cd $HERE && |
||||
top=`git-write-tree` && |
||||
echo $top && |
||||
cd dir && |
||||
sub=`git-write-tree` && |
||||
echo $sub && |
||||
test "z$top" = "z$sub" |
||||
' |
||||
|
||||
test_expect_success 'checkout-index' ' |
||||
cd $HERE && |
||||
git-checkout-index -f -u one && |
||||
cmp one original.one && |
||||
cd dir && |
||||
git-checkout-index -f -u two && |
||||
cmp two ../original.two |
||||
' |
||||
|
||||
test_expect_success 'read-tree' ' |
||||
cd $HERE && |
||||
rm -f one dir/two && |
||||
tree=`git-write-tree` && |
||||
git-read-tree --reset -u "$tree" && |
||||
cmp one original.one && |
||||
cmp dir/two original.two && |
||||
cd dir && |
||||
rm -f two && |
||||
git-read-tree --reset -u "$tree" && |
||||
cmp two ../original.two && |
||||
cmp ../one ../original.one |
||||
' |
||||
|
||||
test_done |
@ -0,0 +1,227 @@
@@ -0,0 +1,227 @@
|
||||
#!/bin/sh |
||||
# |
||||
# |
||||
|
||||
test_description='git-mktag: tag object verify test' |
||||
|
||||
. ./test-lib.sh |
||||
|
||||
########################################################### |
||||
# check the tag.sig file, expecting verify_tag() to fail, |
||||
# and checking that the error message matches the pattern |
||||
# given in the expect.pat file. |
||||
|
||||
check_verify_failure () { |
||||
test_expect_success \ |
||||
"$1" \ |
||||
'git-mktag <tag.sig 2>message || |
||||
egrep -q -f expect.pat message' |
||||
} |
||||
|
||||
########################################################### |
||||
# first create a commit, so we have a valid object/type |
||||
# for the tag. |
||||
echo Hello >A |
||||
git-update-index --add A |
||||
git-commit -m "Initial commit" |
||||
head=$(git-rev-parse --verify HEAD) |
||||
|
||||
############################################################ |
||||
# 1. length check |
||||
|
||||
cat >tag.sig <<EOF |
||||
too short for a tag |
||||
EOF |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: .*size wrong.*$ |
||||
EOF |
||||
|
||||
check_verify_failure 'Tag object length check' |
||||
|
||||
############################################################ |
||||
# 2. object line label check |
||||
|
||||
cat >tag.sig <<EOF |
||||
xxxxxx 139e9b33986b1c2670fff52c5067603117b3e895 |
||||
type tag |
||||
tag mytag |
||||
EOF |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: char0: .*"object "$ |
||||
EOF |
||||
|
||||
check_verify_failure '"object" line label check' |
||||
|
||||
############################################################ |
||||
# 3. object line SHA1 check |
||||
|
||||
cat >tag.sig <<EOF |
||||
object zz9e9b33986b1c2670fff52c5067603117b3e895 |
||||
type tag |
||||
tag mytag |
||||
EOF |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: char7: .*SHA1 hash$ |
||||
EOF |
||||
|
||||
check_verify_failure '"object" line SHA1 check' |
||||
|
||||
############################################################ |
||||
# 4. type line label check |
||||
|
||||
cat >tag.sig <<EOF |
||||
object 779e9b33986b1c2670fff52c5067603117b3e895 |
||||
xxxx tag |
||||
tag mytag |
||||
EOF |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: char47: .*"[\]ntype "$ |
||||
EOF |
||||
|
||||
check_verify_failure '"type" line label check' |
||||
|
||||
############################################################ |
||||
# 5. type line eol check |
||||
|
||||
echo "object 779e9b33986b1c2670fff52c5067603117b3e895" >tag.sig |
||||
echo -n "type tagsssssssssssssssssssssssssssssss" >>tag.sig |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: char48: .*"[\]n"$ |
||||
EOF |
||||
|
||||
check_verify_failure '"type" line eol check' |
||||
|
||||
############################################################ |
||||
# 6. tag line label check #1 |
||||
|
||||
cat >tag.sig <<EOF |
||||
object 779e9b33986b1c2670fff52c5067603117b3e895 |
||||
type tag |
||||
xxx mytag |
||||
EOF |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: char57: no "tag " found$ |
||||
EOF |
||||
|
||||
check_verify_failure '"tag" line label check #1' |
||||
|
||||
############################################################ |
||||
# 7. tag line label check #2 |
||||
|
||||
cat >tag.sig <<EOF |
||||
object 779e9b33986b1c2670fff52c5067603117b3e895 |
||||
type taggggggggggggggggggggggggggggggg |
||||
tag |
||||
EOF |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: char87: no "tag " found$ |
||||
EOF |
||||
|
||||
check_verify_failure '"tag" line label check #2' |
||||
|
||||
############################################################ |
||||
# 8. type line type-name length check |
||||
|
||||
cat >tag.sig <<EOF |
||||
object 779e9b33986b1c2670fff52c5067603117b3e895 |
||||
type taggggggggggggggggggggggggggggggg |
||||
tag mytag |
||||
EOF |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: char53: type too long$ |
||||
EOF |
||||
|
||||
check_verify_failure '"type" line type-name length check' |
||||
|
||||
############################################################ |
||||
# 9. verify object (SHA1/type) check |
||||
|
||||
cat >tag.sig <<EOF |
||||
object 779e9b33986b1c2670fff52c5067603117b3e895 |
||||
type tagggg |
||||
tag mytag |
||||
EOF |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: char7: could not verify object.*$ |
||||
EOF |
||||
|
||||
check_verify_failure 'verify object (SHA1/type) check' |
||||
|
||||
############################################################ |
||||
# 10. verify tag-name check |
||||
|
||||
cat >tag.sig <<EOF |
||||
object $head |
||||
type commit |
||||
tag my tag |
||||
EOF |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: char67: could not verify tag name$ |
||||
EOF |
||||
|
||||
check_verify_failure 'verify tag-name check' |
||||
|
||||
############################################################ |
||||
# 11. tagger line lable check #1 |
||||
|
||||
cat >tag.sig <<EOF |
||||
object $head |
||||
type commit |
||||
tag mytag |
||||
EOF |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: char70: could not find "tagger"$ |
||||
EOF |
||||
|
||||
check_verify_failure '"tagger" line label check #1' |
||||
|
||||
############################################################ |
||||
# 12. tagger line lable check #2 |
||||
|
||||
cat >tag.sig <<EOF |
||||
object $head |
||||
type commit |
||||
tag mytag |
||||
tagger |
||||
EOF |
||||
|
||||
cat >expect.pat <<EOF |
||||
^error: char70: could not find "tagger"$ |
||||
EOF |
||||
|
||||
check_verify_failure '"tagger" line label check #2' |
||||
|
||||
############################################################ |
||||
# 13. create valid tag |
||||
|
||||
cat >tag.sig <<EOF |
||||
object $head |
||||
type commit |
||||
tag mytag |
||||
tagger another@example.com |
||||
EOF |
||||
|
||||
test_expect_success \ |
||||
'create valid tag' \ |
||||
'git-mktag <tag.sig >.git/refs/tags/mytag 2>message' |
||||
|
||||
############################################################ |
||||
# 14. check mytag |
||||
|
||||
test_expect_success \ |
||||
'check mytag' \ |
||||
'git-tag -l | grep mytag' |
||||
|
||||
|
||||
test_done |
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh |
||||
# |
||||
# Copyright (c) 2005 Junio C Hamano |
||||
# |
||||
|
||||
test_description='git-apply symlinks and partial files |
||||
|
||||
' |
||||
|
||||
. ./test-lib.sh |
||||
|
||||
test_expect_success setup ' |
||||
|
||||
ln -s path1/path2/path3/path4/path5 link1 && |
||||
git add link? && |
||||
git commit -m initial && |
||||
|
||||
git branch side && |
||||
|
||||
rm -f link? && |
||||
|
||||
ln -s htap6 link1 && |
||||
git update-index link? && |
||||
git commit -m second && |
||||
|
||||
git diff-tree -p HEAD^ HEAD >patch && |
||||
git apply --stat --summary patch |
||||
|
||||
' |
||||
|
||||
test_expect_success 'apply symlink patch' ' |
||||
|
||||
git checkout side && |
||||
git apply patch && |
||||
git diff-files -p >patched && |
||||
diff -u patch patched |
||||
|
||||
' |
||||
|
||||
test_expect_success 'apply --index symlink patch' ' |
||||
|
||||
git checkout -f side && |
||||
git apply --index patch && |
||||
git diff-index --cached -p HEAD >patched && |
||||
diff -u patch patched |
||||
|
||||
' |
||||
|
||||
test_done |
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
#!/bin/sh |
||||
# |
||||
# Copyright (c) 2006 Junio C Hamano |
||||
# |
||||
|
||||
test_description='git grep -w |
||||
' |
||||
|
||||
. ./test-lib.sh |
||||
|
||||
test_expect_success setup ' |
||||
{ |
||||
echo foo mmap bar |
||||
echo foo_mmap bar |
||||
echo foo_mmap bar mmap |
||||
echo foo mmap bar_mmap |
||||
echo foo_mmap bar mmap baz |
||||
} >file && |
||||
echo x x xx x >x && |
||||
echo y yy >y && |
||||
echo zzz > z && |
||||
git add file x y z && |
||||
git commit -m initial |
||||
' |
||||
|
||||
for H in HEAD '' |
||||
do |
||||
case "$H" in |
||||
HEAD) HC='HEAD:' L='HEAD' ;; |
||||
'') HC= L='in working tree' ;; |
||||
esac |
||||
|
||||
test_expect_success "grep -w $L" ' |
||||
{ |
||||
echo ${HC}file:1:foo mmap bar |
||||
echo ${HC}file:3:foo_mmap bar mmap |
||||
echo ${HC}file:4:foo mmap bar_mmap |
||||
echo ${HC}file:5:foo_mmap bar mmap baz |
||||
} >expected && |
||||
git grep -n -w -e mmap $H >actual && |
||||
diff expected actual |
||||
' |
||||
|
||||
test_expect_success "grep -w $L (x)" ' |
||||
{ |
||||
echo ${HC}x:1:x x xx x |
||||
} >expected && |
||||
git grep -n -w -e "x xx* x" $H >actual && |
||||
diff expected actual |
||||
' |
||||
|
||||
test_expect_success "grep -w $L (y-1)" ' |
||||
{ |
||||
echo ${HC}y:1:y yy |
||||
} >expected && |
||||
git grep -n -w -e "^y" $H >actual && |
||||
diff expected actual |
||||
' |
||||
|
||||
test_expect_success "grep -w $L (y-2)" ' |
||||
: >expected && |
||||
if git grep -n -w -e "^y y" $H >actual |
||||
then |
||||
echo should not have matched |
||||
cat actual |
||||
false |
||||
else |
||||
diff expected actual |
||||
fi |
||||
' |
||||
|
||||
test_expect_success "grep -w $L (z)" ' |
||||
: >expected && |
||||
if git grep -n -w -e "^z" $H >actual |
||||
then |
||||
echo should not have matched |
||||
cat actual |
||||
false |
||||
else |
||||
diff expected actual |
||||
fi |
||||
' |
||||
done |
||||
|
||||
test_done |
Loading…
Reference in new issue