On Wed, Feb 20, 2019 at 5:36 AM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Elijah Newren <newren@xxxxxxxxx> writes: > > >> As long as worktree-only mode does not lose track of a > >> previously-untracked path in the index (perhaps use the i-t-a bit), > >> I do not have a strong objection against making the worktree-only > >> mode the default. > > > > Could you unpack that for me a bit? > > Suppose in an ancient version v1.0 there was a file called > README.txt but these days such a file does not exist (there may be > README.md added though). By default, the command does not stuff the > contents to the index out of the tree and instead operate only on > the working tree. > > $ git restore-path --source v1.0 README.txt > > At this point, you are assuming that README.txt will become > untracked and the user needs to manually add it. I was asking if it > makes sense to at least make the index "aware of" it with I-T-A bit, > and I am leaning towards answering "yes" to that question. I completely forgot about i-t-a! Do we want the command to add i-t-a bit by default, or only when --intent-to-add is specified? So far i-t-a has been a conscious choice, both "git reset <commit>" and "git add" require --intent-to-add to use it. The first safe step could be require --intent-to-add even in git-restore, then we could introduce a config key that enables --intent-to-add in both "git restore" and "git reset" (and perhaps "git apply" later, I still need to finish that part). -- Duy