From: Junio C Hamano Date: Thu, 21 May 2026 01:30:54 GMT Subject: Re: [PATCH v2] git-jump: pick a mode automatically when invoked without arguments Message-ID: In-Reply-To: Junio C Hamano writes: >> +mode_auto() { >> + if test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" != "true"; then >> + usage >&2 >> + exit 1 >> + fi > > That looks like a basic safety measure, which is good. > >> + if test -n "$(git ls-files -u "$@")"; then >> + mode_merge "$@" >> + elif ! git diff --quiet "$@"; then >> + mode_diff "$@" >> + elif ! git diff --check >/dev/null 2>&1; then > > Shouldn't this "diff --check" be restricted by "$@" if given? >> + mode_ws "$@" If there are any unstaged changes (possibly with whitespace errors), 'git diff --quiet' would exit with non-zero, so "elif ! git diff --quiet" would be taken and we do mode_diff. The user cannot rely on "auto" to trigger mode_ws to check whitespace errors in the working tree files because of this. If there is no unstaged changes, 'git diff --quiet' woudl exit with zero, so the control comes to "git diff --check", but then there is nothing mode_ws to work on in that case, right? So it is not clear to me in what situation this auto selection of mode_ws would help us. >> + else >> + usage >&2 >> + exit 1 >> + fi >> +}