Skip to content

RFC grep: don't add subrepos to in-memory alternates

Matheus Tavares git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3diff: use the given repo at diff_populate_filespec()diff.c+1 -10 replies
2/3object: allow parse_object_or_die() to handle any repobuiltin/grep.c builtin/prune.c bundle.c +5 more+24 -170 replies
3/3grep: don't add submodules to the alternates listbuiltin/grep.c grep.c+70 -361 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/3] grep: don't add subrepos to in-memory alternates

Make git-grep --recurse-submodules stop adding subrepos to the in-memory alternates list and, instead, pass a reference to the subrepo struct down to the threads.

This series is based on ew/hashmap (it uses the added container_of macro).

There're some possibly needed changes I'm still unsure about. All feedback will be highly appreciated:

- textconv cache is written to the_repository's object database even for submodules. Should it perhaps be written to submodules' odb instead?

- Considering the following call chain: grep_source_load_driver() > userdiff_find_by_path() > git_check_attr() > collect_some_attrs() > prepare_attr_stack() > bootstrap_attr_stack():

* The last function tries to read the attributes from the .gitattributes and .git/info/attributes files of the_repository. However, for paths inside the submodule, shouldn't it try to read these files from the submodule?

* This function will also call: read_attr() > read_attr_from_index() > read_blob_data_from_index() which might, in turn, call read_object_file(). Shouldn't we pass the subrepo to it so that it can call repo_read_object_file()? (Again, for paths inside the submodule, read_object_file() won't be able to find the object as we won't be adding to alternates anymore.)

Matheus Tavares (3):
diff: use the given repo at diff_populate_filespec()
object: allow parse_object_or_die() to handle any repo
grep: don't add submodules to the alternates list

 builtin/grep.c  | 82 +++++++++++++++++++++++++++++++++++--------------
 builtin/prune.c |  4 +--
 bundle.c        | 13 +++++---
 diff.c          |  2 +-
 grep.c          | 26 ++++++++--------
 object.c        |  5 +--
 object.h        |  4 ++-
 pack-bitmap.c   |  5 +--
 reachable.c     |  4 +--
 upload-pack.c   |  2 +-
 10 files changed, 94 insertions(+), 53 deletions(-)
Signature · 1 line
2.23.0