git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t5541: Improve push test
@ 2013-12-09 20:03 Torsten Bögershausen
  2013-12-09 22:10 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Torsten Bögershausen @ 2013-12-09 20:03 UTC (permalink / raw
  To: git; +Cc: tboegi

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 <tboegi@web.de>
---
The following revealed a weakness in t5541:
 commit f9e3c6bebb89de12f2dfdaa1899cb22e9ef32542
 Author: Felipe Contreras <felipe.contreras@gmail.com>
 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

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

* Re: [PATCH] t5541: Improve push test
  2013-12-09 20:03 [PATCH] t5541: Improve push test Torsten Bögershausen
@ 2013-12-09 22:10 ` Junio C Hamano
  2013-12-11 15:13   ` Torsten Bögershausen
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2013-12-09 22:10 UTC (permalink / raw
  To: Torsten Bögershausen; +Cc: git

Torsten Bögershausen <tboegi@web.de> writes:

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

Hmm, what is the reason for the change the output?  The output this
piece is testing is the result of this:

	git push origin master:retsam

	echo "change changed" > path2 &&
	git commit -a -m path2 --amend &&

	# push master too; this ensures there is at least one '"'push'"' command to
	# the remote helper and triggers interaction with the helper.
	test_must_fail git push -v origin +master master:retsam >output 2>&1'

This is run inside test_repo_clone, which has /smart/test_repo.git
as its origin, which in turn has 'master' branch (and nothing else).

It

 - pushes master to another branch retsam;

 - amends its 'master';

 - attempts to push the updated master to force-update master, and
   also retsam without forcing.  The latter needs to be forced to
   succeed, and that is why we expect it to fail.

If the output from the push process says

  + 9d498b0...8598732 master -> master (forced update)
  ! [rejected]        master -> retsam (non-fast-forward)
  error: failed to push some refs to '../test_repo_copy/'

I think that is a good thing to do, no?  After all, that is what we
show with Git native transports.

Is this patch merely matching a test to a broken behaviour of some
sort?  Puzzled...

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

* Re: [PATCH] t5541: Improve push test
  2013-12-09 22:10 ` Junio C Hamano
@ 2013-12-11 15:13   ` Torsten Bögershausen
  0 siblings, 0 replies; 3+ messages in thread
From: Torsten Bögershausen @ 2013-12-11 15:13 UTC (permalink / raw
  To: Junio C Hamano, Torsten Bögershausen, Felipe Contreras; +Cc: git

On 2013-12-09 23.10, Junio C Hamano wrote:
> Torsten Bögershausen <tboegi@web.de> writes:
> 
>> 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)"
> 
> Hmm, what is the reason for the change the output?  The output this
> piece is testing is the result of this:
> 
> 	git push origin master:retsam
> 
> 	echo "change changed" > path2 &&
> 	git commit -a -m path2 --amend &&
> 
> 	# push master too; this ensures there is at least one '"'push'"' command to
> 	# the remote helper and triggers interaction with the helper.
> 	test_must_fail git push -v origin +master master:retsam >output 2>&1'
> 
> This is run inside test_repo_clone, which has /smart/test_repo.git
> as its origin, which in turn has 'master' branch (and nothing else).
> 
> It
> 
>  - pushes master to another branch retsam;
> 
>  - amends its 'master';
> 
>  - attempts to push the updated master to force-update master, and
>    also retsam without forcing.  The latter needs to be forced to
>    succeed, and that is why we expect it to fail.
> 
> If the output from the push process says
> 
>   + 9d498b0...8598732 master -> master (forced update)
>   ! [rejected]        master -> retsam (non-fast-forward)
>   error: failed to push some refs to '../test_repo_copy/'
> 
> I think that is a good thing to do, no?  After all, that is what we
> show with Git native transports.
> 
> Is this patch merely matching a test to a broken behaviour of some
> sort?  Puzzled...
Thanks for the analysis: I thing the patch isn't the way to go.
The regression in t5541 was introduced in f9e3c6bebb89de12.
Which was a cleanup to previous commits:
"transport-helper: add 'force' to 'export' helpers"
So reverting f9e3c6bebb89de fixes t5541, but breaks
contrib/remote-helpers.

Felipe, could you have a look, please ?
/Torsten

 
force

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

end of thread, other threads:[~2013-12-11 15:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-09 20:03 [PATCH] t5541: Improve push test Torsten Bögershausen
2013-12-09 22:10 ` Junio C Hamano
2013-12-11 15:13   ` Torsten Bögershausen

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).