From patchwork Fri Feb 8 19:51:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Peart X-Patchwork-Id: 10803693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C15B14E1 for ; Fri, 8 Feb 2019 19:51:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE86D2EA05 for ; Fri, 8 Feb 2019 19:51:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E267E2EB8F; Fri, 8 Feb 2019 19:51:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E89D2EA05 for ; Fri, 8 Feb 2019 19:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727191AbfBHTv2 (ORCPT ); Fri, 8 Feb 2019 14:51:28 -0500 Received: from mail-qk1-f180.google.com ([209.85.222.180]:41780 "EHLO mail-qk1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726896AbfBHTv1 (ORCPT ); Fri, 8 Feb 2019 14:51:27 -0500 Received: by mail-qk1-f180.google.com with SMTP id u188so2848921qkh.8 for ; Fri, 08 Feb 2019 11:51:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xSP7r0M+OMChiAGBMUbLG8vwkfLldxuGlk1kMONcZBc=; b=BkHcY7obLoVBhKalGCSeGlOkxOoHhD7JhU+VQzPrIyMYtS35COW66FWjhhufM5Shmj KDiabn/uQGhAfbxRs91jOPzY8nn+3/6vTKcmEVCrICH+KMwr2VRYhJeybMOv3ReZoWPE VgMnYhSEhzKW4ZNweJcg3nvcc8CxwjLEu3KAxpnk1hO1L5eHqNziqIZfVkj+KMeAR9E/ A7cgX527CnckvhGa1upHUANKfsqZ01d2LX/xPXiKOEOJ1kpuK7Gb+dBL3KzE25y59dZG dLqZ5G+Q91pk1pB6jGEEpABSq7iMcLLsLxT6cmNnH3uT2o+NitZqAOj4dFwxw/l8e9QQ xYKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xSP7r0M+OMChiAGBMUbLG8vwkfLldxuGlk1kMONcZBc=; b=hhqAjhQqSuW7IDzBdFCvsywqBYJzQ1Rwj+uro8EG7BOQg/TuVuEw6S37qxaaKYLT/B sliIWp/idZIEUuxwFfCQg6QaEAPi2QZ6a6toxCmecv38NJqOutBfq7oE4YKLA6HAvqKp eiXJ+CZdiDWSx6htSZF2UJfAh/LC0FkGezVq/yvoOkQrnBF2OysOF3Qw48jeT/CI3bU8 jH9m8HJAFfcONnWtRaDc4lx2U8Nps+rghm73s9M7U4khM6IA7HgrSZg3uP/e9/QYq9vc pvCik5who5veqxCTzEcKzxQeNtoSKebHJtbkB4jo4GYYlCVkDJ9cChsIS6ivy+OfnzjJ 6dpA== X-Gm-Message-State: AHQUAuY8J/J5u2l03NGv+qjrSFI7qNsqvPueMJ7DFZ2R/U9F+uRHssl9 BU0Duha6+Gg+MuOTeL14qCm5wykq9bw= X-Google-Smtp-Source: AHgI3Ibl/RvqNvaID/leGxWPsyE4Vb1WjzfvmGfGzxIscCgVNF29MIkrdKCZ9Cof/5ZSKND7pblTqQ== X-Received: by 2002:a37:6c05:: with SMTP id h5mr17380723qkc.175.1549655486126; Fri, 08 Feb 2019 11:51:26 -0800 (PST) Received: from localhost.localdomain (70-33-148-227.unassigned.ntelos.net. [70.33.148.227]) by smtp.gmail.com with ESMTPSA id 12sm8253054qka.83.2019.02.08.11.51.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 11:51:25 -0800 (PST) From: Ben Peart To: git@vger.kernel.org Cc: benpeart@microsoft.com, kewillf@microsoft.com Subject: [PATCH v1 1/3] read-cache: add post-indexchanged hook Date: Fri, 8 Feb 2019 14:51:13 -0500 Message-Id: <20190208195115.12156-2-peartben@gmail.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20190208195115.12156-1-peartben@gmail.com> References: <20190208195115.12156-1-peartben@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Peart Add a post-indexchanged 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. Signed-off-by: Ben Peart --- builtin/reset.c | 1 + builtin/update-index.c | 2 ++ cache.h | 4 +++- read-cache.c | 14 ++++++++++++-- unpack-trees.c | 2 ++ 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index 4d18a461fa..e173afcaac 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -380,6 +380,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix) int flags = quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN; if (read_from_tree(&pathspec, &oid, intent_to_add)) return 1; + the_index.updated_skipworktree = 1; if (!quiet && get_git_work_tree()) { uint64_t t_begin, t_delta_in_ms; diff --git a/builtin/update-index.c b/builtin/update-index.c index 02ace602b9..cf731640fa 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -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. diff --git a/cache.h b/cache.h index 27fe635f62..46eb862d3e 100644 --- a/cache.h +++ b/cache.h @@ -338,7 +338,9 @@ struct index_state { struct cache_time timestamp; unsigned name_hash_initialized : 1, initialized : 1, - drop_cache_tree : 1; + drop_cache_tree : 1, + updated_workdir : 1, + updated_skipworktree : 1; struct hashmap name_hash; struct hashmap dir_hash; struct object_id oid; diff --git a/read-cache.c b/read-cache.c index 0e0c93edc9..0fcfa8a075 100644 --- a/read-cache.c +++ b/read-cache.c @@ -17,6 +17,7 @@ #include "commit.h" #include "blob.h" #include "resolve-undo.h" +#include "run-command.h" #include "strbuf.h" #include "varint.h" #include "split-index.h" @@ -2999,8 +3000,17 @@ static int do_write_locked_index(struct index_state *istate, struct lock_file *l if (ret) return ret; if (flags & COMMIT_LOCK) - return commit_locked_index(lock); - return close_lock_file_gently(lock); + ret = commit_locked_index(lock); + else + ret = close_lock_file_gently(lock); + + run_hook_le(NULL, "post-indexchanged", + istate->updated_workdir ? "1" : "0", + istate->updated_skipworktree ? "1" : "0", NULL); + istate->updated_workdir = 0; + istate->updated_skipworktree = 0; + + return ret; } static int write_split_index(struct index_state *istate, diff --git a/unpack-trees.c b/unpack-trees.c index 3563daae1a..8665a4a7c0 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -1637,6 +1637,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options WRITE_TREE_SILENT | WRITE_TREE_REPAIR); } + + o->result.updated_workdir = 1; discard_index(o->dst_index); *o->dst_index = o->result; } else { From patchwork Fri Feb 8 19:51:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Peart X-Patchwork-Id: 10803697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF2791669 for ; Fri, 8 Feb 2019 19:51:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFA4D2EA05 for ; Fri, 8 Feb 2019 19:51:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B43202EB8F; Fri, 8 Feb 2019 19:51:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A4182EA05 for ; Fri, 8 Feb 2019 19:51:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727209AbfBHTva (ORCPT ); Fri, 8 Feb 2019 14:51:30 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:35962 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727180AbfBHTv3 (ORCPT ); Fri, 8 Feb 2019 14:51:29 -0500 Received: by mail-qt1-f194.google.com with SMTP id r9so5356823qtt.3 for ; Fri, 08 Feb 2019 11:51:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JzW0qUiS+IuRJ8NEqrVplIXCViBHT85dZ4B7a41JnW8=; b=a/DK+Hebpj+YAexGT/cVCrPPtPOWG4jUIZWRdhXOWOOqOBRJvHCLwhBNEH31C2CcVS WRlpIj+9ceKzYmkzTbh8e4vAk666G4CW0JghrHvTquIKA3tmymvxmBS4iQMzjnwH0qlB AgHrNx1HCQs9HPt1+pPHuAac67JPw6WdBGJE603opA3AG1i44n5M1n2topgTELSpeu9t SvYGAe1bbvFHMZ8qGs5izz4yF7WRHezn/dLw7CMGHKRSj11HwAP9rLq3VQ8QyCvhnWwc 7B66E3TRoakQFIPOC3nOrziXybM9TqCwFqMuOwfVZKunlBN2Gg24isebBIR4GGSxhW7S ceAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JzW0qUiS+IuRJ8NEqrVplIXCViBHT85dZ4B7a41JnW8=; b=FE/LmA3wumIEeXIuhlLYysazvVg/VCrq1rCwKFyGukXn+pVpUe47NcwUwxkfMkIK8c 9sH+NEJ7U9NhpBYqUMuN163AvBKEOM/X/8NaCtwtPmPfFeMlH7MUv6jGCq4naWffFhHG +TVllB/IvgFmw7y4XEWQAdVyvef3Clc6PVGB9U3Hz869kh3YmxufvUvJSRIYDpRISdY6 asmSNg3/rx0VDshKa9aCjmAea1r5UylxwqG8z1xIVkmoBzeonPhEHUEF3AY2N8xre8J8 f9pWwlkhv8S97wwogzcruhQn2n05LrEUBLVo2zvHbMpVm7P99Y4XGTU7gd+R5OdMo8bU YBHw== X-Gm-Message-State: AHQUAuZHmf1EXfCKF21oitNhk3n8n8SWqgGQSt02DhAw9jM615dX2QoC 64CHwmBCYSUKLzu0riqdbhVc5QTDbu4= X-Google-Smtp-Source: AHgI3IaVhNGsFPVqRuY47r1Z6tTQs/kjeZaVzBG1iwote6p0ODyhSmIRq+6aRQ8V7lQu5/TT90dNSw== X-Received: by 2002:a0c:98fa:: with SMTP id g55mr6284218qvd.211.1549655487206; Fri, 08 Feb 2019 11:51:27 -0800 (PST) Received: from localhost.localdomain (70-33-148-227.unassigned.ntelos.net. [70.33.148.227]) by smtp.gmail.com with ESMTPSA id 12sm8253054qka.83.2019.02.08.11.51.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 11:51:26 -0800 (PST) From: Ben Peart To: git@vger.kernel.org Cc: benpeart@microsoft.com, kewillf@microsoft.com Subject: [PATCH v1 2/3] read-cache: add test for post-indexchanged hook Date: Fri, 8 Feb 2019 14:51:14 -0500 Message-Id: <20190208195115.12156-3-peartben@gmail.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20190208195115.12156-1-peartben@gmail.com> References: <20190208195115.12156-1-peartben@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Peart Test the new post-indexchanged hook and ensure it is triggered and passes the correct flags for various git commands. Signed-off-by: Ben Peart --- t/t7113-post-index-changed-hook.sh | 144 +++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100755 t/t7113-post-index-changed-hook.sh diff --git a/t/t7113-post-index-changed-hook.sh b/t/t7113-post-index-changed-hook.sh new file mode 100755 index 0000000000..5aeb726e37 --- /dev/null +++ b/t/t7113-post-index-changed-hook.sh @@ -0,0 +1,144 @@ +#!/bin/sh + +test_description='post index changed hook' + +. ./test-lib.sh + +test_expect_success 'setup' ' + mkdir -p dir1 && + touch dir1/file1.txt && + echo testing >dir1/file2.txt && + git add . && + git commit -m "initial" +' + +test_expect_success 'test status, add, commit, others trigger hook without flags set' ' + mkdir -p .git/hooks && + write_script .git/hooks/post-indexchanged <<-\EOF && + if test "$1" -eq 1; then + echo "Invalid combination of flags passed to hook; updated_workdir is set." >testfailure + exit 1 + fi + if test "$2" -eq 1; then + echo "Invalid combination of flags passed to hook; updated_skipworktree is set." >testfailure + exit 1 + fi + if test -f ".git/index.lock"; then + echo ".git/index.lock exists" >testfailure + exit 3 + fi + if ! test -f ".git/index"; then + echo ".git/index does not exist" >testfailure + exit 3 + fi + echo "success" >testsuccess + EOF + mkdir -p dir2 && + touch dir2/file1.txt && + touch dir2/file2.txt && + : force index to be dirty && + test-tool chmtime +60 dir1/file1.txt && + git status && + test_path_is_file testsuccess && rm -f testsuccess && + test_path_is_missing testfailure && + git add . && + test_path_is_file testsuccess && rm -f testsuccess && + test_path_is_missing testfailure && + git commit -m "second" && + test_path_is_file testsuccess && rm -f testsuccess && + test_path_is_missing testfailure && + git checkout -- dir1/file1.txt && + test_path_is_file testsuccess && rm -f testsuccess && + test_path_is_missing testfailure && + git update-index && + test_path_is_missing testsuccess && + test_path_is_missing testfailure && + git reset --soft && + test_path_is_missing testsuccess && + test_path_is_missing testfailure +' + +test_expect_success 'test checkout and reset trigger the hook' ' + write_script .git/hooks/post-indexchanged <<-\EOF && + if test "$1" -eq 1 && test "$2" -eq 1; then + echo "Invalid combination of flags passed to hook; updated_workdir and updated_skipworktree are both set." >testfailure + exit 1 + fi + if test "$1" -eq 0 && test "$2" -eq 0; then + echo "Invalid combination of flags passed to hook; neither updated_workdir or updated_skipworktree are set." >testfailure + exit 2 + fi + if test "$1" -eq 1; then + if test -f ".git/index.lock"; then + echo "updated_workdir set but .git/index.lock exists" >testfailure + exit 3 + fi + if ! test -f ".git/index"; then + echo "updated_workdir set but .git/index does not exist" >testfailure + exit 3 + fi + else + echo "update_workdir should be set for checkout" >testfailure + exit 4 + fi + echo "success" >testsuccess + EOF + : force index to be dirty && + test-tool chmtime +60 dir1/file1.txt && + git checkout master && + test_path_is_file testsuccess && rm -f testsuccess && + test_path_is_missing testfailure && + test-tool chmtime +60 dir1/file1.txt && + git checkout HEAD && + test_path_is_file testsuccess && rm -f testsuccess && + test_path_is_missing testfailure && + test-tool chmtime +60 dir1/file1.txt && + git reset --hard && + test_path_is_file testsuccess && rm -f testsuccess && + test_path_is_missing testfailure && + git checkout -B test && + test_path_is_file testsuccess && rm -f testsuccess && + test_path_is_missing testfailure +' + +test_expect_success 'test reset --mixed and update-index triggers the hook' ' + write_script .git/hooks/post-indexchanged <<-\EOF && + if test "$1" -eq 1 && test "$2" -eq 1; then + echo "Invalid combination of flags passed to hook; updated_workdir and updated_skipworktree are both set." >testfailure + exit 1 + fi + if test "$1" -eq 0 && test "$2" -eq 0; then + echo "Invalid combination of flags passed to hook; neither updated_workdir or updated_skipworktree are set." >testfailure + exit 2 + fi + if test "$2" -eq 1; then + if test -f ".git/index.lock"; then + echo "updated_skipworktree set but .git/index.lock exists" >testfailure + exit 3 + fi + if ! test -f ".git/index"; then + echo "updated_skipworktree set but .git/index does not exist" >testfailure + exit 3 + fi + else + echo "updated_skipworktree should be set for reset --mixed and update-index" >testfailure + exit 4 + fi + echo "success" >testsuccess + EOF + : force index to be dirty && + test-tool chmtime +60 dir1/file1.txt && + git reset --mixed --quiet HEAD~1 && + test_path_is_file testsuccess && rm -f testsuccess && + test_path_is_missing testfailure && + git hash-object -w --stdin expect && + git update-index --cacheinfo 100644 "$(cat expect)" dir1/file1.txt && + test_path_is_file testsuccess && rm -f testsuccess && + test_path_is_missing testfailure && + git update-index --skip-worktree dir1/file2.txt && + git update-index --remove dir1/file2.txt && + test_path_is_file testsuccess && rm -f testsuccess && + test_path_is_missing testfailure +' + +test_done From patchwork Fri Feb 8 19:51:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Peart X-Patchwork-Id: 10803695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7B6714E1 for ; Fri, 8 Feb 2019 19:51:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 994EA2EA05 for ; Fri, 8 Feb 2019 19:51:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DE1D2EB8F; Fri, 8 Feb 2019 19:51:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37DE82EA05 for ; Fri, 8 Feb 2019 19:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727218AbfBHTva (ORCPT ); Fri, 8 Feb 2019 14:51:30 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:42853 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726896AbfBHTv3 (ORCPT ); Fri, 8 Feb 2019 14:51:29 -0500 Received: by mail-qt1-f194.google.com with SMTP id b8so5311113qtr.9 for ; Fri, 08 Feb 2019 11:51:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X1zCF1gBuubO1ljHS+whfS2YVpisXxmp9tTf1rHHsO8=; b=AotQD2Sm+J2P73XT2966KwxY0KAFcJam/+wjC2hZb2H7GQalOtFiBlyj3AHF6jbJ9R r8pdzb9rmM1a+C9G0diTCwO1X5pp96hB1QzroIvKa698RAV4K0E/Ltkw1QZWrwjMN1CV gNyq9X7dqkmpt/g3WobzCJ+AqQqifLvTAwQQ7o1Gfw96sy9RpFLMd6eC3Lzxyr+XgFLV F31TDVps1oTsY/t04T1nA0P5zZjhhoHSGiT8zC+ZKVzKSmOYFQtGZ7q4quHHbPIQ/mhA t+hlq1GTZzKj0ltITQExUK3c6SZx9UIrEGGGnbWjGC8NSEVY3GwOW2toHQ+/deE9HcEc ip/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X1zCF1gBuubO1ljHS+whfS2YVpisXxmp9tTf1rHHsO8=; b=MINcEjmba/eXHapSR3ScbGqOgXi4Wsn0cOIpfo2L6xqx1CF5gZ8nFj/ILe7DqYrCJ1 K51Pe8yJDaIqPZtw4r6V9rNKhZyH5QNQNrdhm4MCvATl4UUpinQQZ4HwApVDcfkndGRv P5NIGT/P3CkVx7GbGdzxlhpXCqfF7lWWIVTFQWP0JrtP77qZ3m31UyJ6zAMdGV1/0GH4 XQZJBFhaKpxWo3qeyczP3b8/le6MReDjDF/Cpzt+NnzU32cKvwm+60tDZ4iPdgy/w3pr k+48aU4e++RM2OZ6z2P3OEUETCjhj7u2XqqMs+ljGx01DBR9wTS+sEh/KByb1t6HFfgn cRPA== X-Gm-Message-State: AHQUAuYJWjFn1DZgLbvpO2/4LWFdoNpC14Tm2nyTX3LNydGg50tNtK9i dI2gcqKXD5JmjBHXhMLArj1IzFOeq6c= X-Google-Smtp-Source: AHgI3IaJWQ63EQSkU5Engsm1y1yhI90B3SfRSDJEkP6ZjTPRaqzEZE4/sWh/RjP/YOY07zIgCrRI9g== X-Received: by 2002:ac8:520f:: with SMTP id r15mr17390027qtn.167.1549655488035; Fri, 08 Feb 2019 11:51:28 -0800 (PST) Received: from localhost.localdomain (70-33-148-227.unassigned.ntelos.net. [70.33.148.227]) by smtp.gmail.com with ESMTPSA id 12sm8253054qka.83.2019.02.08.11.51.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 11:51:27 -0800 (PST) From: Ben Peart To: git@vger.kernel.org Cc: benpeart@microsoft.com, kewillf@microsoft.com Subject: [PATCH v1 3/3] read-cache: Add documentation for the post-indexchanged hook Date: Fri, 8 Feb 2019 14:51:15 -0500 Message-Id: <20190208195115.12156-4-peartben@gmail.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20190208195115.12156-1-peartben@gmail.com> References: <20190208195115.12156-1-peartben@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kevin Willford Document the new post-indexchanged hook with information on when it is called as well as the flags passed and what each of them mean. Signed-off-by: Kevin Willford Signed-off-by: Ben Peart --- Documentation/githooks.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt index 959044347e..9349cd8900 100644 --- a/Documentation/githooks.txt +++ b/Documentation/githooks.txt @@ -492,6 +492,24 @@ This hook is invoked by `git-p4 submit`. It takes no parameters and nothing from standard input. Exiting with non-zero status from this script prevent `git-p4 submit` from launching. Run `git-p4 submit --help` for details. +post-indexchanged +~~~~~~~~~~~~~~~~~ + +This hook is invoked when the index is written in read-cache.c +do_write_locked_index. + +The first parameter passed to the hook is the indicator for the +working directory being updated. "1" meaning working directory +was updated or "0" when the working directory was not updated. + +The second parameter passed to the hook is the indicator for whether +or not the index was updated and the skip-worktree bit could have +changed. "1" meaning skip-worktree bits could have been updated +and "0" meaning they were not. + +Only one parameter should be set to "1" when the hook runs. The hook +running passing "1", "1" should not be possible. + GIT --- Part of the linkgit:git[1] suite