Re: [BUG] index corruption with git commit -p

2018-09-04 Thread Jeff King
On Tue, Sep 04, 2018 at 06:13:36PM +0200, Duy Nguyen wrote: > > > Doh, of course. I even thought about this issue and dug all the way into > > > reopen_lock_file(), but for some reason temporarily forgot that O_WRONLY > > > does not imply O_TRUNC. > > > > > > Arguably this should be the default fo

Re: [BUG] index corruption with git commit -p

2018-09-04 Thread Duy Nguyen
On Tue, Sep 4, 2018 at 5:57 PM Junio C Hamano wrote: > > Jeff King writes: > > >> diff --git a/builtin/commit.c b/builtin/commit.c > >> index 2be7bdb331..60f30b3780 100644 > >> --- a/builtin/commit.c > >> +++ b/builtin/commit.c > >> @@ -432,6 +432,7 @@ static const char *prepare_index(int argc, c

Re: [BUG] index corruption with git commit -p

2018-09-04 Thread Junio C Hamano
Jeff King writes: >> diff --git a/builtin/commit.c b/builtin/commit.c >> index 2be7bdb331..60f30b3780 100644 >> --- a/builtin/commit.c >> +++ b/builtin/commit.c >> @@ -432,6 +432,7 @@ static const char *prepare_index(int argc, const char >> **argv, const char *prefix >> if (update_m

Re: [BUG] index corruption with git commit -p

2018-09-02 Thread Jeff King
On Sun, Sep 02, 2018 at 09:53:53AM +0200, Luc Van Oostenryck wrote: > > At any rate, I think this perfectly explains the behavior we're seeing. > > Yes, this certainly make sense. > > For fun (and testing) I tried to take the problem in the other direction: > * why hasn't this be detected earlie

Re: [BUG] index corruption with git commit -p

2018-09-02 Thread Luc Van Oostenryck
On Sun, Sep 02, 2018 at 03:24:09AM -0400, Jeff King wrote: > On Sun, Sep 02, 2018 at 09:12:04AM +0200, Duy Nguyen wrote: > > diff --git a/builtin/commit.c b/builtin/commit.c > > index 2be7bdb331..60f30b3780 100644 > > --- a/builtin/commit.c > > +++ b/builtin/commit.c > > @@ -432,6 +432,7 @@ static

Re: [BUG] index corruption with git commit -p

2018-09-02 Thread Jeff King
On Sun, Sep 02, 2018 at 09:12:04AM +0200, Duy Nguyen wrote: > > diff --git a/builtin/commit.c b/builtin/commit.c > > index 0d9828e29e..779c5e2cb5 100644 > > --- a/builtin/commit.c > > +++ b/builtin/commit.c > > @@ -359,13 +359,6 @@ static const char *prepare_index(int argc, const char > > **argv,

Re: [BUG] index corruption with git commit -p

2018-09-02 Thread Duy Nguyen
On Sun, Sep 02, 2018 at 01:08:03AM -0400, Jeff King wrote: > On Sun, Sep 02, 2018 at 12:17:53AM +0200, Ævar Arnfjörð Bjarmason wrote: > > > > Here are the steps to reproduce it: > > > $ git clone git://github.com/lucvoo/sparse-dev.git > > > $ cd > > > $ git co index-corruption > > > $ gi

Re: [BUG] index corruption with git commit -p

2018-09-01 Thread Jeff King
On Sun, Sep 02, 2018 at 12:17:53AM +0200, Ævar Arnfjörð Bjarmason wrote: > > Here are the steps to reproduce it: > > $ git clone git://github.com/lucvoo/sparse-dev.git > > $ cd > > $ git co index-corruption > > $ git rm -r validation/ Documentation/ > > $ git commit -m -p > > $ git

Re: [BUG] index corruption with git commit -p

2018-09-01 Thread Ævar Arnfjörð Bjarmason
On Sat, Sep 01 2018, Luc Van Oostenryck wrote: > Hi, > > I've just had a scary error: > error: index uses $?+? extension, which we do not understand > fatal: index file corrupt > > Things were quickly recovered by deleting the index but it clearly > looks to a but to me. > > Here are

[BUG] index corruption with git commit -p

2018-09-01 Thread Luc Van Oostenryck
Hi, I've just had a scary error: error: index uses $?+? extension, which we do not understand fatal: index file corrupt Things were quickly recovered by deleting the index but it clearly looks to a but to me. Here are the steps to reproduce it: $ git clone git://github.com/lucv