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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 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
-- 
2.2.0.60.gb7b3c64

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]