summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-05-28 16:59:42 -0700
committerJunio C Hamano <gitster@pobox.com>2010-05-28 16:59:42 -0700
commit81fa024cd8e336ba257f13fe7724b95baacfa3ad (patch)
tree69029df797195eb186535d82bbaadb8e7ed03712 /dir.c
parentd0b16c8f878bef5c1268e033a3d1f427498c7008 (diff)
parent371276bf29314af04b804cfd877abcac62674a58 (diff)
downloadgit-81fa024cd8e336ba257f13fe7724b95baacfa3ad.tar.gz
Merge branch 'maint'
* maint: Makefile: reenable install with NO_CURL completion: --set-upstream option for git-branch get_cwd_relative(): do not misinterpret suffix as subdirectory
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/dir.c b/dir.c
index cb83332a26..5615f33af1 100644
--- a/dir.c
+++ b/dir.c
@@ -958,9 +958,14 @@ char *get_relative_cwd(char *buffer, int size, const char *dir)
}
if (*dir)
return NULL;
- if (*cwd == '/')
+ switch (*cwd) {
+ case '\0':
+ return cwd;
+ case '/':
return cwd + 1;
- return cwd;
+ default:
+ return NULL;
+ }
}
int is_inside_dir(const char *dir)