From de694d232f1a1b1fe2ca4c7549242d7ef96cf759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Mon, 16 Jan 2012 09:36:47 +0700 Subject: commit, write-tree: allow to ignore CE_INTENT_TO_ADD while writing trees MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Normally cache-tree will not produce trees from an index that has CE_INTENT_TO_ADD entries. This is a safe measure to avoid mis-interpreting user's intention regarding this flag. There are situations however where users want to create trees/commits regardless i-t-a entries. Allow such cases with commit.ignoreIntentToAdd for git-commit and --ignore-intent-to-add for git-write-tree. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- t/t2203-add-intent.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 't') diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh index 58a329961e..7b447d304f 100755 --- a/t/t2203-add-intent.sh +++ b/t/t2203-add-intent.sh @@ -44,6 +44,36 @@ test_expect_success 'cannot commit with i-t-a entry' ' test_must_fail git commit ' +test_expect_success 'can write-tree with i-t-a entry' ' + git reset --hard && + echo xyzzy >rezrov && + echo frotz >nitfol && + git add rezrov && + git add -N nitfol && + git write-tree --ignore-intent-to-add >actual && + echo 150389afa1ccf46e4104667c741cd0e598269511 >expected && + test_cmp expected actual +' + +test_expect_success 'can commit tree with i-t-a entry' ' + git reset --hard && + echo xyzzy >rezrov && + echo frotz >nitfol && + git add rezrov && + git add -N nitfol && + git config commit.ignoreIntentToAdd true && + git commit -m initial && + git ls-tree -r HEAD >actual && + cat >expected <rezrov && -- cgit v1.2.1