summaryrefslogtreecommitdiff
path: root/t/t4008-diff-break-rewrite.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2007-11-18 01:52:55 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2007-11-22 17:05:05 -0800
commit2888605c649ccd423232161186d72c0e6c458a48 (patch)
treea4995bf3674d4562e4159785a1336c26ce2050cf /t/t4008-diff-break-rewrite.sh
parentFix add_files_to_cache() to take pathspec, not user specified list of files (diff)
downloadtgif-2888605c649ccd423232161186d72c0e6c458a48.tar.xz
builtin-commit: fix partial-commit support
When making a partial-commit, we need to prepare two index files, one to be used to write out the tree to be committed (temporary index) and the other to be used as the index file after the commit is made. The temporary index needs to be initialized to HEAD and then all the named paths on the command line need to be staged on top of the index. For this, running add_files_to_cache() that compares what is in the index and the paths given from the command line is not enough -- the comparison will miss the paths that the user previously ran "git add" to the index since the HEAD because the index reset to the HEAD would not know about them. The index file needs to get the same modification done when preparing the temporary index as described above. This implementation mimics the behaviour of the scripted version of git-commit. It first runs overlay_tree_on_cache(), which was stolen from ls-files with the earlier change, to get the list of paths that the user can potentially mean, and then uses pathspec_match() to find which ones the user meant. This list of paths is used to update both the temporary and the real index file. Additional fixes are: - read the index file after pre-commit hook returns, as the hook can modify it to affect the contents of the commit. - remove the temporary index file .git/next-index-* after commit is done or aborted. - run post-commit hook with the real index file to be used after the commit (previously it gave the temporary commit if a partial commit was made). - resurrect the safety mechanism to refuse partial commits during a merge to match the scripted version. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4008-diff-break-rewrite.sh')
0 files changed, 0 insertions, 0 deletions