git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Adding test for `--keep-cr` for git-mailsplit and git-am.

From
SHStefan-W. Hahn <stefan.hahn@s-hahn.de>
Date
Feb 11, 2010, 18:14 UTC
Message-ID
<20100211181426.GE15028@scotty.home>
In-Reply-To
<1265911741-14840-1-git-send-email-stefan.hahn@s-hahn.de>

This test adds test for git-mailsplit using dos line endings, the command sequence 'git format-patch ... | git am ...' and the configuration variable `mailsplit.keep-cr`.

Signed-off-by: Stefan-W. Hahn <stefan.hahn@s-hahn.de>
---
 t/t5101-mailinfo-dos.sh |   75 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 75 insertions(+), 0 deletions(-)
 create mode 100644 t/t5101-mailinfo-dos.sh
diff --git a/t/t5101-mailinfo-dos.sh b/t/t5101-mailinfo-dos.sh
new file mode 100644
index 0000000..0afa713
--- /dev/null
+++ b/t/t5101-mailinfo-dos.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Stefan-W. Hahn
+#
+
+test_description='git-mailsplit mbox with dos line ending.
+
+'
+. ./test-lib.sh
+
+# This primes main.c file that indents without using HT at all.
+# Various patches with HT and other spaces are attempted in the test.
+
+cat > file1 <<\EOF
+line 1
+EOF
+
+cat > file2 <<\EOF
+line 1
+line 2
+EOF
+
+cat > file3 <<\EOF
+line 1
+line 2
+line 3
+EOF
+
+test_expect_success 'setup repository with dos files' '
+        append_cr <file1 >file
+        git add file &&
+        git commit -m Initial &&
+        git tag start &&
+        append_cr <file2 >file
+        git commit -a -m Second &&
+        git tag start2 &&
+        append_cr <file3 >file
+        git commit -a -m Third &&
+	git format-patch -k --stdout start.. > format-patch.diff
+'
+
+test_expect_failure 'mailsplit format-patch of dos files' '
+        mkdir split &&
+        git mailsplit -osplit format-patch.diff &&
+        cat split/0001 split/0002 > mailsplit.diff &&
+        test_cmp format-patch.diff mailsplit.diff
+'
+
+test_expect_success 'mailsplit --keep-cr format-patch of dos files' '
+        mkdir split2 &&
+        git mailsplit --keep-cr -osplit2 format-patch.diff &&
+        cat split2/0001 split2/0002 > mailsplit2.diff &&
+        test_cmp format-patch.diff mailsplit2.diff
+'
+
+test_expect_success 'format-patch with dos files --keep-cr' '
+        git checkout -b new start &&
+	git format-patch -k --stdout start..master | git am --keep-cr -k -3 &&
+        git diff master
+'
+
+test_expect_success 'format-patch with dos files -e' '
+        git checkout -b new2 start &&
+	git format-patch -k --stdout start..master | git am -e -k -3 &&
+        git diff master
+'
+
+test_expect_success 'format-patch with dos files config.mailsplit' '
+        git config mailsplit.keep-cr 1 &&
+        git checkout -b new3 start &&
+	git format-patch -k --stdout start..master | git am -k -3 &&
+        git diff master
+'
+
+test_done
-- 
1.7.0.rc1.50.g84249.dirty
Previous: Stefan-W. Hahn
Message 6 of 6 in “git-mailsplit: Show parameter '--keep-cr' in usage and documentation”
  1. Stefan-W. HahnFeb 11, 2010
  2. git-mailsplit: add `mailsplit.keep-cr` configuration variable.Stefan-W. Hahn, Feb 11, 2010
  3. Jakub NarebskiFeb 11, 2010
  4. Junio C HamanoFeb 11, 2010
  5. git-am: Add command line parameter `--keep-cr` passing it to git-mailsplit.Stefan-W. Hahn, Feb 11, 2010
  6. Adding test for `--keep-cr` for git-mailsplit and git-am.Stefan-W. Hahn, Feb 11, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.