author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Sat, 3 Nov 2007 13:12:17 +0000 (13:12 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 4 Nov 2007 04:44:57 +0000 (21:44 -0700) | ||
commit | 2e7a9785c27f00a8f7a06edc1d4c9b2f3fa2eeb9 | |
tree | 02ca6682d75541b5d5d4273c3f8399f96f6e2e03 | tree | snapshot |
parent | 19391c371cec06da6cca45dbe3c212bd479cc48c | commit | diff |
git-reset: do not be confused if there is nothing to reset
The purpose of the function update_index_from_diff() (which is the
callback function we give do_diff_cache()) is to update those index
entries which differ from the given commit.
Since do_diff_cache() plays games with the in-memory index, this function
discarded the cache and reread it.
Then, back in the function read_from_tree() we wrote the index.
Of course, this broke down when there were no changes and
update_index_from_diff() was not called, and therefore the mangled index
was not discarded.
The solution is to move the index writing into the function
update_index_from_diff().
Noticed by Björn Steinbrink.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The purpose of the function update_index_from_diff() (which is the
callback function we give do_diff_cache()) is to update those index
entries which differ from the given commit.
Since do_diff_cache() plays games with the in-memory index, this function
discarded the cache and reread it.
Then, back in the function read_from_tree() we wrote the index.
Of course, this broke down when there were no changes and
update_index_from_diff() was not called, and therefore the mangled index
was not discarded.
The solution is to move the index writing into the function
update_index_from_diff().
Noticed by Björn Steinbrink.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-reset.c | diff | blob | history | |
t/t7102-reset.sh | diff | blob | history |