From 779b59690f23fbc1f9af7af05511009f8a9e22bc Mon Sep 17 00:00:00 2001 From: sandr01d <88739791+sandr01d@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:24:11 +0100 Subject: [PATCH] Feature: allow configuring arguments of git ls-files in forgit clean (#481) --- README.md | 13 +++++++------ bin/git-forgit | 4 +++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6db4940..743e3be 100644 --- a/README.md +++ b/README.md @@ -384,12 +384,13 @@ export FORGIT_LOG_FZF_OPTS=' ## other options -| Option | Description | Default | -|-----------------------------|-------------------------------------------|-----------------------------------------------| -| `FORGIT_LOG_FORMAT` | git log format | `%C(auto)%h%d %s %C(black)%C(bold)%cr%Creset` | -| `FORGIT_PREVIEW_CONTEXT` | lines of diff context in preview mode | 3 | -| `FORGIT_FULLSCREEN_CONTEXT` | lines of diff context in full-screen mode | 10 | -| `FORGIT_DIR_VIEW` | command used to preview directories | `tree` if available, otherwise `find` | +| Option | Description | Default | +|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------| +| `FORGIT_LOG_FORMAT` | git log format | `%C(auto)%h%d %s %C(black)%C(bold)%cr%Creset` | +| `FORGIT_PREVIEW_CONTEXT` | lines of diff context in preview mode | 3 | +| `FORGIT_FULLSCREEN_CONTEXT` | lines of diff context in full-screen mode | 10 | +| `FORGIT_DIR_VIEW` | command used to preview directories | `tree` if available, otherwise `find` | +| `FORGIT_CLEAN_LIST_FILES_OPTS` | arguments passed to `git ls-files` together with `--others` to determine which files are shown when invoking `forgit clean` | | # 📦 Optional dependencies diff --git a/bin/git-forgit b/bin/git-forgit index 20b4883..7bddde0 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -616,8 +616,10 @@ _forgit_clean_select_files() { -m -0 $FORGIT_CLEAN_FZF_OPTS " + _forgit_clean_list_files_opts=() + _forgit_parse_array _forgit_clean_list_files_opts "$FORGIT_CLEAN_LIST_FILES_OPTS" # Note: Postfix '/' in directory path should be removed. Otherwise the directory itself will not be removed. - _forgit_list_files --others "$@" | FZF_DEFAULT_OPTS="$opts" fzf | sed 's#/$##' + _forgit_list_files --others "${_forgit_clean_list_files_opts[@]}" "$@" | FZF_DEFAULT_OPTS="$opts" fzf | sed 's#/$##' } # git clean selector