Correctly avoid parsing ShaFiles with fixed SHAs when calling sha().
[jelmer/dulwich-libgit2.git] / dulwich / _objects.c
index fef82e78f791f35f5cbc9feecab8eea7584d7715..d9699ec6cb4a72e52873929f679048e32d176819 100644 (file)
@@ -60,7 +60,7 @@ static PyObject *py_parse_tree(PyObject *self, PyObject *args)
                mode = strtol(text, &text, 8);
 
                if (*text != ' ') {
-                       PyErr_SetString(PyExc_RuntimeError, "Expected space");
+                       PyErr_SetString(PyExc_ValueError, "Expected space");
                        Py_DECREF(ret);
                        return NULL;
                }
@@ -76,7 +76,7 @@ static PyObject *py_parse_tree(PyObject *self, PyObject *args)
                }
 
                if (text + namelen + 20 >= end) {
-                       PyErr_SetString(PyExc_RuntimeError, "SHA truncated");
+                       PyErr_SetString(PyExc_ValueError, "SHA truncated");
                        Py_DECREF(ret);
                        Py_DECREF(name);
                        return NULL;