From: Philip Oakley Date: Thu, 11 Dec 2014 23:21:19 GMT Subject: Re: [PATCH] commit: ignore assume-unchanged files in "commmit " mode Message-ID: <35EB570A2A994662AA2E89910ECE9668@PhilipOakley> In-Reply-To: <1418093090.19104.1.camel@segulix> From: "Sérgio Basto" Sent: Tuesday, December 09, 2014 2:44 AM > On Sex, 2014-12-05 at 17:56 +0700, Nguyễn Thái Ngọc Duy wrote: >> 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 >> Signed-off-by: Nguyễn Thái Ngọc Duy >> --- >> 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 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 > > > works great many thanks, > Junio: Given that this patch avoids the user surprise that the `commit .` and `commit -a` produced unexpectedly different effects, should it also be included in the --assume unchanged patches? Or is the test inappropriate? I'm guessing that there will still be other potential 'gotcha' code paths that would still produce surprise though. Philip