commit a0da5033f6cb2f417a9674fe2850a30ee93a6324
parent 766ef8cf22f28b8d026023a0876a42c059e8856f
Author: Mohamed Aslan <maslan@sce.carleton.ca>
Date: Mon, 26 May 2014 14:11:12 -0400
fix bug introduced by f3885ee60daed0edd4006cac44bdbe170e8b7957 where cmd-add failed in case of directories
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/dircache-simple.c b/dircache-simple.c
@@ -253,7 +253,7 @@ 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, entry->fts_path);
+ 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;
@@ -275,7 +275,7 @@ simple_insert(struct dircache_ctx *dc_ctx, const char *path)
printf("\t ID = %s\n", objid);
#endif
/* FIXME: path check is required */
- asprintf(&cache_path, "%s/%s", dc_path, entry->fts_path);
+ asprintf(&cache_path, "%s/%s", dc_path, dir_diff(entry->fts_path, dc_ctx->repo_rootpath));
if ((fp = fopen(cache_path, "w")) == NULL) {
free(cache_path);
return EXIT_FAILURE;
@@ -299,7 +299,6 @@ simple_insert(struct dircache_ctx *dc_ctx, const char *path)
if (mkdirp(dc_path, dir_diff(path, dc_ctx->repo_rootpath)) == EXIT_FAILURE)
return EXIT_FAILURE;
asprintf(&cache_path, "%s/%s", dc_path, dir_diff(path, dc_ctx->repo_rootpath));
- printf("now create %s\n", cache_path);
if ((fp = fopen(cache_path, "w")) == NULL) {
free(cache_path);
return EXIT_FAILURE;