baseline

yet another open-source distributed versioning control system
Log | Files | Refs

commit b8b35e2e1023c9ffe12b0b2101d79e4ea5b190e8
parent 3f8e633759e57131b6727b253c944b8bfc36db54
Author: Mohamed Aslan <maslan@sce.carleton.ca>
Date:   Fri, 27 Jun 2014 15:11:52 -0400

fix baseline add '.' bug

Diffstat:
Mdircache-simple.c | 19+++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/dircache-simple.c b/dircache-simple.c @@ -243,7 +243,7 @@ static int simple_insert(struct dircache_ctx *dc_ctx, const char *path) { char *objid, *paths[2], *cache_path; - char *dc_path; + char *dc_path, *p; struct stat s, fs; FILE *fp; FTS *dir; @@ -270,15 +270,18 @@ simple_insert(struct dircache_ctx *dc_ctx, const char *path) printf("DS: %s\n", entry->fts_path); #endif /* FIXME: path check is required */ - asprintf(&cache_path, "%s/%s", dc_path, dir_diff(entry->fts_path, dc_ctx->repo_rootpath)); - if (mkdir(cache_path, S_IRUSR | S_IWUSR | S_IXUSR) != 0) { - free(cache_path); - return EXIT_FAILURE; - } + p = dir_diff(entry->fts_path, dc_ctx->repo_rootpath); + if (*p != '\0') { + asprintf(&cache_path, "%s/%s", dc_path, p); + if (mkdir(cache_path, S_IRUSR | S_IWUSR | S_IXUSR) != 0) { + free(cache_path); + return EXIT_FAILURE; + } #ifdef DEBUG - printf("[DEBUG] dircache: created dir %s\n", cache_path); + printf("[DEBUG] dircache: created dir %s\n", cache_path); #endif - free(cache_path); + free(cache_path); + } } if(entry->fts_info & FTS_F) { #ifdef DEBUG