Re* [PATCH] Improvements to git-archive tests and add_submodule_odb()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 3, 2013, 18:39 UTC
- Message-ID
- <xmqqpppdok2f.fsf_-_@gitster.dls.corp.google.com>
- In-Reply-To
- <20131203181807.GA4629@sandbox-ub>
Heiko Voigt <hvoigt@hvoigt.net> writes:
Show 22 quoted lines
> On Mon, Dec 02, 2013 at 04:14:37PM -0800, Nick Townsend wrote:
>> 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)
>
> I am not against making add_submodule_odb() usable from outside
> submodule.c but I would prefer if this change goes along with some code
> actually using it. The reason being that when refactoring or extending
> you immediately know that a function is file local only with the static
> keyword. Without anyone using this function from outside submodule.c
> this fact is still true and so the code should say, IMO.
>
> Its not a big deal to postpone removing this keyword in a later commit
> so I would like to drop this change from the patch. The documentation
> fix is fine with me.OK, thanks, then let's do this.
-- >8 -- From: Nick Townsend <nick.townsend@mac.com> Date: Mon, 25 Nov 2013 15:31:09 -0800 Subject: [PATCH] ref-iteration doc: add_submodule_odb() returns 0 for success
The usage sample of add_submodule_odb() function in the Submodules section expects non-zero return value for success, but the function actually reports success with zero.
Helped-by: René Scharfe <l.s.r@web.de> Reviewed-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Nick Townsend <nick.townsend@mac.com> --- Documentation/technical/api-ref-iteration.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 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.
-- 1.8.5-262-g1a2486c