This is about mixing "git add -p" and "git commit -a" (or "git commit
<path>") where you may accidentally lose staged changes. After the
discussion with Jonathan, I'm going with a bit different approach than
v1, this behavior now becomes default, and if the user wants the old
behavior back, they can use --clobber-index.

Another change is "git commit <path>" is covered as well, as pointed
out by Jacob.

I will need to add some test cases of course, if this direction is
still promising. One thing I'm not sure about is whether want to
deliberately clobber the index often, then perhaps we should add a
config key to bring the old behavior back.

Nguyễn Thái Ngọc Duy (1):
  commit: do not clobber the index

 Documentation/git-commit.txt     |  11 +++-
 builtin/commit.c                 | 105 ++++++++++++++++++++++++++++---
 cache.h                          |   1 +
 read-cache.c                     |  11 ++++
 t/t2201-add-update-typechange.sh |   2 +-
 t/t4015-diff-whitespace.sh       |   2 +-
 t/t7102-reset.sh                 |   2 +-
 t/t7500-commit.sh                |   2 +-
 t/t7502-commit.sh                |   4 +-
 t/t9350-fast-export.sh           |   2 +-
 10 files changed, 126 insertions(+), 16 deletions(-)

-- 
2.19.0.rc0.337.ge906d732e7

Reply via email to