Show 42 quoted lines
> In the same spirit of 7fce6e3 (commit: correctly respect skip-worktree
> bit - 2009-12-14), if a file is marked unchanged, skip it.
>
> Noticed-by: Sérgio Basto <sergio@serjux.com>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> builtin/commit.c | 2 +-
> t/t2106-update-index-assume-unchanged.sh | 10 ++++++++++
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index e108c53..ee3de12 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -252,7 +252,7 @@ static int list_paths(struct string_list *list, const char *with_tree,
> if (!ce_path_match(ce, pattern, m))
> continue;
> item = string_list_insert(list, ce->name);
> - if (ce_skip_worktree(ce))
> + if (ce->ce_flags & (CE_VALID | CE_SKIP_WORKTREE))
> item->util = item; /* better a valid pointer than a fake one */
> }
>
> diff --git a/t/t2106-update-index-assume-unchanged.sh b/t/t2106-update-index-assume-unchanged.sh
> index 99d858c..dc332f5 100755
> --- a/t/t2106-update-index-assume-unchanged.sh
> +++ b/t/t2106-update-index-assume-unchanged.sh
> @@ -21,4 +21,14 @@ test_expect_success 'do not switch branches with dirty file' \
> git update-index --assume-unchanged file &&
> test_must_fail git checkout master'
>
> +test_expect_success 'commit <paths> ignore assume-unchanged files' '
> + : >anotherfile &&
> + git add anotherfile &&
> + echo dirty >anotherfile &&
> + git commit -m one -- file anotherfile &&
> + git diff --name-only HEAD^ HEAD >actual &&
> + echo anotherfile >expected &&
> + test_cmp expected actual
> +'
> +
> test_done