Re: [PATCH] mv: prevent mismatched data when ignoring errors.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 11, 2014, 21:45 UTC
- Message-ID
- <xmqqfvmoo1d4.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1394306499-50871-1-git-send-email-sandals@crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 25 quoted lines
> We shrink the source and destination arrays, but not the modes or > submodule_gitfile arrays, resulting in potentially mismatched data. Shrink > all the arrays at the same time to prevent this. > > Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> > --- > builtin/mv.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/builtin/mv.c b/builtin/mv.c > index f99c91e..b20cd95 100644 > --- a/builtin/mv.c > +++ b/builtin/mv.c > @@ -230,6 +230,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix) > memmove(destination + i, > destination + i + 1, > (argc - i) * sizeof(char *)); > + memmove(modes + i, modes + i + 1, > + (argc - i) * sizeof(char *)); > + memmove(submodule_gitfile + i, > + submodule_gitfile + i + 1, > + (argc - i) * sizeof(char *)); > i--; > } > } else
Thanks. Neither this nor John's seems to describe the user-visible way to trigger the symptom. Can we have tests for them?