[PATCH 1/2] refs.c: change do_one_ref to not discard any of base

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



do_one_ref only compared trim characters of base with the actual ref
name, which basically meant that passing in more than trim characters
in base was pointless.  So use prefixcmp instead, so that all of base
is compared.

This allows for_each_ref to trim only part of the string provided as
base (for example).

Signed-off-by: Julian Phillips <julian@xxxxxxxxxxxxxxxxx>
---
 refs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/refs.c b/refs.c
index 89876bf..a771975 100644
--- a/refs.c
+++ b/refs.c
@@ -467,7 +467,7 @@ int read_ref(const char *ref, unsigned char *sha1)
 static int do_one_ref(const char *base, each_ref_fn fn, int trim,
 		      void *cb_data, struct ref_list *entry)
 {
-	if (strncmp(base, entry->name, trim))
+	if (prefixcmp(entry->name, base))
 		return 0;
 	if (is_null_sha1(entry->sha1))
 		return 0;
-- 
1.5.1.2


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]