git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] lib-rebase.sh: fake-editor.sh: Allow checking of commit header(s) in $GIT_EDITOR
@ 2010-07-10 12:27 Nazri Ramliy
  2010-07-10 12:27 ` [PATCH 2/2] rebase -i: Preserve whitespace at beginning of commit header " Nazri Ramliy
  2010-07-12  6:08 ` [PATCH 1/2] lib-rebase.sh: fake-editor.sh: Allow checking of commit header(s) " Junio C Hamano
  0 siblings, 2 replies; 16+ messages in thread
From: Nazri Ramliy @ 2010-07-10 12:27 UTC (permalink / raw)
  To: git, gitster, johannes.schindelin; +Cc: Nazri Ramliy

Signed-off-by: Nazri Ramliy <ayiehere@gmail.com>
---
 t/lib-rebase.sh |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index 6aefe27..21d2fef 100644
--- a/t/lib-rebase.sh
+++ b/t/lib-rebase.sh
@@ -4,6 +4,8 @@
 #
 # - override the commit message with $FAKE_COMMIT_MESSAGE
 # - amend the commit message with $FAKE_COMMIT_AMEND
+# - check that the commit header(s) text shown in the editor matches that in the
+#   file $EXPECT_HEADER.
 # - check that non-commit messages have a certain line count with $EXPECT_COUNT
 # - check the commit count in the commit message header with $EXPECT_HEADER_COUNT
 # - rewrite a rebase -i script as directed by $FAKE_LINES.
@@ -34,6 +36,12 @@ case "$1" in
 	exit
 	;;
 esac
+test -z "$EXPECT_HEADER" ||
+	(
+		grep '^pick' < "$1" | cut -d' ' -f3- > commit_headers.$$ &&
+		diff "$EXPECT_HEADER" commit_headers.$$ > /dev/null
+	) ||
+	exit
 test -z "$EXPECT_COUNT" ||
 	test "$EXPECT_COUNT" = $(sed -e '/^#/d' -e '/^$/d' < "$1" | wc -l) ||
 	exit
-- 
1.7.2.rc2

^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH 1/2] lib-rebase.sh: fake-editor.sh: Allow checking of commit header(s) in $GIT_EDITOR
@ 2010-07-12  1:04 Nazri Ramliy
  2010-07-12  1:04 ` [PATCH 2/2] rebase -i: Preserve whitespace at beginning of commit header " Nazri Ramliy
  0 siblings, 1 reply; 16+ messages in thread
From: Nazri Ramliy @ 2010-07-12  1:04 UTC (permalink / raw)
  To: git, gitster, johannes.schindelin; +Cc: Nazri Ramliy

Signed-off-by: Nazri Ramliy <ayiehere@gmail.com>
---
 t/lib-rebase.sh |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index 6aefe27..5804d23 100644
--- a/t/lib-rebase.sh
+++ b/t/lib-rebase.sh
@@ -4,6 +4,8 @@
 #
 # - override the commit message with $FAKE_COMMIT_MESSAGE
 # - amend the commit message with $FAKE_COMMIT_AMEND
+# - check that commit header(s) in the editor matches that in the
+#   file $EXPECT_HEADER.
 # - check that non-commit messages have a certain line count with $EXPECT_COUNT
 # - check the commit count in the commit message header with $EXPECT_HEADER_COUNT
 # - rewrite a rebase -i script as directed by $FAKE_LINES.
@@ -34,6 +36,12 @@ case "$1" in
 	exit
 	;;
 esac
+test -z "$EXPECT_HEADER" ||
+	(
+		grep '^pick' < "$1" | cut -d' ' -f3- > commit_headers.$$ &&
+		diff "$EXPECT_HEADER" commit_headers.$$ > /dev/null
+	) ||
+	exit
 test -z "$EXPECT_COUNT" ||
 	test "$EXPECT_COUNT" = $(sed -e '/^#/d' -e '/^$/d' < "$1" | wc -l) ||
 	exit
-- 
1.7.2.rc2

^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH 1/2] lib-rebase.sh: fake-editor.sh: Allow checking of non-comment lines in $GIT_EDITOR
@ 2010-07-09  5:20 Nazri Ramliy
  2010-07-09  5:20 ` [PATCH 2/2] rebase -i: Preserve whitespace at beginning of commit header " Nazri Ramliy
  0 siblings, 1 reply; 16+ messages in thread
