t / t2200-add-update.shon commit Merge branch 'master' of git://people.freedesktop.org/~hausmann/git-p4 (6fb73e4)
   1#!/bin/sh
   2
   3test_description='git add -u with path limiting
   4
   5This test creates a working tree state with three files:
   6
   7  top (previously committed, modified)
   8  dir/sub (previously committed, modified)
   9  dir/other (untracked)
  10
  11and issues a git add -u with path limiting on "dir" to add
  12only the updates to dir/sub.'
  13
  14. ./test-lib.sh
  15
  16test_expect_success 'setup' '
  17echo initial >top &&
  18mkdir dir &&
  19echo initial >dir/sub &&
  20git add dir/sub top &&
  21git-commit -m initial &&
  22echo changed >top &&
  23echo changed >dir/sub &&
  24echo other >dir/other
  25'
  26
  27test_expect_success 'update' 'git add -u dir'
  28
  29test_expect_success 'update touched correct path' \
  30  'test "`git diff-files --name-status dir/sub`" = ""'
  31
  32test_expect_success 'update did not touch other tracked files' \
  33  'test "`git diff-files --name-status top`" = "M       top"'
  34
  35test_expect_success 'update did not touch untracked files' \
  36  'test "`git diff-files --name-status dir/other`" = ""'
  37
  38test_done