]> git.ipfire.org Git - thirdparty/git.git/commit
config: refactor include_by_gitdir() into include_by_path()
authorChen Linxuan <me@black-desk.cn>
Mon, 25 May 2026 03:20:08 +0000 (11:20 +0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 May 2026 12:19:42 +0000 (21:19 +0900)
commit0d208eafd1731ce535235e7dbd3bcf7ba44b6836
tree402ff20edbef72c20f0b22aa11180514bf13d43c
parent256554692df0685b45e60778b08802b720880c50
config: refactor include_by_gitdir() into include_by_path()

The include_by_gitdir() function matches the realpath of a given
path against a glob pattern, but its interface is tightly coupled to
the gitdir condition: it takes a struct config_options *opts and
extracts opts->git_dir internally.

Refactor it into a more generic include_by_path() helper that takes
a const char *path parameter directly, and update the gitdir and
gitdir/i callers to pass opts->git_dir explicitly.  No behavior
change, just preparing for the addition of a new worktree condition
that will reuse the same path-matching logic with a different path.

Signed-off-by: Chen Linxuan <me@black-desk.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c