Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-24 Thread Jacob Keller
On Fri, Aug 24, 2018 at 7:42 AM Duy Nguyen wrote: > > On Fri, Aug 24, 2018 at 5:02 AM Jacob Keller wrote: > > > > On Thu, Aug 23, 2018 at 9:28 AM Junio C Hamano wrote: > > > I think the above example forgets "-a" on the final "git commit" > > > step. With it added, I can understand the concern

Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-24 Thread Duy Nguyen
On Fri, Aug 24, 2018 at 5:02 AM Jacob Keller wrote: > > On Thu, Aug 23, 2018 at 9:28 AM Junio C Hamano wrote: > > I think the above example forgets "-a" on the final "git commit" > > step. With it added, I can understand the concern (and I am sure > > you would, too). > > > > The user is trying

Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-23 Thread Jacob Keller
On Thu, Aug 23, 2018 at 9:28 AM Junio C Hamano wrote: > I think the above example forgets "-a" on the final "git commit" > step. With it added, I can understand the concern (and I am sure > you would, too). > > The user is trying to add everything done in the working tree, and > "commit -a"

Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-23 Thread Jacob Keller
On Mon, Aug 20, 2018 at 8:43 AM Nguyễn Thái Ngọc Duy wrote: > Instead, let's handle just this problem for now. This new option > commit.preciousDirtyIndex, if set to false, will not allow `commit -a` > to continue if the final index is different from the existing one. I > don't think this can be

Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-23 Thread Junio C Hamano
Duy Nguyen writes: > On Thu, Aug 23, 2018 at 4:15 AM Jonathan Nieder wrote: >> > The remaining question becomes scripts. A script might do >> > >> > ... modify old-file and create new-file ... >> > git add new-file >> > git commit -m "some great message" >> > >> > which would

Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-23 Thread Duy Nguyen
On Thu, Aug 23, 2018 at 4:15 AM Jonathan Nieder wrote: > > The remaining question becomes scripts. A script might do > > > > ... modify old-file and create new-file ... > > git add new-file > > git commit -m "some great message" > > > > which would trip this error. For that

Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-22 Thread Jonathan Nieder
A few quick corrections: Jonathan Nieder wrote: > I'm starting to lean toward having this on unconditionally, with a > message that points the user who really doesn't want to clobber their ... who really *does* want to clobber their index ... > index toward "git add -u", as a good idea. I

Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-22 Thread Jonathan Nieder
Duy Nguyen wrote: > On Mon, Aug 20, 2018 at 9:30 PM Jonathan Nieder wrote: >> I frequently use "git commit -a" this way intentionally, so I would be >> unlikely to turn this config on. That leads me to suspect it's not a >> good candidate for configuration: >> >> - it's not configuration for

Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-21 Thread Duy Nguyen
On Mon, Aug 20, 2018 at 9:30 PM Jonathan Nieder wrote: > > Hi, > > Nguyễn Thái Ngọc Duy wrote: > > > So many times I have carefully cherry picked changes to the index with > > `git add -p` then accidentally did `git commit -am ` (usually by > > retrieving a command from history and pressing

Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-20 Thread Jonathan Nieder
Hi, Nguyễn Thái Ngọc Duy wrote: > So many times I have carefully cherry picked changes to the index with > `git add -p` then accidentally did `git commit -am ` (usually by > retrieving a command from history and pressing Enter too quickly) > which destroyed beautiful index. > > One way to

Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-20 Thread Eric Sunshine
On Mon, Aug 20, 2018 at 11:41 AM Nguyễn Thái Ngọc Duy wrote: > One way to deal with this is some form of `git undo` that allows me to > retrieve the old index. That's not a lot of work by itself. The problem > is designing that `git undo` interface because there are more undo > options that this.

Re: [PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-20 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > +commit.preciousDirtyIndex:: > + If some changes are partially staged in the index (i.e. > + "git commit -a" and "git commit" commit different changes), reject > + "git commit -a". Or perhaps better yet, go into yes/no interaction to confirm if you

[PATCH/RFC] commit: new option to abort -a something is already staged

2018-08-20 Thread Nguyễn Thái Ngọc Duy
So many times I have carefully cherry picked changes to the index with `git add -p` then accidentally did `git commit -am ` (usually by retrieving a command from history and pressing Enter too quickly) which destroyed beautiful index. One way to deal with this is some form of `git undo` that