git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 05/14] Change fetch_pack() and friends to take string_list arguments

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 10, 2012, 20:56 UTC
Message-ID
<7vipblmwaq.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1347171589-13327-6-git-send-email-mhagger@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
Show 7 quoted lines
> Instead of juggling <nr_heads,heads> (sometimes called
> <nr_match,match>), pass around the list of references to be sought in
> a single string_list variable called "sought".  Future commits will
> make more use of string_list functionality.
>
> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
> ---

The earlier bikeshedding-fest on variable names seems to have produced a winner ;-) I think "sought" captures what it is about very well.

Show 21 quoted lines
> 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.

Previous: Michael HaggertyNext: Michael Haggerty
Message 10 of 32 in “Clean up how fetch_pack() handles the heads list”
  1. 00/14 Clean up how fetch_pack() handles the heads listMichael Haggerty, Sep 9, 2012
  2. 01/14 t5500: add tests of error output for missing refsMichael Haggerty, Sep 9, 2012
  3. 02/14 t5500: add tests of fetch-pack --all --depth=N $URL $REFMichael Haggerty, Sep 9, 2012
  4. Junio C HamanoSep 10, 2012
  5. Michael HaggertySep 10, 2012
  6. Philip OakleySep 18, 2012
  7. 03/14 Rename static function fetch_pack() to http_fetch_pack()Michael Haggerty, Sep 9, 2012
  8. 04/14 fetch_pack(): reindent function decl and defnMichael Haggerty, Sep 9, 2012
  9. 05/14 Change fetch_pack() and friends to take string_list argumentsMichael Haggerty, Sep 9, 2012
  10. Junio C HamanoSep 10, 2012
  11. Michael HaggertySep 17, 2012
  12. Junio C HamanoSep 17, 2012
  13. Jeff KingSep 17, 2012
  14. Junio C HamanoSep 18, 2012
  15. 06/14 filter_refs(): do not check the same sought_pos twiceMichael Haggerty, Sep 9, 2012
  16. 07/14 fetch_pack(): update sought->nr to reflect number of unique entriesMichael Haggerty, Sep 9, 2012
  17. 08/14 filter_refs(): delete matched refs from sought listMichael Haggerty, Sep 9, 2012
  18. 09/14 filter_refs(): build refs list as we goMichael Haggerty, Sep 9, 2012
  19. Junio C HamanoSep 10, 2012
  20. 10/14 filter_refs(): simplify logicMichael Haggerty, Sep 9, 2012
  21. 11/14 cmd_fetch_pack(): return early if finish_connect() failsMichael Haggerty, Sep 9, 2012
  22. 12/14 fetch-pack: report missing refs even if no existing refs were receivedMichael Haggerty, Sep 9, 2012
  23. 13/14 cmd_fetch_pack(): simplify computation of return valueMichael Haggerty, Sep 9, 2012
  24. 14/14 fetch-pack: eliminate spurious error messagesMichael Haggerty, Sep 9, 2012
  25. Junio C HamanoSep 9, 2012
  26. Jeff KingSep 9, 2012
  27. Junio C HamanoSep 9, 2012
  28. Michael HaggertySep 10, 2012
  29. Junio C HamanoSep 10, 2012
  30. Michael HaggertySep 17, 2012
  31. Junio C HamanoSep 17, 2012
  32. Junio C HamanoSep 10, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.