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

Commit50f763c

Browse files
committed
Store path attribute on Diff object
If a file in a commit contains no changes (for example, if only thefile mode is changed) there will be no blob attached. This isusually where the filename is stored, so without it, the callingcontext can not tell what file was changed. Instead, alwaysstore a_path and b_path on the Diff object so that informationis available.
1 parenta5e607e commit50f763c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

‎git/diff.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,13 @@ class Diff(object):
168168
169169
a_mode is None
170170
a_blob is None
171+
a_path is None
171172
172173
``Deleted File``::
173174
174175
b_mode is None
175176
b_blob is None
177+
b_path is None
176178
177179
``Working Tree Blobs``
178180
@@ -200,8 +202,8 @@ class Diff(object):
200202
NULL_HEX_SHA="0"*40
201203
NULL_BIN_SHA=b"\0"*20
202204

203-
__slots__= ("a_blob","b_blob","a_mode","b_mode","new_file","deleted_file",
204-
"rename_from","rename_to","diff")
205+
__slots__= ("a_blob","b_blob","a_mode","b_mode","a_path","b_path",
206+
"new_file","deleted_file","rename_from","rename_to","diff")
205207

206208
def__init__(self,repo,a_path,b_path,a_blob_id,b_blob_id,a_mode,
207209
b_mode,new_file,deleted_file,rename_from,
@@ -210,6 +212,9 @@ def __init__(self, repo, a_path, b_path, a_blob_id, b_blob_id, a_mode,
210212
self.a_mode=a_mode
211213
self.b_mode=b_mode
212214

215+
self.a_path=a_path
216+
self.b_path=b_path
217+
213218
ifself.a_mode:
214219
self.a_mode=mode_str_to_int(self.a_mode)
215220
ifself.b_mode:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp