Code

upload-pack: Use finish_{command,async}() instead of waitpid().
[git.git] / t / t7102-reset.sh
index 2cad4db127a9df9f8550887c6b46851335a1f3d8..cea9afb764226d3086450cb7c53c881bb9803eec 100755 (executable)
@@ -386,4 +386,27 @@ test_expect_success 'test --mixed <paths>' '
        git diff output cached_expect
 '
 
+test_expect_success 'test resetting the index at give paths' '
+
+       mkdir sub &&
+       >sub/file1 &&
+       >sub/file2 &&
+       git update-index --add sub/file1 sub/file2 &&
+       T=$(git write-tree) &&
+       ! git reset HEAD sub/file2 &&
+       U=$(git write-tree) &&
+       echo "$T" &&
+       echo "$U" &&
+       ! git diff-index --cached --exit-code "$T" &&
+       test "$T" != "$U"
+
+'
+
+test_expect_success 'resetting an unmodified path is a no-op' '
+       git reset --hard &&
+       git reset -- file1 &&
+       git diff-files --exit-code &&
+       git diff-index --cached --exit-code HEAD
+'
+
 test_done