Re: [PATCH] cmd_reset: don't trash uncommitted changes unless told to
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 24, 2008, 22:31 UTC
- Message-ID
- <7vwskea2ik.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <1214346098-24584-1-git-send-email-stevenrwalter@gmail.com>
Steven Walter <stevenrwalter@gmail.com> writes:
Show 8 quoted lines
> @@ -225,6 +243,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
> if (reset_type == HARD && is_bare_repository())
> die("hard reset makes no sense in a bare repository");
>
> + if (reset_type == HARD && !force && index_is_dirty()) {
> + die("Uncommitted changes; re-run with -f to trash them");
> + }
> +Please don't. With your change, does the testsuite even pass?
"reset --hard" has *ALWAYS* meant to be destructive --- discarding potential local cruft is the whole point of the operation.
Learn the lingo, and get over it.