git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 2/3] t3700: merge two tests into one

From
Ingo Brückl <ib@wupperonline.de>
Date
Jul 30, 2016, 20:13 UTC
Message-ID
<579d0a83.7ea9341c.bm001@wupperonline.de>

Depending on the underlying platform a chmod may be a noop. Although it wouldn't harm the result of the '--chmod=-x' test, there is a more robust way to make sure the --chmod option works both ways.

Merge the two separate tests for the --chmod option into one, checking both permissions on the same file.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>
---
 t/t3700-add.sh | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 494f5b8..1fa5dfd 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -332,24 +332,18 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file out
 	test_i18ncmp expect.err actual.err
 '

-test_expect_success 'git add --chmod=+x stages a non-executable file with +x' '
+test_expect_success 'git add --chmod=[+-]x stages correctly' '
 	rm -f foo1 &&
 	echo foo >foo1 &&
 	git add --chmod=+x foo1 &&
 	case "$(git ls-files --stage foo1)" in
 	100755" "*foo1) echo pass;;
 	*) echo fail; git ls-files --stage foo1; (exit 1);;
-	esac
-'
-
-test_expect_success 'git add --chmod=-x stages an executable file with -x' '
-	rm -f xfoo1 &&
-	echo foo >xfoo1 &&
-	chmod 755 xfoo1 &&
-	git add --chmod=-x xfoo1 &&
-	case "$(git ls-files --stage xfoo1)" in
-	100644" "*xfoo1) echo pass;;
-	*) echo fail; git ls-files --stage xfoo1; (exit 1);;
+	esac &&
+	git add --chmod=-x foo1 &&
+	case "$(git ls-files --stage foo1)" in
+	100644" "*foo1) echo pass;;
+	*) echo fail; git ls-files --stage foo1; (exit 1);;
 	esac
 '

--
2.9.2
Message 1 of 1 in “t3700: merge two tests into one”
  1. 2/3 t3700: merge two tests into oneIngo Brückl, Jul 30, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.