From a2b4407dc3d4e1ecc5b908c3fff56dc207c7c4e6 Mon Sep 17 00:00:00 2001 From: The rugged tests are fragile Date: Wed, 17 Sep 2014 15:23:17 +0200 Subject: [PATCH] attr: Do not walk path if we're at the root --- src/attr.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/attr.c b/src/attr.c index fd0ab9274..e4bd5f669 100644 --- a/src/attr.c +++ b/src/attr.c @@ -422,10 +422,8 @@ static int collect_attr_files( /* Resolve path in a non-bare repo */ if (workdir != NULL) error = git_path_find_dir(&dir, path, workdir); - /* when in a bare repo, find the containing folder if the given - * path is a subfolder (if not, the containing folder is the root) */ - else if (strchr(path, '/') != NULL) - error = git_path_dirname_r(&dir, path); + else + error = git_path_dirname_r(&dir, path); if (error < 0) goto cleanup; @@ -449,7 +447,12 @@ static int collect_attr_files( giterr_clear(); /* no error even if there is no index */ info.files = files; - error = git_path_walk_up(&dir, workdir, push_one_attr, &info); + if (!strcmp(dir.ptr, ".")) { + error = push_one_attr(&info, ""); + } else { + error = git_path_walk_up(&dir, workdir, push_one_attr, &info); + } + if (error < 0) goto cleanup;