#!/bin/sh test_description='add -i basic tests' . ./test-lib.sh test_expect_success 'setup (initial)' ' echo content >file && git add file && echo more >>file && echo lines >>file ' test_expect_success 'status works (initial)' ' git add -i output && grep "+1/-0 *+2/-0 file" output ' cat >expected <output && sed -ne "/new file/,/content/p" diff && diff -u expected diff ' test_expect_success 'revert works (initial)' ' git add file && (echo r; echo 1) | git add -i && git ls-files >output && ! grep . output ' test_expect_success 'setup (commit)' ' echo baseline >file && git add file && git commit -m commit && echo content >>file && git add file && echo more >>file && echo lines >>file ' test_expect_success 'status works (commit)' ' git add -i output && grep "+1/-0 *+2/-0 file" output ' cat >expected <output && sed -ne "/^index/,/content/p" diff && diff -u expected diff ' test_expect_success 'revert works (commit)' ' git add file && (echo r; echo 1) | git add -i && git add -i output && grep "unchanged *+3/-0 file" output ' test_done