Re: [Census] So who uses git?
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:17
Daniel Barkalow [off-list ref] writes:
I sort of suspect that "git commit some_other_file" should really read HEAD into a temporary index, update "some_other_file" in that (and the main index), and commit it. ... The surprising thing is that "git commit path ..." means "everything I've already mentioned, plus path..." not just "path ...", and it's particularly surprising because people only tend to specify paths when they've done something they don't want to commit.
Interesting idea, and a good point. Not that I particularly would like to encourage people to make partial commits by making it easier, but as long as we allow our users to say "commit path...", your proposal would reduce the confusion. I wonder which is faster, to check if index differs from HEAD and do the temporary index only when they differ, or always use a temporary without checking? The former needs one diff-index --cached, zero or one read-tree, one write-tree and one commit-tree. The latter always needs one read-tree, one write-tree and one commit-tree. Wait. We already do diff-index --cached during git-commit anyway (it is in git-status). Maybe with a bit of code restructuring we can do the temporary index part optional.