You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This retrieves [co-authors](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors) from comment.
210
-
Each line will be associated with a Commit object and counted
211
-
to its co-author's "account".
212
-
Whether empty lines are counted is determined by the
213
-
count_empty_lines configuration option.
214
-
215
-
git log -1 <sha> will produce output like the following
216
-
for each line in a file:
217
-
218
-
When a commit does not contain co-authors:
219
-
commit ca8b32b24af1ce97fb29c5139b2f80e0c2ad9d1c
220
-
Author: John Doe <jdoe@john.com>
221
-
Date: Sun Dec 22 11:10:32 2019 +0100
222
-
223
-
add plugin skeleton
224
-
225
-
When a commit contains co-authors:
226
-
commit ca8b32b24af1ce97fb29c5139b2f80e0c2ad9d1c
227
-
Author: John Doe <jdoe@john.com>
228
-
Date: Sun Dec 22 11:10:32 2019 +0100
229
-
230
-
add plugin skeleton
231
-
232
-
Co-authored-by: John Doe <jdoe@john.com>
233
-
Co-authored-by: Rock Smith <rsmith@smith.com>
234
-
235
-
In this case we skip the original author as redundant using email address to detect it.
236
-
237
-
Args:
238
-
sha: the SHA of the commit to process
239
-
Returns:
240
-
--- (this method works through side effects)
241
-
"""
242
-
243
-
co_authors=self._get_git_log(sha, commit)
244
-
forco_authorinco_authors:
245
-
# Create the co-author
246
-
ifco_authornotinself._authors:
247
-
self._authors.append(co_author)
248
-
co_author.add_lines(self, commit)
249
-
250
-
def_get_git_log(self, sha, commit):
251
-
ifself._cached_logs.get(sha) isNone:
252
-
args= ["-1", sha]
253
-
cmd=GitCommand("log", args)
254
-
cmd.run()
255
-
256
-
lines=cmd.stdout()
257
-
258
-
# in case of empty, non-committed files, raise error
This retrieves [co-authors](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors) from comment.
128
+
Each line will be associated with a Commit object and counted
129
+
to its co-author's "account".
130
+
Whether empty lines are counted is determined by the
131
+
count_empty_lines configuration option.
132
+
133
+
git log -1 <sha> will produce output like the following
134
+
for each line in a file:
135
+
136
+
When a commit does not contain co-authors:
137
+
commit ca8b32b24af1ce97fb29c5139b2f80e0c2ad9d1c
138
+
Author: John Doe <jdoe@john.com>
139
+
Date: Sun Dec 22 11:10:32 2019 +0100
140
+
141
+
add plugin skeleton
142
+
143
+
When a commit contains co-authors:
144
+
commit ca8b32b24af1ce97fb29c5139b2f80e0c2ad9d1c
145
+
Author: John Doe <jdoe@john.com>
146
+
Date: Sun Dec 22 11:10:32 2019 +0100
147
+
148
+
add plugin skeleton
149
+
150
+
Co-authored-by: John Doe <jdoe@john.com>
151
+
Co-authored-by: Rock Smith <rsmith@smith.com>
152
+
153
+
In this case we skip the original author as redundant using email address to detect it.
154
+
155
+
Args:
156
+
sha: the SHA of the commit to process
157
+
author_email: email of the author
158
+
Returns:
159
+
List of co-authors excluding commit author
160
+
"""
161
+
args= ["-1", sha]
162
+
cmd=GitCommand("log", args)
163
+
cmd.run()
164
+
165
+
lines=cmd.stdout()
166
+
167
+
# in case of empty, non-committed files, raise error
168
+
iflen(lines) ==0:
169
+
raiseGitCommandError
170
+
co_authors= []
171
+
ignore_authors=self.config("ignore_authors")
172
+
173
+
forlineinlines:
174
+
ifline.startswith("Author: "):
175
+
# skip author as already available in Commit object
0 commit comments