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>
This commit is contained in:
parent
48a8475fd3
commit
a8355bb717
13
refs.c
13
refs.c
@ -1299,26 +1299,27 @@ const char *resolve_ref_unsafe(const char *refname, int resolve_flags,
|
|||||||
resolve_flags, sha1, 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;
|
struct ref_store *refs;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
while (len && path[len - 1] == '/')
|
while (len && submodule[len - 1] == '/')
|
||||||
len--;
|
len--;
|
||||||
|
|
||||||
if (!len)
|
if (!len)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (path[len]) {
|
if (submodule[len]) {
|
||||||
/* We need to strip off one or more trailing slashes */
|
/* 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);
|
refs = get_ref_store(stripped);
|
||||||
free(stripped);
|
free(stripped);
|
||||||
} else {
|
} else {
|
||||||
refs = get_ref_store(path);
|
refs = get_ref_store(submodule);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!refs)
|
if (!refs)
|
||||||
|
9
refs.h
9
refs.h
@ -77,11 +77,12 @@ int is_branch(const char *refname);
|
|||||||
int peel_ref(const char *refname, unsigned char *sha1);
|
int peel_ref(const char *refname, unsigned char *sha1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve refname in the nested "gitlink" repository that is located
|
* Resolve refname in the nested "gitlink" repository in the specified
|
||||||
* at path. If the resolution is successful, return 0 and set sha1 to
|
* submodule (which must be non-NULL). If the resolution is
|
||||||
* the name of the object; otherwise, return a non-zero value.
|
* 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);
|
unsigned char *sha1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user