mirror of
https://github.com/git-for-windows/git.git
synced 2026-02-04 03:33:01 -06:00
The `--stdin` option was a well-established paradigm in other commands, therefore we implemented it in `git reset` for use by Visual Studio. Unfortunately, upstream Git decided that it is time to introduce `--pathspec-from-file` instead. To keep backwards-compatibility for some grace period, we therefore reinstate the `--stdin` option on top of the `--pathspec-from-file` option, but mark it firmly as deprecated. Helped-by: Victoria Dye <vdye@github.com> Helped-by: Matthew John Cheetham <mjcheetham@outlook.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
33 lines
777 B
Bash
Executable File
33 lines
777 B
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='reset --stdin'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'reset --stdin' '
|
|
test_commit hello &&
|
|
git rm hello.t &&
|
|
test -z "$(git ls-files hello.t)" &&
|
|
echo hello.t | git reset --stdin &&
|
|
test hello.t = "$(git ls-files hello.t)"
|
|
'
|
|
|
|
test_expect_success 'reset --stdin -z' '
|
|
test_commit world &&
|
|
git rm hello.t world.t &&
|
|
test -z "$(git ls-files hello.t world.t)" &&
|
|
printf world.tQworld.tQhello.tQ | q_to_nul | git reset --stdin -z &&
|
|
printf "hello.t\nworld.t\n" >expect &&
|
|
git ls-files >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success '--stdin requires --mixed' '
|
|
echo hello.t >list &&
|
|
test_must_fail git reset --soft --stdin <list &&
|
|
test_must_fail git reset --hard --stdin <list &&
|
|
git reset --mixed --stdin <list
|
|
'
|
|
|
|
test_done
|