Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd759e17

Browse files
MarcelBeiningByron
authored andcommitted
As string is iterable, changed to isinstance check
test now works
1 parent1fa1ce2 commitd759e17

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ nbproject
1515
/*egg-info
1616
/.tox
1717
/.vscode/
18+
.idea/
19+
.cache/

‎.gitmodules‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "gitdb"]
2-
url=https://github.com/gitpython-developers/gitdb.git
3-
path=git/ext/gitdb
1+
[submodule "gitdb"]
2+
url=https://github.com/gitpython-developers/gitdb.git
3+
path=git/ext/gitdb

‎git/index/base.py‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,8 @@ def _preprocess_add_items(self, items):
569569
""" Split the items into two lists of path strings and BaseEntries. """
570570
paths= []
571571
entries= []
572-
# check if is iterable, else put in list
573-
try:
574-
test_item=iter(items)
575-
exceptTypeError:
572+
# if it is a string put in list
573+
ifisinstance(items,str):
576574
items= [items]
577575

578576
foriteminitems:
@@ -806,10 +804,8 @@ def _items_to_rela_paths(self, items):
806804
"""Returns a list of repo-relative paths from the given items which
807805
may be absolute or relative paths, entries or blobs"""
808806
paths= []
809-
# check if is iterable, else put in list
810-
try:
811-
test_item=iter(items)
812-
exceptTypeError:
807+
# if string put in list
808+
ifisinstance(items,str):
813809
items= [items]
814810

815811
foriteminitems:

‎git/test/test_index.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,9 +775,11 @@ def test_compare_write_tree(self, rw_repo):
775775

776776
@with_rw_repo('HEAD',bare=False)
777777
deftest_index_single_addremove(self,rw_repo):
778-
path=osp.join('git','test','test_index.py')
779-
self._assert_entries(rw_repo.index.add(path))
780-
deleted_files=rw_repo.index.remove(path)
778+
fp=osp.join(rw_repo.working_dir,'testfile.txt')
779+
withopen(fp,'w')asfs:
780+
fs.write(u'content of testfile')
781+
self._assert_entries(rw_repo.index.add(fp))
782+
deleted_files=rw_repo.index.remove(fp)
781783
assertdeleted_files
782784

783785
deftest_index_new(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp