Re: [PATCH 02/10] repository.c: replace hold_locked_index() with repo_hold_locked_index()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jan 5, 2019 at 9:34 PM Martin Ågren <martin.agren@xxxxxxxxx> wrote:
>
> On Sat, 5 Jan 2019 at 07:07, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> >
> > hold_locked_index() assumes the index path at $GIT_DIR/index. This is
> > not good for places that take an arbitrary index_state instead of
> > the_index, which is basically everywhere except builtin/.
> >
> > Replace it with repo_hold_locked_index(). hold_locked_index() remains
> > as a wrapper around repo_hold_locked_index() to reduce changes in builtin/
>
> > diff --git a/builtin/clone.c b/builtin/clone.c
> > index 7c7f98c72c..ddb3230d21 100644
> > --- a/builtin/clone.c
> > +++ b/builtin/clone.c
> > @@ -8,6 +8,7 @@
> >   * Clone a repository into a different directory that does not yet exist.
> >   */
> >
> > +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>
> I think this should be in patch 10/10.

Eck. There has been a lot of fixups in this series. I guess I fixed up
the wrong commit.

> > -int hold_locked_index(struct lock_file *lk, int lock_flags)
> > -{
> > -       return hold_lock_file_for_update(lk, get_index_file(), lock_flags);
> > -}
>
> > +int repo_hold_locked_index(struct repository *repo,
> > +                          struct lock_file *lf,
> > +                          int flags)
> > +{
> > +       return hold_lock_file_for_update(lf, repo->index_file, flags);
> > +}
>
> `get_index_file()` BUGs if `the_repository->index_file` is NULL, but
> other than that, this looks like a faithful conversion. Do we want to
> keep that check here?

Better than segfault :)
-- 
Duy




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux