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

Re: [PATCH 3/3] cache-tree: Write index with updated cache-tree after commit

From
Torsten Bögershausen <tboegi@web.de>
Date
Jul 1, 2014, 04:26 UTC
Message-ID
<53B2386B.4060802@web.de>
In-Reply-To
<1404173597-24713-3-git-send-email-dturner@twitter.com>
[]
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index 5383258..d50acb8 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -16,8 +16,31 @@ cmp_cache_tree () {
  # We don't bother with actually checking the SHA1:
  # test-dump-cache-tree already verifies that all existing data is
  # correct.
+generate_expected_cache_tree () {
+	if [ -n "$1" ]
+	then
+		local dir="$1/"
+	else
+		local dir="$1"
+	fi

I think the Git test cases prefer "test" over "[]":

	if test -n "$1"
	then
		local dir="$1/"
	else
		local dir="$1"
	fi

And should there be a && after the "fi" ?
And as test -n tests for a non-zero string,
could we write like this (and drop the local ?)?

	if test -n "$1"
	then
		dir="$1/"
	else
		dir=""
	fi
Previous: David TurnerNext: Johannes Sixt
Message 5 of 13 in “cache-tree: Create/update cache-tree on checkout”
  1. 1/3 cache-tree: Create/update cache-tree on checkoutDavid Turner, Jul 1, 2014
  2. 2/3 test-dump-cache-tree: Improve output format and exit codeDavid Turner, Jul 1, 2014
  3. Eric SunshineJul 1, 2014
  4. 3/3 cache-tree: Write index with updated cache-tree after commitDavid Turner, Jul 1, 2014
  5. Torsten BögershausenJul 1, 2014
  6. Johannes SixtJul 1, 2014
  7. Torsten BögershausenJul 1, 2014
  8. David TurnerJul 1, 2014
  9. Junio C HamanoJul 1, 2014
  10. David TurnerJul 1, 2014
  11. Junio C HamanoJul 1, 2014
  12. David TurnerJul 6, 2014
  13. Junio C HamanoJul 7, 2014

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.