t / t2203-add-intent.shon commit Add missing test file for UTF-16. (214a5f2)
   1#!/bin/sh
   2
   3test_description='Intent to add'
   4
   5. ./test-lib.sh
   6
   7test_expect_success 'intent to add' '
   8        echo hello >file &&
   9        echo hello >elif &&
  10        git add -N file &&
  11        git add elif
  12'
  13
  14test_expect_success 'check result of "add -N"' '
  15        git ls-files -s file >actual &&
  16        empty=$(git hash-object --stdin </dev/null) &&
  17        echo "100644 $empty 0   file" >expect &&
  18        test_cmp expect actual
  19'
  20
  21test_expect_success 'intent to add is just an ordinary empty blob' '
  22        git add -u &&
  23        git ls-files -s file >actual &&
  24        git ls-files -s elif | sed -e "s/elif/file/" >expect &&
  25        test_cmp expect actual
  26'
  27
  28test_expect_success 'intent to add does not clobber existing paths' '
  29        git add -N file elif &&
  30        empty=$(git hash-object --stdin </dev/null) &&
  31        git ls-files -s >actual &&
  32        ! grep "$empty" actual
  33'
  34
  35test_expect_success 'cannot commit with i-t-a entry' '
  36        test_tick &&
  37        git commit -a -m initial &&
  38        git reset --hard &&
  39
  40        echo xyzzy >rezrov &&
  41        echo frotz >nitfol &&
  42        git add rezrov &&
  43        git add -N nitfol &&
  44        test_must_fail git commit
  45'
  46
  47test_expect_success 'can commit with an unrelated i-t-a entry in index' '
  48        git reset --hard &&
  49        echo xyzzy >rezrov &&
  50        echo frotz >nitfol &&
  51        git add rezrov &&
  52        git add -N nitfol &&
  53        git commit -m partial rezrov
  54'
  55
  56test_expect_success 'can "commit -a" with an i-t-a entry' '
  57        git reset --hard &&
  58        : >nitfol &&
  59        git add -N nitfol &&
  60        git commit -a -m all
  61'
  62
  63test_done
  64