read-cache: add post-index-change hook

Add a post-index-change hook that is invoked after the index is written in
do_write_locked_index().

This hook is meant primarily for notification, and cannot affect
the outcome of git commands that trigger the index write.

The hook is passed a flag to indicate whether the working directory was
updated or not and a flag indicating if a skip-worktree bit could have
changed.  These flags enable the hook to optimize its response to the
index change notification.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ben Peart
2019-02-15 12:59:21 -05:00
committed by Junio C Hamano
parent 8989e1950a
commit 1956ecd0ab
7 changed files with 182 additions and 3 deletions

View File

@ -1071,6 +1071,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
if (entries < 0)
die("cache corrupted");
the_index.updated_skipworktree = 1;
/*
* Custom copy of parse_options() because we want to handle
* filename arguments as they come.