git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] commit: ignore assume-unchanged files in "commmit <file>" mode

From
Sérgio Basto <sergio@serjux.com>
Date
Dec 9, 2014, 02:44 UTC
Message-ID
<1418093090.19104.1.camel@segulix>
In-Reply-To
<1417776974-6537-1-git-send-email-pclouds@gmail.com>
On Sex, 2014-12-05 at 17:56 +0700, Nguyễn Thái Ngọc Duy wrote: 
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
works great many thanks, 
-- 
Sérgio M. B.
Previous: Nguyễn Thái Ngọc DuyNext: Philip Oakley
Message 18 of 19 in “GIT: ignoring changes in tracked files and bug report”
  1. Sérgio BastoDec 4, 2014
  2. bug report on update-index --assume-unchangedSérgio Basto, Dec 5, 2014
  3. Johannes SixtDec 5, 2014
  4. Duy NguyenDec 5, 2014
  5. Sérgio BastoDec 5, 2014
  6. Junio C HamanoDec 5, 2014
  7. Philip OakleyDec 5, 2014
  8. Junio C HamanoDec 5, 2014
  9. Philip OakleyDec 5, 2014
  10. Andreas SchwabDec 5, 2014
  11. Sérgio BastoDec 6, 2014
  12. Philip OakleyDec 6, 2014
  13. Junio C HamanoDec 5, 2014
  14. Sérgio BastoDec 5, 2014
  15. Junio C HamanoDec 5, 2014
  16. Junio C HamanoDec 5, 2014
  17. commit: ignore assume-unchanged files in "commmit <file>" modeNguyễn Thái Ngọc Duy, Dec 5, 2014
  18. Sérgio BastoDec 9, 2014
  19. Philip OakleyDec 11, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.