Subject: [PATCH] t5541: Improve push test

From: Torsten Bögershausen <[email-masked]>
Date: Mon, 9 Dec 2013 21:03:28 +0100

The old log-line looked like this:
 + 9d498b0...8598732 master -> master (forced update)
And the new one like this:
   9d498b0..8598732  master -> master

- Loosen the grep pattern by not demanding "(forced update)"
- Improve the grep pattern and check the new SHA id

Signed-off-by: Torsten Bögershausen <[email-masked]>
---
The following revealed a weakness in t5541:
 commit f9e3c6bebb89de12f2dfdaa1899cb22e9ef32542
 Author: Felipe Contreras <[email-masked]>
 Date:   Tue Nov 12 14:56:57 2013 -0600
    transport-helper: check for 'forced update' message
So don't look for forced update, but check for the SHA.

(I want to fix a missing "&&" as well, that is for the next commit)
diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh
index 470ac54..1468a07 100755
--- a/t/t5541-http-push.sh
+++ b/t/t5541-http-push.sh
@@ -168,7 +168,8 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
 	test_must_fail git push -v origin +master master:retsam >output 2>&1'
 
 test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: remote output' '
-	grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output &&
+	newsha=$(git log --oneline -n1 | sed -e "s/^\([0-9a-f]*\).*/\1/") &&
+	grep "\.\.$newsha *master -> master" output &&
 	grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output
 '
 
-- 
1.8.5