* [PATCH 0/5] Several ui-patch.c tweaks and tests!
@ 2013-08-26 18:38 cgit
2013-08-26 18:38 ` [PATCH 1/5] t0108: Avoid unnecessary fork() cgit
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: cgit @ 2013-08-26 18:38 UTC (permalink / raw)
Adding tests for the new ui-patch.c features. Also contains fixes for
two minor issues I discovered while writing those tests.
Lukas Fleischer (5):
t0108: Avoid unnecessary fork()
ui-patch.c: Fix signature delimiter
ui-patch.c: Add additional newline after each patch
t0108: Compare output with git-format-patch(1)
t0108: Add tests for revision ranges
tests/t0108-patch.sh | 30 +++++++++++++++++++++++++++---
ui-patch.c | 2 +-
2 files changed, 28 insertions(+), 4 deletions(-)
--
1.8.4.rc3.500.gc3113b0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/5] t0108: Avoid unnecessary fork()
2013-08-26 18:38 [PATCH 0/5] Several ui-patch.c tweaks and tests! cgit
@ 2013-08-26 18:38 ` cgit
2013-08-26 18:38 ` [PATCH 2/5] ui-patch.c: Fix signature delimiter cgit
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cgit @ 2013-08-26 18:38 UTC (permalink / raw)
Use `git rev-list --max-parents=0 HEAD` instead of `git rev-list HEAD |
tail -1` to get the root commit. This works since Git 1.7.4.2.
Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
---
tests/t0108-patch.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/t0108-patch.sh b/tests/t0108-patch.sh
index 3b5bae4..867d739 100755
--- a/tests/t0108-patch.sh
+++ b/tests/t0108-patch.sh
@@ -24,7 +24,7 @@ test_expect_success 'find `cgit` signature' '
'
test_expect_success 'find initial commit' '
- root=$(git --git-dir="$PWD/repos/foo/.git" rev-list HEAD | tail -1)
+ root=$(git --git-dir="$PWD/repos/foo/.git" rev-list --max-parents=0 HEAD)
'
test_expect_success 'generate patch for initial commit' '
--
1.8.4.rc3.500.gc3113b0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/5] ui-patch.c: Fix signature delimiter
2013-08-26 18:38 [PATCH 0/5] Several ui-patch.c tweaks and tests! cgit
2013-08-26 18:38 ` [PATCH 1/5] t0108: Avoid unnecessary fork() cgit
@ 2013-08-26 18:38 ` cgit
2013-08-26 18:38 ` [PATCH 3/5] ui-patch.c: Add additional newline after each patch cgit
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cgit @ 2013-08-26 18:38 UTC (permalink / raw)
Add a missing space after the "--" marker that introduces the patch
signature.
Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
---
ui-patch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui-patch.c b/ui-patch.c
index 4d35167..6df105e 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -80,6 +80,6 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
while ((commit = get_revision(&rev)) != NULL) {
log_tree_commit(&rev, commit);
- printf("--\ncgit %s\n", cgit_version);
+ printf("-- \ncgit %s\n", cgit_version);
}
}
--
1.8.4.rc3.500.gc3113b0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/5] ui-patch.c: Add additional newline after each patch
2013-08-26 18:38 [PATCH 0/5] Several ui-patch.c tweaks and tests! cgit
2013-08-26 18:38 ` [PATCH 1/5] t0108: Avoid unnecessary fork() cgit
2013-08-26 18:38 ` [PATCH 2/5] ui-patch.c: Fix signature delimiter cgit
@ 2013-08-26 18:38 ` cgit
2013-08-26 18:38 ` [PATCH 4/5] t0108: Compare output with git-format-patch(1) cgit
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cgit @ 2013-08-26 18:38 UTC (permalink / raw)
For consistency with git-format-patch(1).
Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
---
tests/t0108-patch.sh | 4 ++--
ui-patch.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/t0108-patch.sh b/tests/t0108-patch.sh
index 867d739..33675af 100755
--- a/tests/t0108-patch.sh
+++ b/tests/t0108-patch.sh
@@ -20,7 +20,7 @@ test_expect_success 'find `Subject:` line' '
'
test_expect_success 'find `cgit` signature' '
- tail -1 tmp | grep "^cgit"
+ tail -2 tmp | head -1 | grep "^cgit"
'
test_expect_success 'find initial commit' '
@@ -32,7 +32,7 @@ test_expect_success 'generate patch for initial commit' '
'
test_expect_success 'find `cgit` signature' '
- tail -1 tmp | grep "^cgit"
+ tail -2 tmp | head -1 | grep "^cgit"
'
test_done
diff --git a/ui-patch.c b/ui-patch.c
index 6df105e..333bb99 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -80,6 +80,6 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
while ((commit = get_revision(&rev)) != NULL) {
log_tree_commit(&rev, commit);
- printf("-- \ncgit %s\n", cgit_version);
+ printf("-- \ncgit %s\n\n", cgit_version);
}
}
--
1.8.4.rc3.500.gc3113b0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/5] t0108: Compare output with git-format-patch(1)
2013-08-26 18:38 [PATCH 0/5] Several ui-patch.c tweaks and tests! cgit
` (2 preceding siblings ...)
2013-08-26 18:38 ` [PATCH 3/5] ui-patch.c: Add additional newline after each patch cgit
@ 2013-08-26 18:38 ` cgit
2013-08-26 18:38 ` [PATCH 5/5] t0108: Add tests for revision ranges cgit
2013-08-26 19:05 ` [PATCH 0/5] Several ui-patch.c tweaks and tests! Jason
5 siblings, 0 replies; 7+ messages in thread
From: cgit @ 2013-08-26 18:38 UTC (permalink / raw)
Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
---
tests/t0108-patch.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tests/t0108-patch.sh b/tests/t0108-patch.sh
index 33675af..0a2ec2e 100755
--- a/tests/t0108-patch.sh
+++ b/tests/t0108-patch.sh
@@ -23,6 +23,13 @@ test_expect_success 'find `cgit` signature' '
tail -2 tmp | head -1 | grep "^cgit"
'
+test_expect_success 'compare with output of git-format-patch(1)' '
+ CGIT_VERSION=$(sed -n "s/CGIT_VERSION = //p" ../../VERSION)
+ git --git-dir="$PWD/repos/foo/.git" format-patch -p --subject-prefix="" --signature="cgit $CGIT_VERSION" --stdout HEAD^ >tmp2
+ sed "1,5d" tmp >tmp_
+ cmp tmp_ tmp2
+'
+
test_expect_success 'find initial commit' '
root=$(git --git-dir="$PWD/repos/foo/.git" rev-list --max-parents=0 HEAD)
'
--
1.8.4.rc3.500.gc3113b0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 5/5] t0108: Add tests for revision ranges
2013-08-26 18:38 [PATCH 0/5] Several ui-patch.c tweaks and tests! cgit
` (3 preceding siblings ...)
2013-08-26 18:38 ` [PATCH 4/5] t0108: Compare output with git-format-patch(1) cgit
@ 2013-08-26 18:38 ` cgit
2013-08-26 19:05 ` [PATCH 0/5] Several ui-patch.c tweaks and tests! Jason
5 siblings, 0 replies; 7+ messages in thread
From: cgit @ 2013-08-26 18:38 UTC (permalink / raw)
Add tests to check whether generating multiple patches at once works.
Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
---
tests/t0108-patch.sh | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tests/t0108-patch.sh b/tests/t0108-patch.sh
index 0a2ec2e..fcc749d 100755
--- a/tests/t0108-patch.sh
+++ b/tests/t0108-patch.sh
@@ -42,4 +42,21 @@ test_expect_success 'find `cgit` signature' '
tail -2 tmp | head -1 | grep "^cgit"
'
+test_expect_success 'generate patches for multiple commits' '
+ id=$(git --git-dir="$PWD/repos/foo/.git" rev-parse HEAD)
+ id2=$(git --git-dir="$PWD/repos/foo/.git" rev-parse HEAD~3)
+ cgit_query "url=foo/patch&id=$id&id2=$id2" >tmp
+'
+
+test_expect_success 'find `cgit` signature' '
+ tail -2 tmp | head -1 | grep "^cgit"
+'
+
+test_expect_success 'compare with output of git-format-patch(1)' '
+ CGIT_VERSION=$(sed -n "s/CGIT_VERSION = //p" ../../VERSION)
+ git --git-dir="$PWD/repos/foo/.git" format-patch -p -N --subject-prefix="" --signature="cgit $CGIT_VERSION" --stdout HEAD~3..HEAD >tmp2
+ sed "1,5d" tmp >tmp_
+ cmp tmp_ tmp2
+'
+
test_done
--
1.8.4.rc3.500.gc3113b0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/5] Several ui-patch.c tweaks and tests!
2013-08-26 18:38 [PATCH 0/5] Several ui-patch.c tweaks and tests! cgit
` (4 preceding siblings ...)
2013-08-26 18:38 ` [PATCH 5/5] t0108: Add tests for revision ranges cgit
@ 2013-08-26 19:05 ` Jason
5 siblings, 0 replies; 7+ messages in thread
From: Jason @ 2013-08-26 19:05 UTC (permalink / raw)
Great series, thanks. Merged to wip.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-08-26 19:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-26 18:38 [PATCH 0/5] Several ui-patch.c tweaks and tests! cgit
2013-08-26 18:38 ` [PATCH 1/5] t0108: Avoid unnecessary fork() cgit
2013-08-26 18:38 ` [PATCH 2/5] ui-patch.c: Fix signature delimiter cgit
2013-08-26 18:38 ` [PATCH 3/5] ui-patch.c: Add additional newline after each patch cgit
2013-08-26 18:38 ` [PATCH 4/5] t0108: Compare output with git-format-patch(1) cgit
2013-08-26 18:38 ` [PATCH 5/5] t0108: Add tests for revision ranges cgit
2013-08-26 19:05 ` [PATCH 0/5] Several ui-patch.c tweaks and tests! Jason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).