restore: default to --source=HEAD when only --staged is specified
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Thu, 25 Apr 2019 09:45:52 +0000 (16:45 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 May 2019 04:04:47 +0000 (13:04 +0900)
commit3a733ce5237570460bbb63e20002b92e903ad65f
tree14e5cd0e77b763e3fd4187bd025fea66c23bcc74
parente3ddd3b5e583e62d874f56f8c88603ad0ebafd5e
restore: default to --source=HEAD when only --staged is specified

"git restore --staged" without --source does not make much sense since
by default we restore from the index.  Instead of copying the index to
itself, set the default source to HEAD in this case, yielding behavior
that matches "git reset -- <paths>".

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c