From dab89f9b6821b67dd07c8bd4dbb53e25a3e687c7 Mon Sep 17 00:00:00 2001 From: Russell Belfer Date: Wed, 4 Dec 2013 21:22:57 -0800 Subject: 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. --- src/index.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/index.c') diff --git a/src/index.c b/src/index.c index 09e7b2346..d0d2cf187 100644 --- a/src/index.c +++ b/src/index.c @@ -2036,6 +2036,12 @@ int git_index_read_tree(git_index *index, const git_tree *tree) error = git_tree_walk(tree, GIT_TREEWALK_POST, read_tree_cb, &data); + if (error == GIT_EUSER) { + giterr_set_oom(); + git_vector_free(&entries); + return -1; + } + git_vector_sort(&entries); git_index_clear(index); @@ -2116,8 +2122,7 @@ int git_index_add_all( if (error > 0) /* return > 0 means skip this one */ continue; if (error < 0) { /* return < 0 means abort */ - giterr_clear(); - error = GIT_EUSER; + error = giterr_user_cancel(); break; } } @@ -2205,8 +2210,7 @@ static int index_apply_to_all( continue; } if (error < 0) { /* return < 0 means abort */ - giterr_clear(); - error = GIT_EUSER; + error = giterr_user_cancel(); break; } } -- cgit v1.2.1