From: Nazri Ramliy @ 2010-07-09  5:20 UTC (permalink / raw)
  To: git; +Cc: johannes.schindelin, Nazri Ramliy

Signed-off-by: Nazri Ramliy <ayiehere@gmail.com>
---
This is in preparation of patch 2/2 in this series.

nazri.

 t/lib-rebase.sh |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index 6aefe27..e1a33fc 100644
--- a/t/lib-rebase.sh
+++ b/t/lib-rebase.sh
@@ -4,6 +4,10 @@
 #
 # - override the commit message with $FAKE_COMMIT_MESSAGE
 # - amend the commit message with $FAKE_COMMIT_AMEND
+# - check that the non-comment text shown in the editor matches that in the
+#   file $EXPECT_NON_COMMENT_LINES. To make the comparison ignore the commit ids
+#   use the string "COMMIT_ID" in place of the sha1 in your 'expect' file and set
+#   REPLACE_COMMIT_ID=COMMIT_ID
 # - check that non-commit messages have a certain line count with $EXPECT_COUNT
 # - check the commit count in the commit message header with $EXPECT_HEADER_COUNT
 # - rewrite a rebase -i script as directed by $FAKE_LINES.
@@ -34,6 +38,17 @@ case "$1" in
 	exit
 	;;
 esac
+test -z "$EXPECT_NON_COMMENT_LINES" ||
+	(
+		grep -v '^#' < "$1" > out_non_comment.$$ &&
+		if test -n "$REPLACE_COMMIT_ID"
+		then
+			sed -i "s/^\([a-z]\+\) [0-9a-f]\+ /\1 $REPLACE_COMMIT_ID /" \
+			out_non_comment.$$
+		fi &&
+		diff "$EXPECT_NON_COMMENT_LINES" out_non_comment.$$ > /dev/null
+	) ||
+	exit
 test -z "$EXPECT_COUNT" ||
 	test "$EXPECT_COUNT" = $(sed -e '/^#/d' -e '/^$/d' < "$1" | wc -l) ||
 	exit
-- 
1.7.2.rc2

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-07-13  5:19 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-10 12:27 [PATCH 1/2] lib-rebase.sh: fake-editor.sh: Allow checking of commit header(s) in $GIT_EDITOR Nazri Ramliy
2010-07-10 12:27 ` [PATCH 2/2] rebase -i: Preserve whitespace at beginning of commit header " Nazri Ramliy
2010-07-10 16:35   ` Nazri Ramliy
2010-07-12  6:05   ` Junio C Hamano
2010-07-13  1:46     ` Nazri Ramliy
2010-07-13  5:06       ` Junio C Hamano
2010-07-13  5:19         ` Nazri Ramliy
2010-07-12  6:08 ` [PATCH 1/2] lib-rebase.sh: fake-editor.sh: Allow checking of commit header(s) " Junio C Hamano
2010-07-13  0:36   ` Nazri Ramliy
2010-07-13  1:39     ` Jay Soffian
2010-07-13  1:58       ` Nazri Ramliy
2010-07-13  5:13         ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2010-07-12  1:04 Nazri Ramliy
2010-07-12  1:04 ` [PATCH 2/2] rebase -i: Preserve whitespace at beginning of commit header " Nazri Ramliy
2010-07-09  5:20 [PATCH 1/2] lib-rebase.sh: fake-editor.sh: Allow checking of non-comment lines " Nazri Ramliy
2010-07-09  5:20 ` [PATCH 2/2] rebase -i: Preserve whitespace at beginning of commit header " Nazri Ramliy
2010-07-09 22:37   ` Junio C Hamano
2010-07-10 12:22     ` Nazri Ramliy

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).