Re: [PATCH 6/8] checkout: add --cached option
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Feb 19, 2019, 04:20 UTC
- Message-ID
- <CACsJy8CQhWeC3b6eGPePuRejfOx7c17X61-wqq5kOiRzYkRESw@mail.gmail.com>
- In-Reply-To
- <xmqqlg2zz90l.fsf@gitster-ct.c.googlers.com>
On Sat, Feb 2, 2019 at 12:57 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> > Duy Nguyen <pclouds@gmail.com> writes: > > > Of course we could just do --index and --worktree, each option > > restores the respective part. Then it's combinable (and extensible in > > the future). But then "git restore" means "git restore --index > > --worktree" and typing "git restore --index" effectively removes the > > default "--worktree", which seems a bit twisted. > > Or "git restore --no-worktree" (essentially, instead of saying > "keep", say "no" to mean "negation"). > > Incidentally, "git restore --no-index" does not have a counterpart > in "git checkout", but I think it is probably a good thing to add; > as it has to do far more than "git cat-file blob $tree:$path >$path" > these days.
OK this hopefully will be the final design
(git restore) "[--worktree] <paths>" restores worktree paths from index
"--index <paths>" restores the index from HEAD (aka "git reset")
"--source <tree> (--index|--worktree) <paths>" restores index or worktree (or both) from <tree>
I'm a bit reluctant to support "git restore --index --worktree <paths>" without --source, which should default to HEAD, since it's a bit unclear/inconsistent ("git restore --worktree <paths>" defaults to index as the source, but here we use a different default source).
-- Duy