Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Use is_absolute_path() in sha1_file.c.
author
Johannes Sixt
<johannes.sixt@telecom.at>
Tue, 13 Nov 2007 20:05:00 +0000
(21:05 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 14 Nov 2007 23:18:39 +0000
(15:18 -0800)
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>
sha1_file.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
25482a3
)
diff --git
a/sha1_file.c
b/sha1_file.c
index f007874cbb034ec9efa7f73c42831e0037d452fa..560c0e0d0881d77829d508ca28577f4b452906c6 100644
(file)
--- a/
sha1_file.c
+++ b/
sha1_file.c
@@
-86,7
+86,7
@@
int safe_create_leading_directories(char *path)
char *pos = path;
struct stat st;
char *pos = path;
struct stat st;
- if (
*pos == '/'
)
+ if (
is_absolute_path(path)
)
pos++;
while (pos) {
pos++;
while (pos) {
@@
-253,7
+253,7
@@
static int link_alt_odb_entry(const char * entry, int len, const char * relative
int entlen = pfxlen + 43;
int base_len = -1;
int entlen = pfxlen + 43;
int base_len = -1;
- if (
*entry != '/'
&& relative_base) {
+ if (
!is_absolute_path(entry)
&& relative_base) {
/* Relative alt-odb */
if (base_len < 0)
base_len = strlen(relative_base) + 1;
/* Relative alt-odb */
if (base_len < 0)
base_len = strlen(relative_base) + 1;
@@
-262,7
+262,7
@@
static int link_alt_odb_entry(const char * entry, int len, const char * relative
}
ent = xmalloc(sizeof(*ent) + entlen);
}
ent = xmalloc(sizeof(*ent) + entlen);
- if (
*entry != '/'
&& relative_base) {
+ if (
!is_absolute_path(entry)
&& relative_base) {
memcpy(ent->base, relative_base, base_len - 1);
ent->base[base_len - 1] = '/';
memcpy(ent->base + base_len, entry, len);
memcpy(ent->base, relative_base, base_len - 1);
ent->base[base_len - 1] = '/';
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,
while (cp < ep && *cp != sep)
cp++;
if (last != cp) {
while (cp < ep && *cp != sep)
cp++;
if (last != cp) {
- if (
(*last != '/'
) && depth) {
+ if (
!is_absolute_path(last
) && depth) {
error("%s: ignoring relative alternate object store %s",
relative_base, last);
} else {
error("%s: ignoring relative alternate object store %s",
relative_base, last);
} else {