From: Denton Liu Date: Tue, 29 Sep 2020 06:18:30 GMT Subject: [BUG] git checkout -p HEAD... Message-ID: <20200929061830.GA40759@generichostname> Hi all, git checkout -p ... is broken: $ git checkout HEAD... -p usage: git diff-index [-m] [--cached] [] [...] common diff options: -z output diff-raw with lines terminated with NUL. -p output patch format. -u synonym for -p. --patch-with-raw output both a patch and the diff-raw format. --stat show diffstat instead of patch. --numstat show numeric diffstat instead of patch. --patch-with-stat output a patch and prepend its diffstat. --name-only show only names of changed files. --name-status show names and status of changed files. --full-index show full object name on index lines. --abbrev= abbreviate object names in diff-tree header and diff-raw. -R swap input file pairs. -B detect complete rewrites. -M detect renames. -C detect copies. --find-copies-harder try unchanged files as candidate for copy detection. -l limit rename attempts up to paths. -O reorder diffs according to the . -S find filepair whose only one side contains the string. --pickaxe-all show all files diff when -S is used and hit is found. -a --text treat all files as text. Cannot close git diff-index --cached --numstat --summary HEAD... -- () at /home/denton/.local/libexec/git-core/git-add--interactive line 183. The issue is simple: `HEAD...` is passed literally to `git diff-index` which does not know how to handle it. The fix is simple: figure out the OID and pass that instead. One thing I'm not quite sure about is that in the documentation, the restore-related checkout options accept and it's an implementation detail that the `...` form happens to work in the non-patch case. In fact, `git restore --source=HEAD...` works too (unless -p is given as well). So I lean on the side of fully supporting the `...` form for `git restore/checkout`. However, I understand if someone wishes to suggest "that was never valid to begin with; we should prohibit `...` from being used with restore-modes`. Any opposition to fully supporting the `...` form? Thanks, Denton