Skip to content

Kill the_repository in sha1-name.c

Nguyễn Thái Ngọc Duy git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest31 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/31packfile.c: add repo_approximate_object_count()packfile.c packfile.h+9 -80 replies
2/31refs.c: add refs_ref_exists()refs.c+6 -10 replies
3/31refs.c: add refs_shorten_unambiguous_ref()refs.c refs.h+11 -20 replies
4/31refs.c: remove the_repo from substitute_branch_name()cache.h refs.c sha1-name.c+17 -80 replies
5/31refs.c: remove the_repo from expand_ref()refs.c refs.h upload-pack.c+8 -60 replies
6/31refs.c: add repo_dwim_ref()refs.c refs.h+10 -30 replies
7/31refs.c: add repo_dwim_log()refs.c refs.h+16 -60 replies
8/31refs.c: remove the_repo from read_ref_at()builtin/show-branch.c refs.c refs.h +1 more+12 -70 replies
9/31commit.c: add repo_get_commit_tree()commit.c commit.h+5 -31 reply
10/31sha1-name.c: remove the_repo from sort_ambiguous()sha1-name.c+12 -30 replies
11/31sha1-name.c: remove the_repo from find_abbrev_len_packed()sha1-name.c+4 -20 replies
12/31sha1-name.c: add repo_find_unique_abbrev_r()cache.h sha1-name.c+13 -80 replies
13/31sha1-name.c: store and use repo in struct disambiguate_statesha1-name.c+59 -360 replies
14/31sha1-name.c: add repo_for_each_abbrev()cache.h sha1-name.c+5 -30 replies
15/31sha1-name.c: remove the_repo from get_short_oid()sha1-name.c+10 -70 replies
16/31sha1-name.c: remove the_repo from interpret_nth_prior_checkout()sha1-name.c+10 -70 replies
17/31sha1-name.c: remove the_repo from interpret_branch_mark()sha1-name.c+7 -60 replies
18/31sha1-name.c: add repo_interpret_branch_name()sha1-name.c+8 -90 replies
19/31sha1-name.c: remove the_repo from get_oid_oneline()sha1-name.c+7 -60 replies
20/31sha1-name.c: remove the_repo from get_describe_name()sha1-name.c+5 -30 replies
21/31sha1-name.c: remove the_repo from get_oid_basic()sha1-name.c+12 -130 replies
22/31sha1-name.c: remove the_repo from get_oid_1()cache.h sha1-name.c+36 -300 replies
23/31sha1-name.c: remove the_repo from handle_one_ref()sha1-name.c+14 -50 replies
24/31sha1-name.c: remove the_repo from diagnose_invalid_index_path()dir.c dir.h sha1-name.c+15 -40 replies
25/31sha1-name.c: remove the_repo from resolve_relative_path()sha1-name.c+4 -40 replies
26/31sha1-name.c: remove the_repo from get_oid_with_context_1()sha1-name.c+10 -10 replies
27/31sha1-name.c: add repo_get_oid()cache.h sha1-name.c+4 -30 replies
28/31submodule-config.c: use repo_get_oid for reading .gitmodulessubmodule-config.c t/t7814-grep-recurse-submodules.sh+8 -180 replies
29/31sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_namecache.h setup.c sha1-name.c+11 -60 replies
30/31sha1-name.c: remove the_repo from other get_oid_*cache.h sha1-name.c+32 -210 replies
31/31sha1-name.c: remove the_repo from get_oid_mb()cache.h sha1-name.c+13 -80 replies

Reviews trailers per patch

None of the 31 patches has a Reviewed-by or Acked-by.

PatchSZEDER GáborJohannes Schindelin
SeriesHelped-by Helped-by Helped-by Helped-by
1/31
2/31
3/31
4/31
5/31
6/31
7/31
8/31
9/31
10/31
11/31
12/31
13/31
14/31
15/31
16/31
17/31
18/31
19/31
20/31
21/31
22/31
23/31
24/31
25/31
26/31
27/31
28/31
29/31
30/31
31/31

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/31] Kill the_repository in sha1-name.c

This whole series is to fix a known issue from ao/submodule-wo-gitmodules-checked-out. Commit 76e9bdc437 (submodule:
support reading .gitmodules when it's not in the working tree - 2018-10-25) makes "git grep --recurse-submodules" print

warning: nested submodules ... not supported yet

one line per submodule. And it's really annoying when a repo has lots of (non-nested) submodules.

Fixing it requires resolving an extended SHA-1 syntax from a separate repository. Which basically means the whole sha1-name.c has to be aware of 'struct repository' (and a bit more from refs.c as well).

Technically merge-recursive.c, tree-walk.c and config.c have to take 'struct repository *' too, but I reduce the scope a bit since it's already long.

The main fix is 28/31. The rest is just converting code to use 'struct repository *'. Patches after 28/31 are technically not needed, but since I have converted most of sha1-name.c, might as well convert the rest.

There is a new function get_oidf() from another series on 'pu', which can't be converted right now of course. But it could be fixed easily later. It also causes a conflict in cache.h but resolving is straight forward.

Nguyễn Thái Ngọc Duy (31):
packfile.c: add repo_approximate_object_count()
refs.c: add refs_ref_exists()
refs.c: add refs_shorten_unambiguous_ref()
refs.c: remove the_repo from substitute_branch_name() refs.c: remove the_repo from expand_ref()
refs.c: add repo_dwim_ref()
refs.c: add repo_dwim_log()
refs.c: remove the_repo from read_ref_at()
commit.c: add repo_get_commit_tree()
sha1-name.c: remove the_repo from sort_ambiguous() sha1-name.c: remove the_repo from find_abbrev_len_packed() sha1-name.c: add repo_find_unique_abbrev_r() sha1-name.c: store and use repo in struct disambiguate_state sha1-name.c: add repo_for_each_abbrev()
sha1-name.c: remove the_repo from get_short_oid() sha1-name.c: remove the_repo from interpret_nth_prior_checkout() sha1-name.c: remove the_repo from interpret_branch_mark() sha1-name.c: add repo_interpret_branch_name() sha1-name.c: remove the_repo from get_oid_oneline() sha1-name.c: remove the_repo from get_describe_name() sha1-name.c: remove the_repo from get_oid_basic() sha1-name.c: remove the_repo from get_oid_1() sha1-name.c: remove the_repo from handle_one_ref() sha1-name.c: remove the_repo from diagnose_invalid_index_path() sha1-name.c: remove the_repo from resolve_relative_path() sha1-name.c: remove the_repo from get_oid_with_context_1() sha1-name.c: add repo_get_oid()
submodule-config.c: use repo_get_oid for reading .gitmodules sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_name sha1-name.c: remove the_repo from other get_oid_* sha1-name.c: remove the_repo from get_oid_mb()

 builtin/show-branch.c              |   6 +-
 cache.h                            |  50 ++--
 commit.c                           |   5 +-
 commit.h                           |   3 +-
 dir.c                              |   8 +
 dir.h                              |   4 +-
 packfile.c                         |  14 +-
 packfile.h                         |   3 +-
 refs.c                             |  71 ++++--
 refs.h                             |   9 +-
 setup.c                            |   7 +-
 sha1-name.c                        | 388 ++++++++++++++++++-----------
 submodule-config.c                 |  20 +-
 t/t7814-grep-recurse-submodules.sh |   6 +-
 upload-pack.c                      |   2 +-
 15 files changed, 371 insertions(+), 225 deletions(-)
Signature · 1 line
2.21.0.479.g47ac719cd3