-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PATCH] git-apply: tests for --stat and --summary.
This adds tests (which also serves demonstration) for the --stat and --summary flags to the git-apply command. Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information
Junio C Hamano
authored and
Linus Torvalds
committed
Jun 22, 2005
1 parent
d0587fd
commit fae22ac
Showing
15 changed files
with
2,152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (c) 2005 Junio C Hamano | ||
# | ||
|
||
test_description='git-apply --stat --summary test. | ||
' | ||
. ./test-lib.sh | ||
|
||
test_expect_success \ | ||
'rename' \ | ||
'git-apply --stat --summary <../t4100/t-apply-1.patch >current && | ||
diff -u ../t4100/t-apply-1.expect current' | ||
|
||
test_expect_success \ | ||
'copy' \ | ||
'git-apply --stat --summary <../t4100/t-apply-2.patch >current && | ||
diff -u ../t4100/t-apply-2.expect current' | ||
|
||
test_expect_success \ | ||
'rewrite' \ | ||
'git-apply --stat --summary <../t4100/t-apply-3.patch >current && | ||
diff -u ../t4100/t-apply-3.expect current' | ||
|
||
test_expect_success \ | ||
'mode' \ | ||
'git-apply --stat --summary <../t4100/t-apply-4.patch >current && | ||
diff -u ../t4100/t-apply-4.expect current' | ||
|
||
test_expect_success \ | ||
'non git' \ | ||
'git-apply --stat --summary <../t4100/t-apply-5.patch >current && | ||
diff -u ../t4100/t-apply-5.expect current' | ||
|
||
test_expect_success \ | ||
'non git' \ | ||
'git-apply --stat --summary <../t4100/t-apply-6.patch >current && | ||
diff -u ../t4100/t-apply-6.expect current' | ||
|
||
test_expect_success \ | ||
'non git' \ | ||
'git-apply --stat --summary <../t4100/t-apply-7.patch >current && | ||
diff -u ../t4100/t-apply-7.expect current' | ||
|
||
test_done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Documentation/git-ssh-pull.txt | 12 ++++++------ | ||
Documentation/git-ssh-push.txt | 10 +++++----- | ||
Documentation/git.txt | 6 +++--- | ||
Makefile | 6 +++--- | ||
ssh-pull.c | 4 ++-- | ||
ssh-push.c | 14 +++++++------- | ||
6 files changed, 26 insertions(+), 26 deletions(-) | ||
rename Documentation/{git-rpull.txt => git-ssh-pull.txt} (90%) | ||
rename Documentation/{git-rpush.txt => git-ssh-push.txt} (71%) | ||
rename rpull.c => ssh-pull.c (97%) | ||
rename rpush.c => ssh-push.c (93%) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
418aaf847a8b3ffffb4f777a2dd5262ca5ce0ef7 (from dc93841715dfa9a9cdda6f2c4a25eec831ea7aa0) | ||
diff --git a/Documentation/git-rpull.txt b/Documentation/git-ssh-pull.txt | ||
similarity index 90% | ||
rename from Documentation/git-rpull.txt | ||
rename to Documentation/git-ssh-pull.txt | ||
--- a/Documentation/git-rpull.txt | ||
+++ b/Documentation/git-ssh-pull.txt | ||
@@ -1,21 +1,21 @@ | ||
-git-rpull(1) | ||
-============ | ||
+git-ssh-pull(1) | ||
+=============== | ||
v0.1, May 2005 | ||
|
||
NAME | ||
---- | ||
-git-rpull - Pulls from a remote repository over ssh connection | ||
+git-ssh-pull - Pulls from a remote repository over ssh connection | ||
|
||
|
||
|
||
SYNOPSIS | ||
-------- | ||
-'git-rpull' [-c] [-t] [-a] [-d] [-v] [--recover] commit-id url | ||
+'git-ssh-pull' [-c] [-t] [-a] [-d] [-v] [--recover] commit-id url | ||
|
||
DESCRIPTION | ||
----------- | ||
-Pulls from a remote repository over ssh connection, invoking git-rpush on | ||
-the other end. | ||
+Pulls from a remote repository over ssh connection, invoking git-ssh-push | ||
+on the other end. | ||
|
||
OPTIONS | ||
------- | ||
diff --git a/Documentation/git-rpush.txt b/Documentation/git-ssh-push.txt | ||
similarity index 71% | ||
rename from Documentation/git-rpush.txt | ||
rename to Documentation/git-ssh-push.txt | ||
--- a/Documentation/git-rpush.txt | ||
+++ b/Documentation/git-ssh-push.txt | ||
@@ -1,19 +1,19 @@ | ||
-git-rpush(1) | ||
-============ | ||
+git-ssh-push(1) | ||
+=============== | ||
v0.1, May 2005 | ||
|
||
NAME | ||
---- | ||
-git-rpush - Helper "server-side" program used by git-rpull | ||
+git-ssh-push - Helper "server-side" program used by git-ssh-pull | ||
|
||
|
||
SYNOPSIS | ||
-------- | ||
-'git-rpush' | ||
+'git-ssh-push' | ||
|
||
DESCRIPTION | ||
----------- | ||
-Helper "server-side" program used by git-rpull. | ||
+Helper "server-side" program used by git-ssh-pull. | ||
|
||
|
||
Author | ||
diff --git a/Documentation/git.txt b/Documentation/git.txt | ||
--- a/Documentation/git.txt | ||
+++ b/Documentation/git.txt | ||
@@ -148,7 +148,7 @@ link:git-resolve-script.html[git-resolve | ||
link:git-tag-script.html[git-tag-script]:: | ||
An example script to create a tag object signed with GPG | ||
|
||
-link:git-rpull.html[git-rpull]:: | ||
+link:git-ssh-pull.html[git-ssh-pull]:: | ||
Pulls from a remote repository over ssh connection | ||
|
||
Interogators: | ||
@@ -156,8 +156,8 @@ Interogators: | ||
link:git-diff-helper.html[git-diff-helper]:: | ||
Generates patch format output for git-diff-* | ||
|
||
-link:git-rpush.html[git-rpush]:: | ||
- Helper "server-side" program used by git-rpull | ||
+link:git-ssh-push.html[git-ssh-push]:: | ||
+ Helper "server-side" program used by git-ssh-pull | ||
|
||
|
||
|
||
diff --git a/Makefile b/Makefile | ||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -30,7 +30,7 @@ PROG= git-update-cache git-diff-files | ||
git-checkout-cache git-diff-tree git-rev-tree git-ls-files \ | ||
git-check-files git-ls-tree git-merge-base git-merge-cache \ | ||
git-unpack-file git-export git-diff-cache git-convert-cache \ | ||
- git-http-pull git-rpush git-rpull git-rev-list git-mktag \ | ||
+ git-http-pull git-ssh-push git-ssh-pull git-rev-list git-mktag \ | ||
git-diff-helper git-tar-tree git-local-pull git-write-blob \ | ||
git-get-tar-commit-id git-mkdelta git-apply git-stripspace | ||
|
||
@@ -105,8 +105,8 @@ git-diff-cache: diff-cache.c | ||
git-convert-cache: convert-cache.c | ||
git-http-pull: http-pull.c pull.c | ||
git-local-pull: local-pull.c pull.c | ||
-git-rpush: rsh.c | ||
-git-rpull: rsh.c pull.c | ||
+git-ssh-push: rsh.c | ||
+git-ssh-pull: rsh.c pull.c | ||
git-rev-list: rev-list.c | ||
git-mktag: mktag.c | ||
git-diff-helper: diff-helper.c | ||
diff --git a/rpull.c b/ssh-pull.c | ||
similarity index 97% | ||
rename from rpull.c | ||
rename to ssh-pull.c | ||
--- a/rpull.c | ||
+++ b/ssh-pull.c | ||
@@ -64,13 +64,13 @@ int main(int argc, char **argv) | ||
arg++; | ||
} | ||
if (argc < arg + 2) { | ||
- usage("git-rpull [-c] [-t] [-a] [-v] [-d] [--recover] commit-id url"); | ||
+ usage("git-ssh-pull [-c] [-t] [-a] [-v] [-d] [--recover] commit-id url"); | ||
return 1; | ||
} | ||
commit_id = argv[arg]; | ||
url = argv[arg + 1]; | ||
|
||
- if (setup_connection(&fd_in, &fd_out, "git-rpush", url, arg, argv + 1)) | ||
+ if (setup_connection(&fd_in, &fd_out, "git-ssh-push", url, arg, argv + 1)) | ||
return 1; | ||
|
||
if (get_version()) | ||
diff --git a/rpush.c b/ssh-push.c | ||
similarity index 93% | ||
rename from rpush.c | ||
rename to ssh-push.c | ||
--- a/rpush.c | ||
+++ b/ssh-push.c | ||
@@ -16,7 +16,7 @@ int serve_object(int fd_in, int fd_out) | ||
do { | ||
size = read(fd_in, sha1 + posn, 20 - posn); | ||
if (size < 0) { | ||
- perror("git-rpush: read "); | ||
+ perror("git-ssh-push: read "); | ||
return -1; | ||
} | ||
if (!size) | ||
@@ -30,7 +30,7 @@ int serve_object(int fd_in, int fd_out) | ||
buf = map_sha1_file(sha1, &objsize); | ||
|
||
if (!buf) { | ||
- fprintf(stderr, "git-rpush: could not find %s\n", | ||
+ fprintf(stderr, "git-ssh-push: could not find %s\n", | ||
sha1_to_hex(sha1)); | ||
remote = -1; | ||
} | ||
@@ -45,9 +45,9 @@ int serve_object(int fd_in, int fd_out) | ||
size = write(fd_out, buf + posn, objsize - posn); | ||
if (size <= 0) { | ||
if (!size) { | ||
- fprintf(stderr, "git-rpush: write closed"); | ||
+ fprintf(stderr, "git-ssh-push: write closed"); | ||
} else { | ||
- perror("git-rpush: write "); | ||
+ perror("git-ssh-push: write "); | ||
} | ||
return -1; | ||
} | ||
@@ -71,7 +71,7 @@ void service(int fd_in, int fd_out) { | ||
retval = read(fd_in, &type, 1); | ||
if (retval < 1) { | ||
if (retval < 0) | ||
- perror("rpush: read "); | ||
+ perror("git-ssh-push: read "); | ||
return; | ||
} | ||
if (type == 'v' && serve_version(fd_in, fd_out)) | ||
@@ -91,12 +91,12 @@ int main(int argc, char **argv) | ||
arg++; | ||
} | ||
if (argc < arg + 2) { | ||
- usage("git-rpush [-c] [-t] [-a] commit-id url"); | ||
+ usage("git-ssh-push [-c] [-t] [-a] commit-id url"); | ||
return 1; | ||
} | ||
commit_id = argv[arg]; | ||
url = argv[arg + 1]; | ||
- if (setup_connection(&fd_in, &fd_out, "git-rpull", url, arg, argv + 1)) | ||
+ if (setup_connection(&fd_in, &fd_out, "git-ssh-pull", url, arg, argv + 1)) | ||
return 1; | ||
|
||
service(fd_in, fd_out); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Makefile | 2 +- | ||
git-fetch-script | 5 ----- | ||
git-pull-script | 34 +--------------------------------- | ||
3 files changed, 2 insertions(+), 39 deletions(-) | ||
copy git-pull-script => git-fetch-script (87%) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
7ef76925d9c19ef74874e1735e2436e56d0c4897 (from 6b14d7faf0bad026a81a27bac07b47691f621b8f) | ||
diff --git a/Makefile b/Makefile | ||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -20,7 +20,7 @@ INSTALL=install | ||
|
||
SCRIPTS=git-apply-patch-script git-merge-one-file-script git-prune-script \ | ||
git-pull-script git-tag-script git-resolve-script git-whatchanged \ | ||
- git-deltafy-script | ||
+ git-deltafy-script git-fetch-script | ||
|
||
PROG= git-update-cache git-diff-files git-init-db git-write-tree \ | ||
git-read-tree git-commit-tree git-cat-file git-fsck-cache \ | ||
diff --git a/git-pull-script b/git-fetch-script | ||
similarity index 87% | ||
copy from git-pull-script | ||
copy to git-fetch-script | ||
--- a/git-pull-script | ||
+++ b/git-fetch-script | ||
@@ -39,8 +39,3 @@ download_one "$merge_repo/$merge_name" " | ||
|
||
echo "Getting object database" | ||
download_objects "$merge_repo" "$(cat "$GIT_DIR"/MERGE_HEAD)" | ||
- | ||
-git-resolve-script \ | ||
- "$(cat "$GIT_DIR"/HEAD)" \ | ||
- "$(cat "$GIT_DIR"/MERGE_HEAD)" \ | ||
- "$merge_repo" | ||
diff --git a/git-pull-script b/git-pull-script | ||
--- a/git-pull-script | ||
+++ b/git-pull-script | ||
@@ -6,39 +6,7 @@ merge_name=${2:-HEAD} | ||
: ${GIT_DIR=.git} | ||
: ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"} | ||
|
||
-download_one () { | ||
- # remote_path="$1" local_file="$2" | ||
- case "$1" in | ||
- http://*) | ||
- wget -q -O "$2" "$1" ;; | ||
- /*) | ||
- test -f "$1" && cat >"$2" "$1" ;; | ||
- *) | ||
- rsync -L "$1" "$2" ;; | ||
- esac | ||
-} | ||
- | ||
-download_objects () { | ||
- # remote_repo="$1" head_sha1="$2" | ||
- case "$1" in | ||
- http://*) | ||
- git-http-pull -a "$2" "$1/" | ||
- ;; | ||
- /*) | ||
- git-local-pull -l -a "$2" "$1/" | ||
- ;; | ||
- *) | ||
- rsync -avz --ignore-existing \ | ||
- "$1/objects/." "$GIT_OBJECT_DIRECTORY"/. | ||
- ;; | ||
- esac | ||
-} | ||
- | ||
-echo "Getting remote $merge_name" | ||
-download_one "$merge_repo/$merge_name" "$GIT_DIR"/MERGE_HEAD | ||
- | ||
-echo "Getting object database" | ||
-download_objects "$merge_repo" "$(cat "$GIT_DIR"/MERGE_HEAD)" | ||
+git-fetch-script "$merge_repo" "$merge_name" | ||
|
||
git-resolve-script \ | ||
"$(cat "$GIT_DIR"/HEAD)" \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Documentation/git-ls-tree.txt | 20 +- | ||
ls-tree.c | 459 ++++++++++++++++++++++------------------- | ||
t/t3100-ls-tree-restrict.sh | 3 | ||
tree.c | 2 | ||
tree.h | 1 | ||
5 files changed, 262 insertions(+), 223 deletions(-) | ||
rewrite ls-tree.c (82%) |
Oops, something went wrong.