On Thu, May 18, 2017 at 4:21 PM, Brandon Williams <bmwill@xxxxxxxxxx> wrote: > Introduce 'struct repo' an object used to represent a repository. Is this the right place to outline what you expect from a repo object? Are you planning to use it everywhere? Is it lazy-init'd and it takes care of it itself, or would the caller have to take care of the state of the repo? ("the repo object is just a place to put the current globals") > > Signed-off-by: Brandon Williams <bmwill@xxxxxxxxxx> > --- > Makefile | 1 + > repo.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > repo.h | 15 +++++++++++++++ > 3 files changed, 58 insertions(+) > create mode 100644 repo.c > create mode 100644 repo.h > > diff --git a/Makefile b/Makefile > index e35542e63..a49d2f96a 100644 > --- a/Makefile > +++ b/Makefile > @@ -821,6 +821,7 @@ LIB_OBJS += refs/ref-cache.o > LIB_OBJS += ref-filter.o > LIB_OBJS += remote.o > LIB_OBJS += replace_object.o > +LIB_OBJS += repo.o > LIB_OBJS += rerere.o > LIB_OBJS += resolve-undo.o > LIB_OBJS += revision.o > diff --git a/repo.c b/repo.c > new file mode 100644 > index 000000000..d47e98d95 > --- /dev/null > +++ b/repo.c > @@ -0,0 +1,42 @@ > +#include "cache.h" > +#include "repo.h" > + > +int > +repo_init(struct repo *repo, const char *gitdir, const char *worktree) style ;) > + /* Maybe need a check to verify that a worktree is indeed a worktree? */ add NEEDSWORK/FIXME prefix to comment? > +void > +repo_clear(struct repo *repo) style ;)