]> git.proxmox.com Git - libgit2.git/commit - tests/diff/workdir.c
Make diff and status perform soft index reload
authorRussell Belfer <rb@github.com>
Thu, 31 Oct 2013 21:36:52 +0000 (14:36 -0700)
committerRussell Belfer <rb@github.com>
Fri, 1 Nov 2013 17:20:51 +0000 (10:20 -0700)
commit4bf630b6baf342fa929a8f7e4e6643197b74216f
tree95778a5807b4043202eaea18a266a264e611649c
parent3940310e29363978ccdc1f3b557bc6f48ebae8f0
Make diff and status perform soft index reload

This changes `git_index_read` to have two modes - a hard index
reload that always resets the index to match the on-disk data
(which was the old behavior) and a soft index reload that uses
the timestamp / file size information and only replaces the index
data if the file on disk has been modified.

This then updates the git_status code to do a soft reload unless
the new GIT_STATUS_OPT_NO_REFRESH flag is passed in.

This also changes the behavior of the git_diff functions that use
the index so that when an index is not explicitly passed in (i.e.
when the functions call git_repository_index for you), they will
also do a soft reload for you.

This intentionally breaks the file signature of git_index_read
because there has been some confusion about the behavior previously
and it seems like all existing uses of the API should probably be
examined to select the desired behavior.
17 files changed:
examples/showindex.c
include/git2/diff.h
include/git2/index.h
include/git2/status.h
src/checkout.c
src/diff.c
src/index.c
src/status.c
src/submodule.c
tests-clar/checkout/head.c
tests-clar/diff/diff_helpers.c
tests-clar/diff/workdir.c
tests-clar/index/addall.c
tests-clar/index/names.c
tests-clar/index/reuc.c
tests-clar/index/tests.c
tests-clar/status/worktree.c