summaryrefslogtreecommitdiff
path: root/src/status.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-01-08 13:45:06 -0800
committerRussell Belfer <rb@github.com>2013-01-15 09:49:32 -0800
commit5c8bb98ce9c4e5bb6527c8ffc274c8b3e0755fa7 (patch)
tree2d5daba28b0743a2e112de7e8181b590fa252ee9 /src/status.c
parent4b181037553601a0747ad39ccdd85ebd3b184055 (diff)
downloadlibgit2-5c8bb98ce9c4e5bb6527c8ffc274c8b3e0755fa7.tar.gz
Fix err msg for ambiguous path in git_status_file
Returning GIT_EAMBIGUOUS from inside the status callback gets overridden with GIT_EUSER. `git_status_file` accounted for this via the callback payload, but was allowing the error message to be cleared. Move the `giterr_set` call outside the callback to where the EUSER case was being dealt with.
Diffstat (limited to 'src/status.c')
-rw-r--r--src/status.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/status.c b/src/status.c
index 777d8502b..5b89e8c0d 100644
--- a/src/status.c
+++ b/src/status.c
@@ -208,9 +208,8 @@ static int get_one_status(const char *path, unsigned int status, void *data)
if (sfi->count > 1 ||
(strcmp(sfi->expected, path) != 0 &&
- p_fnmatch(sfi->expected, path, 0) != 0)) {
- giterr_set(GITERR_INVALID,
- "Ambiguous path '%s' given to git_status_file", sfi->expected);
+ p_fnmatch(sfi->expected, path, 0) != 0))
+ {
sfi->ambiguous = true;
return GIT_EAMBIGUOUS;
}
@@ -242,8 +241,11 @@ int git_status_file(
error = git_status_foreach_ext(repo, &opts, get_one_status, &sfi);
- if (error < 0 && sfi.ambiguous)
+ if (error < 0 && sfi.ambiguous) {
+ giterr_set(GITERR_INVALID,
+ "Ambiguous path '%s' given to git_status_file", sfi.expected);
error = GIT_EAMBIGUOUS;
+ }
if (!error && !sfi.count) {
git_buf full = GIT_BUF_INIT;