summaryrefslogtreecommitdiff
path: root/src/attr.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-12-04 21:22:57 -0800
committerRussell Belfer <rb@github.com>2013-12-11 10:57:49 -0800
commitdab89f9b6821b67dd07c8bd4dbb53e25a3e687c7 (patch)
treec7f4f4738dfb249b7534635226128d2e20dac6a5 /src/attr.c
parent96869a4edb2872934e0e167a726ab240f4270fea (diff)
downloadlibgit2-dab89f9b6821b67dd07c8bd4dbb53e25a3e687c7.tar.gz
Further EUSER and error propagation fixes
This continues auditing all the places where GIT_EUSER is being returned and making sure to clear any existing error using the new giterr_user_cancel helper. As a result, places that relied on intercepting GIT_EUSER but having the old error preserved also needed to be cleaned up to correctly stash and then retrieve the actual error. Additionally, as I encountered places where error codes were not being propagated correctly, I tried to fix them up. A number of those fixes are included in the this commit as well.
Diffstat (limited to 'src/attr.c')
-rw-r--r--src/attr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/attr.c b/src/attr.c
index 2fccf21f8..1a0f1f97f 100644
--- a/src/attr.c
+++ b/src/attr.c
@@ -480,6 +480,7 @@ typedef struct {
const char *workdir;
git_index *index;
git_vector *files;
+ git_error_state error;
} attr_walk_up_info;
int git_attr_cache__decide_sources(
@@ -523,7 +524,7 @@ static int push_one_attr(void *ref, git_buf *path)
info->repo, path->ptr, GIT_ATTR_FILE, src[i],
git_attr_file__parse_buffer, NULL, info->files);
- return error;
+ return giterr_capture(&info->error, error);
}
static int collect_attr_files(
@@ -535,7 +536,7 @@ static int collect_attr_files(
int error;
git_buf dir = GIT_BUF_INIT;
const char *workdir = git_repository_workdir(repo);
- attr_walk_up_info info;
+ attr_walk_up_info info = { NULL };
if (git_attr_cache__init(repo) < 0 ||
git_vector_init(files, 4, NULL) < 0)
@@ -569,6 +570,8 @@ static int collect_attr_files(
info.files = files;
error = git_path_walk_up(&dir, workdir, push_one_attr, &info);
+ if (error == GIT_EUSER)
+ error = giterr_restore(&info.error);
if (error < 0)
goto cleanup;