Andrew's git
/
gitweb.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'jk/diff-driver-binary-doc' into maint
[gitweb.git]
/
dir.c
diff --git
a/dir.c
b/dir.c
index b2dfb69eb5606a7538cc5e1876a91f703ec4969c..b68750450cdec89df9ea7595ab9a7022619e6e58 100644
(file)
--- a/
dir.c
+++ b/
dir.c
@@
-965,6
+965,12
@@
char *get_relative_cwd(char *buffer, int size, const char *dir)
case '/':
return cwd + 1;
default:
+ /*
+ * dir can end with a path separator when it's root
+ * directory. Return proper prefix in that case.
+ */
+ if (dir[-1] == '/')
+ return cwd;
return NULL;
}
}