summaryrefslogtreecommitdiff
path: root/t/t2203-add-intent.sh
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2008-10-09 10:21:25 -0700
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2008-10-09 10:21:25 -0700
commita3c76f2858b1ceae5b70b7ee69d2663143dcce49 (patch)
tree1b60773c0fde8c6c2551e445f402985e1921cc59 /t/t2203-add-intent.sh
parentMerge branch 'mw/sendemail' (diff)
parentgit-add --intent-to-add (-N) (diff)
downloadtgif-a3c76f2858b1ceae5b70b7ee69d2663143dcce49.tar.xz
Merge branch 'jc/add-ita'
* jc/add-ita: git-add --intent-to-add (-N)
Diffstat (limited to 't/t2203-add-intent.sh')
-rwxr-xr-xt/t2203-add-intent.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh
new file mode 100755
index 0000000000..d4de35ea06
--- /dev/null
+++ b/t/t2203-add-intent.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+test_description='Intent to add'
+
+. ./test-lib.sh
+
+test_expect_success 'intent to add' '
+ echo hello >file &&
+ echo hello >elif &&
+ git add -N file &&
+ git add elif
+'
+
+test_expect_success 'check result of "add -N"' '
+ git ls-files -s file >actual &&
+ empty=$(git hash-object --stdin </dev/null) &&
+ echo "100644 $empty 0 file" >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'intent to add is just an ordinary empty blob' '
+ git add -u &&
+ git ls-files -s file >actual &&
+ git ls-files -s elif | sed -e "s/elif/file/" >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'intent to add does not clobber existing paths' '
+ git add -N file elif &&
+ empty=$(git hash-object --stdin </dev/null) &&
+ git ls-files -s >actual &&
+ ! grep "$empty" actual
+'
+
+test_done
+