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

Re: [PATCH] Improvements to git-archive tests and add_submodule_odb()

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 3, 2013, 17:52 UTC
Message-ID
<xmqqd2ldq0su.fsf@gitster.dls.corp.google.com>
In-Reply-To
<6D370472-81BB-4249-9ADA-1C906C26D88F@mac.com>
Nick Townsend <nick.townsend@mac.com> writes:
> From: Nick Townsend <nick.townsend@mac.com>
> Date: Mon, 25 Nov 2013 15:31:09 -0800
> Subject: [PATCH 1/2] submodule: add_submodule_odb() usability

Please do not add these; instead, drop From/Date (because we can see them in the mail header from your MUA) and replace the mail header Subject with this one.

The body of the patch looks OK to me (provided that we'd want to promote use of that function).

Thanks.
Show 56 quoted lines
> Although add_submodule_odb() is documented as being
> externally usable, it is declared static and also
> has incorrect documentation.  This commit fixes those
> and makes no changes to existing code using them.
> All tests still pass.
>
> Improved wording based on Rene Scharfe feedback
>
> Signed-off-by: Nick Townsend <nick.townsend@mac.com>
> ---
>  Documentation/technical/api-ref-iteration.txt | 4 ++--
>  submodule.c                                   | 2 +-
>  submodule.h                                   | 1 +
>  3 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/technical/api-ref-iteration.txt b/Documentation/technical/api-ref-iteration.txt
> index aa1c50f..02adfd4 100644
> --- a/Documentation/technical/api-ref-iteration.txt
> +++ b/Documentation/technical/api-ref-iteration.txt
> @@ -50,10 +50,10 @@ submodules object database. You can do this by a code-snippet like
>  this:
>  
>  	const char *path = "path/to/submodule"
> -	if (!add_submodule_odb(path))
> +	if (add_submodule_odb(path))
>  		die("Error submodule '%s' not populated.", path);
>  
> -`add_submodule_odb()` will return an non-zero value on success. If you
> +`add_submodule_odb()` will return zero on success. If you
>  do not do this you will get an error for each ref that it does not point
>  to a valid object.
>  
> diff --git a/submodule.c b/submodule.c
> index 1905d75..1ea46be 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -143,7 +143,7 @@ void stage_updated_gitmodules(void)
>  		die(_("staging updated .gitmodules failed"));
>  }
>  
> -static int add_submodule_odb(const char *path)
> +int add_submodule_odb(const char *path)
>  {
>  	struct strbuf objects_directory = STRBUF_INIT;
>  	struct alternate_object_database *alt_odb;
> diff --git a/submodule.h b/submodule.h
> index 7beec48..3e3cdca 100644
> --- a/submodule.h
> +++ b/submodule.h
> @@ -41,5 +41,6 @@ int find_unpushed_submodules(unsigned char new_sha1[20], const char *remotes_nam
>  		struct string_list *needs_pushing);
>  int push_unpushed_submodules(unsigned char new_sha1[20], const char *remotes_name);
>  void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir);
> +int add_submodule_odb(const char *path);
>  
>  #endif
Previous: Nick TownsendNext: Heiko Voigt
Message 3 of 13 in “Improvements to git-archive tests and add_submodule_odb()”
  1. Improvements to git-archive tests and add_submodule_odb()Nick Townsend, Dec 3, 2013
  2. Nick TownsendDec 3, 2013
  3. Junio C HamanoDec 3, 2013
  4. Heiko VoigtDec 3, 2013
  5. Re* [PATCH] Improvements to git-archive tests and add_submodule_odb()Junio C Hamano, Dec 3, 2013
  6. Heiko VoigtDec 3, 2013
  7. Nick TownsendDec 3, 2013
  8. Eric SunshineDec 3, 2013
  9. Junio C HamanoDec 3, 2013
  10. Additional git-archive testsNick Townsend, Dec 5, 2013
  11. Junio C HamanoDec 5, 2013
  12. Nick TownsendDec 10, 2013
  13. Junio C HamanoDec 10, 2013

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.