Open
Description
It seems that if index.add()
is called with path_rewriter
, it would cancel out the logic for automatic directory paths expansion and traversal. My use case is to call add
with a directory and replace (truncate the dir prefix) the paths of the upcoming commit.
/repo/a/b/c/<files and dirs> <-- I want these files in a commit with a/b/c/ removed
Current behaviour:
Paths replaced first and then directories are not expanded.
Current workaround:
Expand directory paths manually with os.walk
, glob
etc.
Expected behavior:
repo.index.add('a/b/c/', path_rewriter=lambda p: osp.relpath(p, 'a/b/c/'))
# index includes <files> with a/b/c/ prefix removed in paths