Commit 83458bb77ff8dd82411924c7fd376dc338c8bd18

nulltoken 2012-11-12T14:06:13

refs: Fix error clearing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/refs.c b/src/refs.c
index 76c9f42..61a515c 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1962,8 +1962,12 @@ int git_reference__is_valid_name(
 	const char *refname,
 	unsigned int flags)
 {
+	int error;
+
+	error = git_reference__normalize_name(NULL, refname, flags) == 0;
 	giterr_clear();
-	return git_reference__normalize_name(NULL, refname, flags) == 0;
+
+	return error;
 }
 
 int git_reference_is_valid_name(