resolve_gitlink_ref(): rename path parameter to submodule

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Sep 4, 2016 at 18:08 UTC a8355bb717aaf2d5d9b3781aa78402d0053fa87a
2 files changed +12 -10
refs.c
+7 -6
@@ -1299,26 +1299,27 @@ const char *resolve_ref_unsafe(const char *refname, int resolve_flags,
1299 resolve_flags, sha1, flags);
1300 }
1301
1302 -int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *sha1)
1302 +int resolve_gitlink_ref(const char *submodule, const char *refname,
1303 + unsigned char *sha1)
1304 {
1304 - size_t len = strlen(path);
1305 + size_t len = strlen(submodule);
1306 struct ref_store *refs;
1307 int flags;
1308
1308 - while (len && path[len - 1] == '/')
1309 + while (len && submodule[len - 1] == '/')
1310 len--;
1311
1312 if (!len)
1313 return -1;
1314
1314 - if (path[len]) {
1315 + if (submodule[len]) {
1316 /* We need to strip off one or more trailing slashes */
1316 - char *stripped = xmemdupz(path, len);
1317 + char *stripped = xmemdupz(submodule, len);
1318
1319 refs = get_ref_store(stripped);
1320 free(stripped);
1321 } else {
1321 - refs = get_ref_store(path);
1322 + refs = get_ref_store(submodule);
1323 }
1324
1325 if (!refs)
refs.h
+5 -4
@@ -77,11 +77,12 @@ int is_branch(const char *refname);
77 int peel_ref(const char *refname, unsigned char *sha1);
78
79 /**
80 - * Resolve refname in the nested "gitlink" repository that is located
81 - * at path. If the resolution is successful, return 0 and set sha1 to
82 - * the name of the object; otherwise, return a non-zero value.
80 + * Resolve refname in the nested "gitlink" repository in the specified
81 + * submodule (which must be non-NULL). If the resolution is
82 + * successful, return 0 and set sha1 to the name of the object;
83 + * otherwise, return a non-zero value.
84 */
84 -int resolve_gitlink_ref(const char *path, const char *refname,
85 +int resolve_gitlink_ref(const char *submodule, const char *refname,
86 unsigned char *sha1);
87
88 /*