reset $sha1 $pathspec: require $sha1 only to be treeish

Resetting with paths does not update HEAD and there is nothing else
that a commit should be needed for. Relax the argument parsing so only
a tree is required.

The sha1 is only passed to read_from_tree(), which already only
requires a tree.

The "rev" variable we pass to run_add_interactive() will resolve to a
tree. This is fine since interactive_reset only needs the parameter to
be a treeish and doesn't use it for display purposes.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Martin von Zweigbergk
2013-01-14 21:47:49 -08:00
committed by Junio C Hamano
parent 7637df131e
commit 2f328c3d2e
2 changed files with 35 additions and 21 deletions

View File

@ -497,4 +497,12 @@ test_expect_success 'disambiguation (4)' '
test ! -f secondfile
'
test_expect_success 'reset with paths accepts tree' '
# for simpler tests, drop last commit containing added files
git reset --hard HEAD^ &&
git reset HEAD^^{tree} -- . &&
git diff --cached HEAD^ --exit-code &&
git diff HEAD --exit-code
'
test_done