"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: staging the reverse of the staged diff
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Sat, 4 Jun 2022 15:54:04 +0200

Download raw body.

Thread
On Sat, Jun 04, 2022 at 03:04:02PM +0200, Omar Polo wrote:
> Stefan Sperling <stsp@stsp.name> wrote:
> > On Fri, Jun 03, 2022 at 11:34:48AM +0200, Omar Polo wrote:
> > > found this by chance; i've staged a debug printf somewhere by accident,
> > > then removed, staged the removal and... the file was still staged but
> > > with an empty diff!  (it was the only edit to that file)
> > > 
> > > patch below tries to make stage_path slightly more clever by checking
> > > the staged blob and the file blob: if they're the same we've effectively
> > > unstaged a file.
> > > 
> > > does this makes sense?  am i trying to make 'got stage' too much clever?
> > 
> > Could we make this situation an error and require the user to
> > run 'got unstage' instead? Or would that be too complicated?
> 
> it's just as easy i guess, see patch below.  I prefer the first
> behaviour (the implicit unstage) but don't have a strong opinion.

Thinking more about this, I also prefer implicit unstage.
It seems intuitive enough, and asking the user to run the unstage
command to achieve essentially the same thing is not nice.

OK by me for your original diff.