git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nazri Ramliy <ayiehere@gmail.com>
To: git@vger.kernel.org
Cc: johannes.schindelin@gmx.de, Nazri Ramliy <ayiehere@gmail.com>
Subject: [PATCH 1/2] lib-rebase.sh: fake-editor.sh: Allow checking of non-comment lines in $GIT_EDITOR
Date: Fri,  9 Jul 2010 13:20:42 +0800	[thread overview]
Message-ID: <1278652843-30872-1-git-send-email-ayiehere@gmail.com> (raw)

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

             reply	other threads:[~2010-07-09  5:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-09  5:20 Nazri Ramliy [this message]
2010-07-09  5:20 ` [PATCH 2/2] rebase -i: Preserve whitespace at beginning of commit header in $GIT_EDITOR Nazri Ramliy
2010-07-09 22:37   ` Junio C Hamano
2010-07-10 12:22     ` Nazri Ramliy
2010-07-09 22:30 ` [PATCH 1/2] lib-rebase.sh: fake-editor.sh: Allow checking of non-comment lines " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1278652843-30872-1-git-send-email-ayiehere@gmail.com \
    --to=ayiehere@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).