Skip to content

Commit 16fae6e

Browse files
committed
Index.add raise TypeError on unexpected type
Instead of AttributeError
1 parent 2fc423c commit 16fae6e

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
1.5.0 (UNRELEASED)
2+
-------------------------
3+
4+
- Fix truncated diff when there are nulls
5+
`#1047 <https://github.com/libgit2/pygit2/pull/1047>`_
6+
`#1043 <https://github.com/libgit2/pygit2/issues/1043>`_
7+
8+
Breaking changes:
9+
10+
- Fix ``Index.add(...)`` raise ``TypeError`` instead of ``AttributeError`` when
11+
arguments are of unexpected type
12+
13+
114
1.4.0 (2020-11-06)
215
-------------------------
316

docs/recipes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
**********************************************************************
2-
pygit2 Recipes
2+
Recipes
33
**********************************************************************
44

55
A list of some standard git commands and their pygit2 equivalents. This

pygit2/index.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ def add(self, path_or_entry):
199199
If an IndexEntry is given, that entry will be added or update in the
200200
Index without checking for the existence of the path or id.
201201
"""
202-
203202
if isinstance(path_or_entry, IndexEntry):
204203
entry = path_or_entry
205204
centry, str_ref = entry._to_c()
@@ -208,7 +207,7 @@ def add(self, path_or_entry):
208207
path = path_or_entry
209208
err = C.git_index_add_bypath(self._index, to_bytes(path))
210209
else:
211-
raise AttributeError('argument must be string or IndexEntry')
210+
raise TypeError('argument must be string or IndexEntry')
212211

213212
check_error(err, io=True)
214213

0 commit comments

Comments
 (0)