git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sha1_file: move comment about return value where it belongs
@ 2013-10-26 22:34 Christian Couder
  2013-10-28 20:19 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Couder @ 2013-10-26 22:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jeff King

Commit 5b0864070 (sha1_object_info_extended: make type calculation
optional, Jul 12 2013) changed the return value of the
sha1_object_info_extended function to 0/-1 for success/error.

Previously this function returned the object type for success or
-1 for error. But unfortunately the above commit forgot to change
or move the comment above this function that says "returns enum
object_type or negative".

To fix this inconsistency, let's move the comment above the
sha1_object_info function where it is still true.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 sha1_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sha1_file.c b/sha1_file.c
index f80bbe4..7dadd04 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2514,7 +2514,6 @@ static int sha1_loose_object_info(const unsigned char *sha1,
 	return 0;
 }
 
-/* returns enum object_type or negative */
 int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
 {
 	struct cached_object *co;
@@ -2563,6 +2562,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
 	return 0;
 }
 
+/* returns enum object_type or negative */
 int sha1_object_info(const unsigned char *sha1, unsigned long *sizep)
 {
 	enum object_type type;
-- 
1.8.4.rc1.28.ge2684af

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sha1_file: move comment about return value where it belongs
  2013-10-26 22:34 [PATCH] sha1_file: move comment about return value where it belongs Christian Couder
@ 2013-10-28 20:19 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2013-10-28 20:19 UTC (permalink / raw)
  To: Christian Couder; +Cc: Junio C Hamano, git

On Sun, Oct 27, 2013 at 12:34:30AM +0200, Christian Couder wrote:

> Commit 5b0864070 (sha1_object_info_extended: make type calculation
> optional, Jul 12 2013) changed the return value of the
> sha1_object_info_extended function to 0/-1 for success/error.
> 
> Previously this function returned the object type for success or
> -1 for error. But unfortunately the above commit forgot to change
> or move the comment above this function that says "returns enum
> object_type or negative".
> 
> To fix this inconsistency, let's move the comment above the
> sha1_object_info function where it is still true.

Thanks for catching this. Your analysis and patch looks good to me.

-Peff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-28 20:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-26 22:34 [PATCH] sha1_file: move comment about return value where it belongs Christian Couder
2013-10-28 20:19 ` Jeff King

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).