git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Thomas Gummerer <t.gummerer@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [PATCH v1 1/2] checkout: factor out functions to new lib file
Date: Tue, 14 Nov 2017 08:46:07 +0000	[thread overview]
Message-ID: <20171114084607.GB12097@hank> (raw)
In-Reply-To: <xmqq7euuc32z.fsf@gitster.mtv.corp.google.com>

On 11/13, Junio C Hamano wrote:
> Thomas Gummerer <t.gummerer@gmail.com> writes:
> 
> > Factor the functions out, so they can be re-used from other places.  In
> > particular these functions will be re-used in builtin/worktree.c to make
> > git worktree add dwim more.
> >
> > While there add a description to the function.
> >
> > Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
> > ---
> >
> > I'm not sure where these functions should go ideally, they don't seem
> > to fit in any existing library file, so I created a new one for now.
> > Any suggestions for a better home are welcome!
> >
> >  Makefile           |  1 +
> >  builtin/checkout.c | 41 +----------------------------------------
> >  checkout.c         | 43 +++++++++++++++++++++++++++++++++++++++++++
> >  checkout.h         | 14 ++++++++++++++
> >  4 files changed, 59 insertions(+), 40 deletions(-)
> >  create mode 100644 checkout.c
> >  create mode 100644 checkout.h
> 
> I am not sure either.  I've always considered that entry.c is the
> libified thing codepath that want to do a "checkout" should call,
> but the functions that you are moving is at a "higher layer" that
> does not concern the core-git data structures (i.e. the 'tracking'
> is a mere "user" of the ref API, unlike things in entry.c such as
> checkout_entry() that is a more "maintainer" of the index integrity),
> so perhaps it makes sense to have new file for it.

Makes sense, let me keep it as a new file then.

> > diff --git a/checkout.c b/checkout.c
> > new file mode 100644
> > index 0000000000..a9cf378453
> > --- /dev/null
> > +++ b/checkout.c
> > @@ -0,0 +1,43 @@
> > +#include "cache.h"
> > +
> 
> A useless blank line.
> 
> > +#include "remote.h"
> > +
> 
> This one is useful ;-)
> 
> > +struct tracking_name_data {
> > ...
> > diff --git a/checkout.h b/checkout.h
> > new file mode 100644
> > index 0000000000..9272fe1449
> > --- /dev/null
> > +++ b/checkout.h
> > @@ -0,0 +1,14 @@
> > +#ifndef CHECKOUT_H
> > +#define CHECKOUT_H
> > +
> > +#include "git-compat-util.h"
> > +#include "cache.h"
> 
> Try "git grep -e git-compat-util Documentation/CodingGuidelines" and
> just keep inclusion of "cache.h".

Ah I forgot about that.  Will fix, thanks!

  reply	other threads:[~2017-11-14  8:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-12 13:43 [PATCH v1 1/2] checkout: factor out functions to new lib file Thomas Gummerer
2017-11-12 13:43 ` [PATCH v1 2/2] worktree: make add dwim Thomas Gummerer
2017-11-13  3:04   ` Junio C Hamano
2017-11-14  8:45     ` Thomas Gummerer
2017-11-14 20:14       ` Eric Sunshine
2017-11-14 20:29         ` Eric Sunshine
2017-11-15  8:52           ` Thomas Gummerer
2017-11-18 18:13             ` Thomas Gummerer
2017-11-15  8:50         ` Thomas Gummerer
2017-11-15  9:12           ` Eric Sunshine
2017-11-13  2:41 ` [PATCH v1 1/2] checkout: factor out functions to new lib file Junio C Hamano
2017-11-14  8:46   ` Thomas Gummerer [this message]
2017-11-18 18:11 ` [PATCH v2 1/3] " Thomas Gummerer
2017-11-18 18:11   ` [PATCH v2 2/3] worktree: make add <path> <branch> dwim Thomas Gummerer
2017-11-18 22:18     ` Thomas Gummerer
2017-11-18 18:11   ` [PATCH v2 3/3] worktree: make add <path> dwim Thomas Gummerer
2017-11-18 22:47   ` [PATCH v3 0/3] make git worktree add dwim more Thomas Gummerer
2017-11-18 22:47     ` [PATCH v3 1/3] checkout: factor out functions to new lib file Thomas Gummerer
2017-11-18 22:47     ` [PATCH v3 2/3] worktree: make add <path> <branch> dwim Thomas Gummerer
2017-11-19  8:31       ` Eric Sunshine
2017-11-19 17:43         ` Thomas Gummerer
2017-11-18 22:47     ` [PATCH v3 3/3] worktree: make add <path> dwim Thomas Gummerer
2017-11-19 19:04       ` Eric Sunshine
2017-11-19 20:20         ` Eric Sunshine
2017-11-20  0:39           ` Junio C Hamano
2017-11-21 22:13           ` Thomas Gummerer
2017-11-22  1:20             ` Junio C Hamano
2017-11-22 19:49               ` Thomas Gummerer

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=20171114084607.GB12097@hank \
    --to=t.gummerer@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.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).