summaryrefslogtreecommitdiff
path: root/src/refs.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2013-02-07 23:44:18 +0100
committernulltoken <emeric.fermas@gmail.com>2013-02-11 23:19:41 +0100
commit2bca5b679b9e1f7f7e5cfafa75a6a94549875197 (patch)
tree90c9ae1b89aea407c34f54ad3a878f2425d186ab /src/refs.c
parent4d811c3b77158fdb7ee50b389c3aa8763482c61a (diff)
downloadlibgit2-2bca5b679b9e1f7f7e5cfafa75a6a94549875197.tar.gz
remote: Introduce git_remote_is_valid_name()
Fix libgit2/libgit2sharp#318
Diffstat (limited to 'src/refs.c')
-rw-r--r--src/refs.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/refs.c b/src/refs.c
index fd57ce8f7..7dabfefae 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1622,7 +1622,7 @@ static int ensure_segment_validity(const char *name)
/* A refname component can not end with ".lock" */
if (current - name >= lock_len &&
- !git__strncmp(current - lock_len, GIT_FILELOCK_EXTENSION, lock_len))
+ !memcmp(current - lock_len, GIT_FILELOCK_EXTENSION, lock_len))
return -1;
return (int)(current - name);
@@ -1697,11 +1697,10 @@ int git_reference__normalize_name(
segments_count++;
}
- /* This means that there's a leading slash in the refname */
- if (segment_len == 0 && segments_count == 0) {
+ /* No empty segment is allowed when not normalizing */
+ if (segment_len == 0 && !normalize)
goto cleanup;
- }
-
+
if (current[segment_len] == '\0')
break;