Use is_absolute_path() in sha1_file.c.
There are some places that test for an absolute path. Use the helper function to ease porting. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt committed
Nov 13, 2007 at 21:05 UTC
85dadc389468211a2fc0006ce8ea524490d417f5
1 file changed
+4
-4
sha1_file.c
+4
-4
@@ -86,7 +86,7 @@ int safe_create_leading_directories(char *path)
86
char *pos = path;
87
struct stat st;
88
89
- if (*pos == '/')
89
+ if (is_absolute_path(path))
90
pos++;
91
92
while (pos) {
@@ -253,7 +253,7 @@ static int link_alt_odb_entry(const char * entry, int len, const char * relative
253
int entlen = pfxlen + 43;
254
int base_len = -1;
255
256
- if (*entry != '/' && relative_base) {
256
+ if (!is_absolute_path(entry) && relative_base) {
257
/* Relative alt-odb */
258
if (base_len < 0)
259
base_len = strlen(relative_base) + 1;
@@ -262,7 +262,7 @@ static int link_alt_odb_entry(const char * entry, int len, const char * relative
262
}
263
ent = xmalloc(sizeof(*ent) + entlen);
264
265
- if (*entry != '/' && relative_base) {
265
+ if (!is_absolute_path(entry) && relative_base) {
266
memcpy(ent->base, relative_base, base_len - 1);
267
ent->base[base_len - 1] = '/';
268
memcpy(ent->base + base_len, entry, len);
@@ -333,7 +333,7 @@ static void link_alt_odb_entries(const char *alt, const char *ep, int sep,
333
while (cp < ep && *cp != sep)
334
cp++;
335
if (last != cp) {
336
- if ((*last != '/') && depth) {
336
+ if (!is_absolute_path(last) && depth) {
337
error("%s: ignoring relative alternate object store %s",
338
relative_base, last);
339
} else {