Thread (47 messages) 47 messages, 4 authors, 2016-09-08

[PATCH v2 18/38] resolve_gitlink_ref(): rename path parameter to submodule

flat view
STALE3692d

From: Michael Haggerty <hidden>
Date: 2016-09-04 16:10:50
Subsystem: the rest · Maintainer: Linus Torvalds

Revision v2 of 2 in this series.

Revisions (2)
  1. v1 [diff vs current]
  2. v2 current
Signed-off-by: Michael Haggerty <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
 refs.c | 13 +++++++------
 refs.h |  9 +++++----
 2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/refs.c b/refs.c
index 34c0c5e..e881874 100644
--- a/refs.c
+++ b/refs.c
@@ -1299,26 +1299,27 @@ const char *resolve_ref_unsafe(const char *refname, int resolve_flags,
 				       resolve_flags, sha1, flags);
 }
 
-int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *sha1)
+int resolve_gitlink_ref(const char *submodule, const char *refname,
+			unsigned char *sha1)
 {
-	size_t len = strlen(path);
+	size_t len = strlen(submodule);
 	struct ref_store *refs;
 	int flags;
 
-	while (len && path[len - 1] == '/')
+	while (len && submodule[len - 1] == '/')
 		len--;
 
 	if (!len)
 		return -1;
 
-	if (path[len]) {
+	if (submodule[len]) {
 		/* We need to strip off one or more trailing slashes */
-		char *stripped = xmemdupz(path, len);
+		char *stripped = xmemdupz(submodule, len);
 
 		refs = get_ref_store(stripped);
 		free(stripped);
 	} else {
-		refs = get_ref_store(path);
+		refs = get_ref_store(submodule);
 	}
 
 	if (!refs)
diff --git a/refs.h b/refs.h
index 9a29f1b..17e8cfb 100644
--- a/refs.h
+++ b/refs.h
@@ -77,11 +77,12 @@ int is_branch(const char *refname);
 int peel_ref(const char *refname, unsigned char *sha1);
 
 /**
- * Resolve refname in the nested "gitlink" repository that is located
- * at path.  If the resolution is successful, return 0 and set sha1 to
- * the name of the object; otherwise, return a non-zero value.
+ * Resolve refname in the nested "gitlink" repository in the specified
+ * submodule (which must be non-NULL). If the resolution is
+ * successful, return 0 and set sha1 to the name of the object;
+ * otherwise, return a non-zero value.
  */
-int resolve_gitlink_ref(const char *path, const char *refname,
+int resolve_gitlink_ref(const char *submodule, const char *refname,
 			unsigned char *sha1);
 
 /*
-- 
2.9.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help