summaryrefslogtreecommitdiff
path: root/t/t7103-reset-bare.sh
AgeCommit message (Collapse)Author
2016-01-08t/t7103-reset-bare.sh: use the $( ... ) construct for command substitutionElia Pinto
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg' "${_f}" done and then carefully proof-read. Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-07reset: disallow "reset --keep" outside a work treeChristian Couder
It is safer and consistent with "--merge" and "--hard" resets to disallow "git reset --keep" outside a work tree. So let's just do that and add some tests while at it. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-30reset: unbreak hard resets with GIT_WORK_TREEJeff King
Commit 952dfc6 tried to tighten the safety valves for doing a "reset --hard" in a bare repository or outside the work tree, but accidentally broke the case for GIT_WORK_TREE. This patch unbreaks it. Most git commands which need a work tree simply use NEED_WORK_TREE in git.c to die before they get to their cmd_* function. Reset, however, only needs a work tree in some cases, and so must handle the work tree itself. The error that 952dfc6 made was to simply forbid certain operations if the work tree was not set up; instead, we need to do the same thing that NEED_WORK_TREE does, which is to call setup_work_tree(). We no longer have to worry about dying in the non-worktree case, as setup_work_tree handles that for us. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-05reset: improve worktree safety valvesJeff King
The existing code checked to make sure we were not in a bare repository when doing a hard reset. However, we should take this one step further, and make sure we are in a worktree. Otherwise, we can end up munging files inside of '.git'. Furthermore, we should do the same check for --merge resets, which have the same properties. Actually, a merge reset of HEAD^ would already complain, since further down in the code we want a worktree. However, it is nicer to check up-front; then we are sure we cover all cases ("git reset --merge" would run, even though it wasn't doing anything) and we can give a more specific message. Add tests to t7103 to cover these cases and some missing ones. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-03tests: use "git xyzzy" form (t7000 - t7199)Nanako Shiraishi
Converts tests between t7001-t7103. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13t/: Use "test_must_fail git" instead of "! git"Stephan Beyer
This patch changes every occurrence of "! git" -- with the meaning that a git call has to gracefully fail -- into "test_must_fail git". This is useful to - make sure the test does not fail because of a signal, e.g. SIGSEGV, and - advertise the use of "test_must_fail" for new tests. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-02git-reset: refuse to do hard reset in a bare repositoryJeff King
It makes no sense since there is no working tree. A soft reset should be fine, though. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>