Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-10-09 21:21:25 +0400
committerShawn O. Pearce <spearce@spearce.org>2008-10-09 21:21:25 +0400
commita3c76f2858b1ceae5b70b7ee69d2663143dcce49 (patch)
tree1b60773c0fde8c6c2551e445f402985e1921cc59 /t
parentd5c527448db30be55553e0b125015e8d444f8dbc (diff)
parent394258190c76dd7944688a3a28931071ec02087d (diff)
Merge branch 'jc/add-ita'
* jc/add-ita: git-add --intent-to-add (-N)
Diffstat (limited to 't')
-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
+