Re: t9902 fails (Was: [PATCH] attr: fix off-by-one directory component length calculation)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jean-Noël AVILA wrote:

> OK. I have installed practically everything related to git from the package 
> manager and there is a git-checkout-branches utility available.
>
> That result defeats the purpose of the test. This needs a tighter environment 
> to work whatever the configuration of the user may be.

Presumably 'git checkout-branches' is from git-stuff.

Here's a patch to make the tested command a little less likely to
conflict with commands from the user's $PATH.  I'm not thrilled with
it because the contents of $PATH are still not tightly controlled, and
this does nothing to avoid problems due to existence of, for example,
a "git cherry-pick-branches" command.

Thoughts?  Maybe it would be enough to check that the intended get
commands are present in the completion list and other git commands are
not, ignoring binaries that might live elsewhere on the $PATH?

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 t/t9902-completion.sh | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 3cd53f8..06dcfb2 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -192,19 +192,19 @@ test_expect_success 'general options' '
 '
 
 test_expect_success 'general options plus command' '
-	test_completion "git --version check" "checkout " &&
-	test_completion "git --paginate check" "checkout " &&
-	test_completion "git --git-dir=foo check" "checkout " &&
-	test_completion "git --bare check" "checkout " &&
-	test_completion "git --help des" "describe " &&
-	test_completion "git --exec-path=foo check" "checkout " &&
-	test_completion "git --html-path check" "checkout " &&
-	test_completion "git --no-pager check" "checkout " &&
-	test_completion "git --work-tree=foo check" "checkout " &&
-	test_completion "git --namespace=foo check" "checkout " &&
-	test_completion "git --paginate check" "checkout " &&
-	test_completion "git --info-path check" "checkout " &&
-	test_completion "git --no-replace-objects check" "checkout "
+	test_completion "git --version cherry-p" "cherry-pick " &&
+	test_completion "git --paginate cherry-p" "cherry-pick " &&
+	test_completion "git --git-dir=foo cherry-p" "cherry-pick " &&
+	test_completion "git --bare cherry-p" "cherry-pick " &&
+	test_completion "git --help cherry-p" "cherry-pick " &&
+	test_completion "git --exec-path=foo cherry-p" "cherry-pick " &&
+	test_completion "git --html-path cherry-p" "cherry-pick " &&
+	test_completion "git --no-pager cherry-p" "cherry-pick " &&
+	test_completion "git --work-tree=foo cherry-p" "cherry-pick " &&
+	test_completion "git --namespace=foo cherry-p" "cherry-pick " &&
+	test_completion "git --paginate cherry-p" "cherry-pick " &&
+	test_completion "git --info-path cherry-p" "cherry-pick " &&
+	test_completion "git --no-replace-objects cherry-p" "cherry-pick "
 '
 
 test_expect_success 'setup for ref completion' '
-- 
1.8.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]