public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: David Turner <dturner@twopensource•com>
Cc: git@vger•kernel.org, David Turner <dturner@twitter•com>
Subject: Re: [PATCH 4/4 v6] cache-tree: Write updated cache-tree after commit
Date: Fri, 11 Jul 2014 08:52:49 -0700	[thread overview]
Message-ID: <xmqq38e76gfi.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1405038686-1138-4-git-send-email-dturner@twitter.com> (David Turner's message of "Thu, 10 Jul 2014 17:31:26 -0700")

David Turner <dturner@twopensource•com> writes:

> @@ -16,8 +16,34 @@ cmp_cache_tree () {
>  # We don't bother with actually checking the SHA1:
>  # test-dump-cache-tree already verifies that all existing data is
>  # correct.

Is this statement now stale and needs to be removed?

> -test_shallow_cache_tree () {
> -	printf "SHA  (%d entries, 0 subtrees)\n" $(git ls-files|wc -l) >expect &&
> +generate_expected_cache_tree_rec () {
> +	dir="$1${1:+/}" &&
> +	parent="$2" &&
> +	# ls-files might have foo/bar, foo/bar/baz, and foo/bar/quux
> +	# We want to count only foo because it's the only direct child
> +	subtrees=$(git ls-files|grep /|cut -d / -f 1|uniq) &&
> +	subtree_count=$(echo "$subtrees"|awk '$1 {++c} END {print c}') &&
> +	entries=$(git ls-files|wc -l) &&
> +	printf "SHA $dir (%d entries, %d subtrees)\n" "$entries" "$subtree_count" &&
> +	for subtree in $subtrees
> +	do
> +	    cd "$subtree"
> +	    generate_expected_cache_tree_rec "$dir$subtree" "$dir" || return 1
> +	    cd ..
> +	done &&
> +	dir=$parent
> +}
> +
> +generate_expected_cache_tree () {
> +    cwd=$(pwd)
> +    generate_expected_cache_tree_rec
> +    ret="$?"
> +    cd "$cwd"
> +    return $ret
> +}

As we always have had trouble between $PWD and $(pwd) on other
platforms, I'd prefer something simpler, like:

	expected_cache_tree () {
		(
                	# subshell to let it wander around freely
	        	generate_expected_cache_tree_rec
		)
	}

Other than these two, the new tests were good from a cursory look.
The change to builtin/commit.c looked good, too.

Thanks.

  reply	other threads:[~2014-07-11 15:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11  0:31 [PATCH 1/4 v6] cache-tree: Create/update cache-tree on checkout David Turner
2014-07-11  0:31 ` [PATCH 2/4 v6] test-dump-cache-tree: invalid trees are not errors David Turner
2014-07-11  0:31 ` [PATCH 3/4 v6] cache-tree: subdirectory tests David Turner
2014-07-11  6:03   ` Eric Sunshine
2014-07-11 15:27     ` Junio C Hamano
2014-07-11 15:40       ` Junio C Hamano
2014-07-11 22:46         ` David Turner
2014-07-13 16:42           ` Junio C Hamano
2014-07-11 22:46       ` David Turner
2014-07-11  0:31 ` [PATCH 4/4 v6] cache-tree: Write updated cache-tree after commit David Turner
2014-07-11 15:52   ` Junio C Hamano [this message]
2014-07-11 23:37     ` David Turner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq38e76gfi.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=dturner@twitter$(echo .)com \
    --cc=dturner@twopensource$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox