git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/2] checkout/restore: fix `git checkout -p HEAD...` bug

From
Denton Liu <liu.denton@gmail.com>
Date
Oct 4, 2020, 12:30 UTC
Message-ID
<cover.1601814601.git.liu.denton@gmail.com>
As reported earlier[0], `git checkout -p HEAD...` results in the following error:
	$ git checkout -p HEAD...
	usage: git diff-index [-m] [--cached] [<common-diff-options>] <tree-ish> [<path>...]
	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=<n>  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<n>         limit rename attempts up to <n> paths.
	  -O<file>      reorder diffs according to the <file>.
	  -S<string>    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 <redacted>/libexec/git-core/git-add--interactive line 183.

Since it was decided that <tree-ish> should also officially support the merge-base revs, fix `git checkout -p <rev>...` and officially document the support.

[0]: https://lore.kernel.org/git/20200929061830.GA40759@generichostname/
Denton Liu (2):
  builtin/checkout: fix `git checkout -p HEAD...` bug
  Doc: document "A...B" form for <tree-ish> in checkout and switch
 Documentation/git-checkout.txt |  4 ++++
 Documentation/git-restore.txt  |  4 ++++
 builtin/checkout.c             | 14 +++++++++++++-
 t/t2016-checkout-patch.sh      |  7 +++++++
 t/t2071-restore-patch.sh       |  8 ++++++++
 5 files changed, 36 insertions(+), 1 deletion(-)
-- 
2.28.0.942.g77c4c6094c
Next: Denton Liu
Message 1 of 9 in “checkout/restore: fix `git checkout -p HEAD...` bug”
  1. 0/2 checkout/restore: fix `git checkout -p HEAD...` bugDenton Liu, Oct 4, 2020
  2. 1/2 builtin/checkout: fix `git checkout -p HEAD...` bugDenton Liu, Oct 4, 2020
  3. Junio C HamanoOct 4, 2020
  4. 2/2 Doc: document "A...B" form for <tree-ish> in checkout and switchDenton Liu, Oct 4, 2020
  5. 0/4 checkout/restore: fix `git checkout -p HEAD...` bugDenton Liu, Oct 7, 2020
  6. 1/4 builtin/checkout: fix `git checkout -p HEAD...` bugDenton Liu, Oct 7, 2020
  7. 2/4 Doc: document "A...B" form for <tree-ish> in checkout and switchDenton Liu, Oct 7, 2020
  8. 4/4 t2016: add a NEEDSWORK about the PERL prerequisiteDenton Liu, Oct 7, 2020
  9. 3/4 add-patch: add NEEDSWORK about comparing commitsDenton Liu, Oct 7, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.