git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, Philip Oakley <philipoakley@iee.org>,
	git@vger.kernel.org
Subject: Re: [PATCH v3 05/14] Change fetch_pack() and friends to take string_list arguments
Date: Mon, 17 Sep 2012 14:24:26 +0200	[thread overview]
Message-ID: <5057167A.6040403@alum.mit.edu> (raw)
In-Reply-To: <7vipblmwaq.fsf@alter.siamese.dyndns.org>

On 09/10/2012 10:56 PM, Junio C Hamano wrote:
> Michael Haggerty <mhagger@alum.mit.edu> writes:
>> diff --git a/fetch-pack.h b/fetch-pack.h
>> index 1dbe90f..a6a8a73 100644
>> --- a/fetch-pack.h
>> +++ b/fetch-pack.h
>> @@ -1,6 +1,8 @@
>>  #ifndef FETCH_PACK_H
>>  #define FETCH_PACK_H
>>  
>> +#include "string-list.h"
>> +
>>  struct fetch_pack_args {
>>  	const char *uploadpack;
>>  	int unpacklimit;
>> @@ -21,8 +23,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
>>  		       int fd[], struct child_process *conn,
>>  		       const struct ref *ref,
>>  		       const char *dest,
>> -		       int nr_heads,
>> -		       char **heads,
>> +		       struct string_list *sought,
>>  		       char **pack_lockfile);
> 
> This is a tangent, but I _think_ our header files ignore the dogma
> some other projects follow that insists on each header file to be
> self sufficient, i.e.
> 
> 	gcc fetch-pack.h
> 
> should pass.  Instead, our *.c files that include fetch-pack.h are
> responsible for including everything the headers they include need.
> So even though fetch-pack.h does not include run-command.h, it
> declares a function that takes "struct child_process *" in its
> arguments.  The new "struct string_list *" falls into the same camp.
> 
> Given that, I'd prefer to see the scope of this patch series shrunk
> and have the caller include string-list.h, not here.
> 
> Updating the headers and sources so that each to be self sufficient
> is a different topic, and I do not think there is a consensus yet if
> we want to go that route.

The include line can just be deleted, because the three files that
include it already get string-list.h from somewhere:

* builtin/clone.c, builtin/fetch-pack.c
  includes builtin.h
  includes notes.h
  includes string-list.h

* transport.c
  includes string-list.h

Patch forthcoming.

But how far should this policy be taken?  It seems to me that strict
adherence to the policy would dictate that *.h files should *never*
include other git project files.

For example, while working on this, I noticed that notes.h includes
string-list.h and also contains a forward declaration for "struct
string_list".  Obviously, the latter could be deleted.  Alternatively,
both could probably be deleted by ensuring that the relevant *.c files
include string-list.h before including notes.h.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

  reply	other threads:[~2012-09-17 12:24 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-09  6:19 [PATCH v3 00/14] Clean up how fetch_pack() handles the heads list Michael Haggerty
2012-09-09  6:19 ` [PATCH v3 01/14] t5500: add tests of error output for missing refs Michael Haggerty
2012-09-09  6:19 ` [PATCH v3 02/14] t5500: add tests of fetch-pack --all --depth=N $URL $REF Michael Haggerty
2012-09-10 20:46   ` Junio C Hamano
2012-09-10 21:53     ` Michael Haggerty
2012-09-18 23:37       ` Philip Oakley
2012-09-09  6:19 ` [PATCH v3 03/14] Rename static function fetch_pack() to http_fetch_pack() Michael Haggerty
2012-09-09  6:19 ` [PATCH v3 04/14] fetch_pack(): reindent function decl and defn Michael Haggerty
2012-09-09  6:19 ` [PATCH v3 05/14] Change fetch_pack() and friends to take string_list arguments Michael Haggerty
2012-09-10 20:56   ` Junio C Hamano
2012-09-17 12:24     ` Michael Haggerty [this message]
2012-09-17 22:10       ` Junio C Hamano
2012-09-17 22:17         ` Jeff King
2012-09-18 20:49           ` Junio C Hamano
2012-09-09  6:19 ` [PATCH v3 06/14] filter_refs(): do not check the same sought_pos twice Michael Haggerty
2012-09-09  6:19 ` [PATCH v3 07/14] fetch_pack(): update sought->nr to reflect number of unique entries Michael Haggerty
2012-09-09  6:19 ` [PATCH v3 08/14] filter_refs(): delete matched refs from sought list Michael Haggerty
2012-09-09  6:19 ` [PATCH v3 09/14] filter_refs(): build refs list as we go Michael Haggerty
2012-09-10 21:18   ` Junio C Hamano
2012-09-09  6:19 ` [PATCH v3 10/14] filter_refs(): simplify logic Michael Haggerty
2012-09-09  6:19 ` [PATCH v3 11/14] cmd_fetch_pack(): return early if finish_connect() fails Michael Haggerty
2012-09-09  6:19 ` [PATCH v3 12/14] fetch-pack: report missing refs even if no existing refs were received Michael Haggerty
2012-09-09  6:19 ` [PATCH v3 13/14] cmd_fetch_pack(): simplify computation of return value Michael Haggerty
2012-09-09  6:19 ` [PATCH v3 14/14] fetch-pack: eliminate spurious error messages Michael Haggerty
2012-09-09 10:20 ` [PATCH v3 00/14] Clean up how fetch_pack() handles the heads list Junio C Hamano
2012-09-09 13:05   ` Jeff King
2012-09-09 18:15     ` Junio C Hamano
2012-09-10 21:59       ` Michael Haggerty
2012-09-10 22:10         ` Junio C Hamano
2012-09-17 12:55           ` Michael Haggerty
2012-09-17 20:39             ` Junio C Hamano
2012-09-10 21:21 ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=5057167A.6040403@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=philipoakley@iee.org \
    /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.
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 NNTP newsgroup(s).