git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Don Zickus <dzickus@redhat.com>
To: git@vger.kernel.org
Cc: Don Zickus <dzickus@redhat.com>
Subject: [PATCH] git-apply tests need to be portable
Date: Thu,  3 Jul 2008 12:00:20 -0400	[thread overview]
Message-ID: <1215100820-23140-1-git-send-email-dzickus@redhat.com> (raw)

When I created the tests for my git-apply patch, I accidently used the '-i'
flag for sed.  Not all versions of sed handle this flag, so I converted
those instances to output to a temp file and move that temp file back to the
original file.

Thanks to Jim Meyering for noticing this!

---

Junio, I am not sure if you want me to resend the whole patch again or is a
small update like this preferred.  I am indifferent either way.

Cheers,
Don
---
 t/t4127-apply-same-fn.sh |   33 ++++++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/t/t4127-apply-same-fn.sh b/t/t4127-apply-same-fn.sh
index 2a6ed77..2726a29 100755
--- a/t/t4127-apply-same-fn.sh
+++ b/t/t4127-apply-same-fn.sh
@@ -14,10 +14,12 @@ test_expect_success setup '
 	git commit -m initial
 '
 test_expect_success 'apply same filename with independent changes' '
-	sed -i -e "s/^d/z/" same_fn &&
+	sed -e "s/^d/z/" same_fn > f &&
+	mv f same_fn &&
 	git diff > patch0 &&
 	git add same_fn &&
-	sed -i -e "s/^i/y/" same_fn &&
+	sed -e "s/^i/y/" same_fn > f &&
+	mv f same_fn &&
 	git diff >> patch0 &&
 	cp same_fn same_fn2 &&
 	git reset --hard &&
@@ -27,10 +29,12 @@ test_expect_success 'apply same filename with independent changes' '
 
 test_expect_success 'apply same filename with overlapping changes' '
 	git reset --hard
-	sed -i -e "s/^d/z/" same_fn &&
+	sed -e "s/^d/z/" same_fn > f &&
+	mv f same_fn &&
 	git diff > patch0 &&
 	git add same_fn &&
-	sed -i -e "s/^e/y/" same_fn &&
+	sed -e "s/^e/y/" same_fn > f &&
+	mv f same_fn &&
 	git diff >> patch0 &&
 	cp same_fn same_fn2 &&
 	git reset --hard &&
@@ -41,10 +45,12 @@ test_expect_success 'apply same filename with overlapping changes' '
 test_expect_success 'apply same new filename after rename' '
 	git reset --hard
 	git mv same_fn new_fn
-	sed -i -e "s/^d/z/" new_fn &&
+	sed -e "s/^d/z/" new_fn > f &&
+	mv f new_fn &&
 	git add new_fn &&
 	git diff -M --cached > patch1 &&
-	sed -i -e "s/^e/y/" new_fn &&
+	sed -e "s/^e/y/" new_fn > f &&
+	mv f new_fn &&
 	git diff >> patch1 &&
 	cp new_fn new_fn2 &&
 	git reset --hard &&
@@ -55,11 +61,13 @@ test_expect_success 'apply same new filename after rename' '
 test_expect_success 'apply same old filename after rename -- should fail.' '
 	git reset --hard
 	git mv same_fn new_fn
-	sed -i -e "s/^d/z/" new_fn &&
+	sed -e "s/^d/z/" new_fn > f &&
+	mv f new_fn &&
 	git add new_fn &&
 	git diff -M --cached > patch1 &&
 	git mv new_fn same_fn
-	sed -i -e "s/^e/y/" same_fn &&
+	sed -e "s/^e/y/" same_fn > f &&
+	mv f same_fn &&
 	git diff >> patch1 &&
 	git reset --hard &&
 	test_must_fail git apply patch1
@@ -68,15 +76,18 @@ test_expect_success 'apply same old filename after rename -- should fail.' '
 test_expect_success 'apply A->B (rename), C->A (rename), A->A -- should pass.' '
 	git reset --hard
 	git mv same_fn new_fn
-	sed -i -e "s/^d/z/" new_fn &&
+	sed -e "s/^d/z/" new_fn > f &&
+	mv f new_fn &&
 	git add new_fn &&
 	git diff -M --cached > patch1 &&
 	git commit -m "a rename" &&
 	git mv other_fn same_fn
-	sed -i -e "s/^e/y/" same_fn &&
+	sed -e "s/^e/y/" same_fn > f &&
+	mv f same_fn &&
 	git add same_fn &&
 	git diff -M --cached >> patch1 &&
-	sed -i -e "s/^g/x/" same_fn &&
+	sed -e "s/^g/x/" same_fn > f &&
+	mv f same_fn &&
 	git diff >> patch1 &&
 	git reset --hard HEAD^ &&
 	git apply patch1
-- 
1.5.6.rc2.48.g13da

             reply	other threads:[~2008-07-03 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-03 16:00 Don Zickus [this message]
2008-07-04  6:43 ` [PATCH] t4127-apply-same-fn: Avoid sed -i Johannes Sixt
2008-07-04 18:39   ` Johannes Schindelin

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=1215100820-23140-1-git-send-email-dzickus@redhat.com \
    --to=dzickus@redhat.com \
    --cc=git@vger.kernel.org \
    /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).