git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use longer alias names in subdirectory tests
@ 2012-12-28 23:03 Aaron Schrab
  2012-12-29  3:42 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron Schrab @ 2012-12-28 23:03 UTC (permalink / raw)
  To: git, gitster

When testing aliases in t/t1020-subdirectory.sh use longer names so that
they're less likely to conflict with a git-* command somewhere in the
$PATH.

I have a git-ss command in my path which prevents the 'ss' alias from
being used.  This command will always fail for git.git, causing the test
to fail.  Even if the command succeeded, that would be a false success
for the test since the alias wasn't actually used.  A longer, more
descriptive name will make it much less likely that somebody has a
command in their $PATH which will shadow the alias created for the test.

While here, use a longer name for the 'test' alias as well since that is
also short and meaningful enough to make it not unlikely that somebody
would have a command in their $PATH which will shadow that as well.

Signed-off-by: Aaron Schrab <aaron@schrab.com>
---
 t/t1020-subdirectory.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index e23ac0e..1e2945e 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -111,19 +111,19 @@ test_expect_success 'read-tree' '
 
 test_expect_success 'alias expansion' '
 	(
-		git config alias.ss status &&
+		git config alias.test-status-alias status &&
 		cd dir &&
 		git status &&
-		git ss
+		git test-status-alias
 	)
 '
 
 test_expect_success NOT_MINGW '!alias expansion' '
 	pwd >expect &&
 	(
-		git config alias.test !pwd &&
+		git config alias.test-alias-directory !pwd &&
 		cd dir &&
-		git test >../actual
+		git test-alias-directory >../actual
 	) &&
 	test_cmp expect actual
 '
@@ -131,9 +131,9 @@ test_expect_success NOT_MINGW '!alias expansion' '
 test_expect_success 'GIT_PREFIX for !alias' '
 	printf "dir/" >expect &&
 	(
-		git config alias.test "!sh -c \"printf \$GIT_PREFIX\"" &&
+		git config alias.test-alias-directory "!sh -c \"printf \$GIT_PREFIX\"" &&
 		cd dir &&
-		git test >../actual
+		git test-alias-directory >../actual
 	) &&
 	test_cmp expect actual
 '
-- 
1.8.1.rc3.16.g47d6ba6

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

* Re: [PATCH] Use longer alias names in subdirectory tests
  2012-12-28 23:03 [PATCH] Use longer alias names in subdirectory tests Aaron Schrab
@ 2012-12-29  3:42 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2012-12-29  3:42 UTC (permalink / raw)
  To: Aaron Schrab; +Cc: git

Aaron Schrab <aaron@schrab.com> writes:

> When testing aliases in t/t1020-subdirectory.sh use longer names so that
> they're less likely to conflict with a git-* command somewhere in the
> $PATH.

Thanks.

In the longer term we might want to rethink the way we run the tests
so that random $PATH the user has has less chance of interacting
with our tests (we had a similar topic around completion output
recently), but until that happens, I think this is a good change.

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

end of thread, other threads:[~2012-12-29  3:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-28 23:03 [PATCH] Use longer alias names in subdirectory tests Aaron Schrab
2012-12-29  3:42 ` Junio C Hamano

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