git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Brandon Williams <bmwill@google.com>
To: Stefan Beller <sbeller@google.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Duy Nguyen <pclouds@gmail.com>
Subject: Re: [WIP/RFC 17/23] repo: introduce new repository object
Date: Tue, 23 May 2017 10:35:09 -0700	[thread overview]
Message-ID: <20170523173509.GC115919@google.com> (raw)
In-Reply-To: <CAGZ79kZoCkrF_ruzkpULQVSZ7=WEgFP+8PcgDhacWBh7ZCac5Q@mail.gmail.com>

On 05/20, Stefan Beller wrote:
> On Thu, May 18, 2017 at 4:21 PM, Brandon Williams <bmwill@google.com> 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")

Those are all great questions, questions that I don't think I have all
the answers for right now.  Since this is still in the idea phase I'm
hoping to hear what other people think this would look like in an ideal
world.  I don't think everything would need to be lazy-init'd or can
easily be done that way.  At least the index stuff isn't set up to
be able to do that.  I can see the config being lazy-init'd in one way
or another, though that would require passing in a repo object instead
of a config-set when you want to look-up a config value (which is
probably very reasonable) that way the config-set stored in the repo
object can be properly initialized.

> 
> >
> > Signed-off-by: Brandon Williams <bmwill@google.com>
> > ---
> >  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 ;)

Darn, I forgot to change this before sending out.  An easy fix, though I
still like this style better :P

> 
> 
> > +       /* 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 ;)

-- 
Brandon Williams

  reply	other threads:[~2017-05-23 17:35 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 23:21 [WIP/RFC 00/23] repository object Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 01/23] convert: convert get_cached_convert_stats_ascii to take an index Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 02/23] convert: convert crlf_to_git " Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 03/23] convert: convert convert_to_git_filter_fd " Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 04/23] convert: convert convert_to_git " Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 05/23] convert: convert renormalize_buffer " Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 06/23] tree: convert read_tree to take an index parameter Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 07/23] ls-files: convert overlay_tree_on_cache to take an index Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 08/23] ls-files: convert write_eolinfo " Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 09/23] ls-files: convert show_killed_files " Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 10/23] ls-files: convert show_other_files " Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 11/23] ls-files: convert show_ru_info " Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 12/23] ls-files: convert ce_excluded " Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 13/23] ls-files: convert prune_cache " Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 14/23] ls-files: convert show_files " Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 15/23] ls-files: factor out debug info into a function Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 16/23] ls-files: factor out tag calculation Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 17/23] repo: introduce new repository object Brandon Williams
2017-05-20 21:25   ` Stefan Beller
2017-05-23 17:35     ` Brandon Williams [this message]
2017-05-18 23:21 ` [WIP/RFC 18/23] repo: add index_state to struct repo Brandon Williams
2017-05-20 21:27   ` Stefan Beller
2017-05-18 23:21 ` [WIP/RFC 19/23] repo: add per repo config Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 20/23] submodule-config: refactor to allow for multiple submodule_cache's Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 21/23] repo: add repo_read_gitmodules Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 22/23] submodule: add is_submodule_active Brandon Williams
2017-05-18 23:21 ` [WIP/RFC 23/23] ls-files: use repository object Brandon Williams
2017-05-19 12:25 ` [WIP/RFC 00/23] " Jeff Hostetler
2017-05-19 18:28 ` Ben Peart
2017-05-23 17:29   ` Brandon Williams
2017-05-20 21:37 ` Stefan Beller
2017-05-22 13:03   ` Johannes Schindelin
2017-05-21  8:23 ` Jacob Keller
2017-05-21 16:28 ` brian m. carlson
2017-05-22 19:35 ` Jeff King
2017-05-23 17:26   ` Brandon Williams
2017-05-24  1:57     ` Junio C Hamano
2017-05-29 10:36   ` Duy Nguyen
2017-05-29 11:23     ` Ævar Arnfjörð Bjarmason
2017-05-29 11:31       ` Duy Nguyen
2017-05-30 17:12         ` Brandon Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170523173509.GC115919@google.com \
    --to=bmwill@google.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).