git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Stefan Beller <sbeller@google.com>,
	Lars Schneider <larsxschneider@gmail.com>,
	Thomas Gummerer <t.gummerer@gmail.com>, git <git@vger.kernel.org>,
	Jeff King <peff@peff.net>,
	Christian Couder <christian.couder@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: GSoC 2016: applications open, deadline = Fri, 19/2
Date: Fri, 19 Feb 2016 12:35:14 -0800	[thread overview]
Message-ID: <xmqq8u2gcubh.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <vpqr3g96tn6.fsf@anie.imag.fr> (Matthieu Moy's message of "Fri, 19 Feb 2016 08:34:05 +0100")

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

>> We have these "powerful" tools for a reason.  After making a mess
>> experimenting with your working tree files, "reset --hard" is the
>> best tool to go back to the known-good state,
>
> I disagree with that. This reminds me a discussion I had with a student
> a few years ago:
>
>   student: how do a clear all changes from my worktree?
>   me: git reset --hard
>
> the next day:
>
>   student: OK, now, how do I get my changes back?
>   me: ...!
>
> There's almost no situation where reset --hard is the best tool.

I obviously have to disagree.  After maknig a mess experimenting,
when you want to discard all that, "reset --hard" is the best
tool--the situation of your student may be quite different but you
didn't make it clear what s/he wanted to salvage.  In any case, I
wasn't asking about "clear all changes for now, to be salvaged
later".

The "experimenting" would include mergy operations like "am -3" and
"cherry-pick".  "After queuing a topic and trying it in isolation,
an attempt to merge to the baseline results in quite a mess, and I
give up"--there is nothing to salvage.

And obviously, "stash" is not useful in such a situation.  You could
use "tar cf ../saved .", though.

> Now, another issue with the proposed core.isbeginner is compatibility
> with scripts. 

Yes.

> Dangerous commands are often plumbing, and a beginner may
> still want to use scripts or other porcelain on top of it. Typically, I
> think this rules out "git reset --hard" which is legitimate in scripts.

I agree that an "under core.isbeginner, the command will always be
refused" change can be written without thinking and it will be
useless for anything that has ledigimate uses (like, but not limited
to, being used in scripts) [*1*].

But not so fast.

If you can figure out when "git reset --hard" is legitimate based
*NOT* only on the fact that it is driven by a script, but on what
kind of modifications to the working tree contents, the index
contents and the refs are about to be made by the command, then
"core.isbeginner" can be a permission for the command to spend extra
cycles to examine the situation carefully to decide to selectively
go ahead, warn and go ahead, or refuse.

That of course takes a real thinking.  


[Footnote]

*1* I'd refuse to take a patch to make scripted Porcelains that make
legit calls to "powerful" tools export GIT_SCRIPT_IS_RUNNING_YOU
environment variable as a workaround for such a kludge.

  reply	other threads:[~2016-02-19 20:35 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-10  9:31 GSoC 2016: applications open, deadline = Fri, 19/2 Matthieu Moy
2016-02-10 11:09 ` Johannes Schindelin
2016-02-10 17:44   ` Stefan Beller
2016-02-11  8:36 ` Christian Couder
2016-02-12  7:10   ` Matthieu Moy
2016-02-12  8:29     ` Lars Schneider
2016-02-12  9:11       ` Matthieu Moy
2016-02-12 13:04     ` Jeff King
2016-02-12 13:11       ` Jeff King
2016-02-13 11:21       ` Matthieu Moy
2016-02-16 18:10         ` Stefan Beller
2016-02-17 10:34           ` Matthieu Moy
2016-02-17 10:45             ` Duy Nguyen
2016-02-17 13:36             ` [PATCH 0/3] Turn git-rebase--*.sh to external helpers Nguyễn Thái Ngọc Duy
2016-02-17 13:36               ` [PATCH 1/3] rebase: move common functions to rebase--lib.sh Nguyễn Thái Ngọc Duy
2016-02-17 13:36               ` [PATCH 2/3] rebase: move cleanup code to exit_rebase() Nguyễn Thái Ngọc Duy
2016-02-17 14:03                 ` Matthieu Moy
2016-02-17 13:36               ` [PATCH 3/3] rebase: turn git-rebase--*.sh into separate programs Nguyễn Thái Ngọc Duy
2016-02-17 14:05                 ` Matthieu Moy
2016-02-17 14:22               ` [PATCH 0/3] Turn git-rebase--*.sh to external helpers Johannes Schindelin
2016-02-17 14:40                 ` Duy Nguyen
2016-02-17 13:09           ` GSoC 2016: applications open, deadline = Fri, 19/2 Johannes Schindelin
2016-02-17 16:04             ` Christian Couder
2016-02-22  9:28         ` Duy Nguyen
2016-02-22 10:22           ` Matthieu Moy
2016-02-22 21:42             ` Jeff King
2016-02-22 21:56               ` Junio C Hamano
2016-02-22 22:02                 ` Jeff King
2016-02-23 13:13                   ` Matthieu Moy
2016-02-24 10:52                     ` Jeff King
2016-02-17 17:24 ` Thomas Gummerer
2016-02-17 18:32   ` Lars Schneider
2016-02-17 18:58     ` Matthieu Moy
2016-02-17 19:03       ` Junio C Hamano
2016-02-17 20:21         ` Matthieu Moy
2016-02-17 20:45           ` Jeff King
2016-02-17 21:33             ` Junio C Hamano
2016-02-18  9:38               ` Carlos Martín Nieto
2016-02-19  8:06                 ` GSoC 2016: applications open, libgit2 and git.git Matthieu Moy
2016-02-19  9:46                   ` Carlos Martín Nieto
2016-02-29 21:01                     ` Git has been accepted as a GSoC 2016 mentor organization! Matthieu Moy
2016-03-08 22:46                       ` Jeff King
2016-03-08 23:01                         ` Junio C Hamano
2016-03-08 23:03                           ` Jeff King
2016-03-09  9:55                         ` Matthieu Moy
2016-03-09 14:08                           ` Jeff King
2016-03-09 13:50                         ` Johannes Schindelin
2016-03-09 19:34                         ` Jeff King
2016-02-19  8:09                 ` GSoC 2016: applications open, deadline = now => submission Matthieu Moy
2016-02-19  8:18                   ` Jeff King
2016-02-19  9:10                     ` GSoC 2016: applications open, deadline = now => submitted Matthieu Moy
2016-02-19 11:37                       ` Jeff King
2016-02-18  8:41       ` GSoC 2016: applications open, deadline = Fri, 19/2 Lars Schneider
2016-02-18 18:38         ` Stefan Beller
2016-02-18 19:13           ` Junio C Hamano
2016-02-19  7:34             ` Matthieu Moy
2016-02-19 20:35               ` Junio C Hamano [this message]
2016-02-20  9:28                 ` Johannes Schindelin
2016-02-19  9:23             ` Lars Schneider
2016-02-19 12:49               ` Matthieu Moy
2016-02-19 20:37               ` Junio C Hamano
2016-02-19 11:46         ` Thomas Gummerer
2016-02-19  3:09       ` Duy Nguyen
2016-02-19  3:20         ` Junio C Hamano
2016-02-19  3:29           ` Duy Nguyen
2016-02-19  7:17         ` Matthieu Moy
2016-02-19  9:41           ` Duy Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq8u2gcubh.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=larsxschneider@gmail.com \
    --cc=peff@peff.net \
    --cc=sbeller@google.com \
    --cc=t.gummerer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).