Subject: [PATCH v4 0/9] read_tree() and read_tree_recursive() refactoring

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Tue, 16 Mar 2021 16:52:35 +0100

The only changes since v3[1] is a fix for a small test nit by
Elijah[2].

1. https://lore.kernel.org/git/[email-masked]/
2. https://lore.kernel.org/git/[email-masked]/

Ævar Arnfjörð Bjarmason (9):
  ls-files tests: add meaningful --with-tree tests
  tree.c API: move read_tree() into builtin/ls-files.c
  ls-files: don't needlessly pass around stage variable
  ls-files: refactor away read_tree()
  tree.h API: remove support for starting at prefix != ""
  tree.h API: remove "stage" parameter from read_tree_recursive()
  tree.h API: rename read_tree_recursive() to read_tree()
  show tests: add test for "git show <tree>"
  tree.h API: expose read_tree_1() as read_tree_at()

 archive.c                     |  19 +++---
 builtin/checkout.c            |   8 +--
 builtin/log.c                 |   8 +--
 builtin/ls-files.c            |  76 +++++++++++++++++++++-
 builtin/ls-tree.c             |   6 +-
 cache.h                       |   2 +-
 merge-recursive.c             |   6 +-
 t/t3060-ls-files-with-tree.sh |  41 ++++++++++++
 t/t7007-show.sh               |  39 ++++++++++++
 tree.c                        | 117 ++++------------------------------
 tree.h                        |  24 +++----
 11 files changed, 205 insertions(+), 141 deletions(-)

Range-diff:
 -:  ---------- >  1:  b338f2c01a ls-files tests: add meaningful --with-tree tests
 -:  ---------- >  2:  4578b83944 tree.c API: move read_tree() into builtin/ls-files.c
 -:  ---------- >  3:  33656ff63b ls-files: don't needlessly pass around stage variable
 -:  ---------- >  4:  1c96d5d361 ls-files: refactor away read_tree()
 -:  ---------- >  5:  367cb99224 tree.h API: remove support for starting at prefix != ""
 -:  ---------- >  6:  38e36780e2 tree.h API: remove "stage" parameter from read_tree_recursive()
 -:  ---------- >  7:  859902ffd8 tree.h API: rename read_tree_recursive() to read_tree()
 1:  a63c9b49f1 !  8:  8a6bebde23 show tests: add test for "git show <tree>"
    @@ t/t7007-show.sh: test_expect_success 'showing two commits' '
     +
     +test_expect_success 'showing two trees' '
     +	cat >expected <<-EOF &&
    -+	tree main1:
    ++	tree main1^{tree}
     +
     +	main1.t
     +
    -+	tree main2:
    ++	tree main2^{tree}
     +
     +	main1.t
     +	main2.t
     +	EOF
    -+	git show main1: main2: >actual &&
    ++	git show main1^{tree} main2^{tree} >actual &&
     +	test_cmp expected actual
     +'
     +
    @@ t/t7007-show.sh: test_expect_success 'showing two commits' '
     +	mkdir not-recursive/a &&
     +	test_commit -C not-recursive a/file &&
     +	cat >expected <<-EOF &&
    -+	tree a/file:
    ++	tree HEAD^{tree}
     +
     +	a/
     +	main1.t
     +	EOF
    -+	git -C not-recursive show a/file: >actual &&
    ++	git -C not-recursive show HEAD^{tree} >actual &&
     +	test_cmp expected actual
     +'
     +
 2:  570642c862 =  9:  29996dd82b tree.h API: expose read_tree_1() as read_tree_at()
-- 
2.31.0.256.gf0ddda3145