summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-07 16:13:28 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-07 16:13:28 -0300
commitef76af20b1d90afb6fd245e4ddc2ddbfa112a8a1 (patch)
tree4a736aa7fe16ba53736cd153dd8ed179711afcd4
parent7edd2df8abab95c5e221db209995a1688719f1b4 (diff)
downloadeeshow-ef76af20b1d90afb6fd245e4ddc2ddbfa112a8a1.tar.gz
eeshow-ef76af20b1d90afb6fd245e4ddc2ddbfa112a8a1.tar.bz2
eeshow-ef76af20b1d90afb6fd245e4ddc2ddbfa112a8a1.zip
eeshow/git-file.c (canonical_path_into_repo): really catch divergent paths
-rw-r--r--git-file.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/git-file.c b/git-file.c
index 8972df4..26ff1c6 100644
--- a/git-file.c
+++ b/git-file.c
@@ -237,15 +237,16 @@ static char *canonical_path_into_repo(const char *repo_dir, const char *path)
path_st.st_ino == repo_st.st_ino)
break;
+ slash = strrchr(tmp, '/');
+
/* "this cannot happen" */
- if (tail == tmp) {
+ if (tail == tmp || !slash) {
fprintf(stderr,
"divergent paths:\nrepo \"%s\"\nobject \"%s\"\n",
- repo_dir, tmp);
+ repo_dir, tail);
exit(1);
}
- slash = strrchr(tmp, '/');
if (tail != end)
tail[-1] = '/';
tail = slash + 1;