-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(git-authors)!: no longer to support open the editor
* BREAKING CHANGE: remove behavior of opening authors with the default editor * test: add unit test
- Loading branch information
Showing
6 changed files
with
96 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,59 @@ | ||
.\" generated with Ronn/v0.7.3 | ||
.\" http://github.com/rtomayko/ronn/tree/0.7.3 | ||
. | ||
.TH "GIT\-AUTHORS" "1" "October 2017" "" "Git Extras" | ||
. | ||
.\" generated with Ronn-NG/v0.9.1 | ||
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1 | ||
.TH "GIT\-AUTHORS" "1" "November 2023" "" "Git Extras" | ||
.SH "NAME" | ||
\fBgit\-authors\fR \- Generate authors report | ||
. | ||
.SH "SYNOPSIS" | ||
\fBgit\-authors\fR [\-l, \-\-list] [\-\-no\-email] | ||
. | ||
.SH "DESCRIPTION" | ||
Populates the file matching \fIauthors|contributors \-i\fR with the authors of commits, according to the number of commits per author\. Opens the file in \fB$EDITOR\fR when set\. | ||
. | ||
.TS | ||
allbox; | ||
Populates the file matching _authors contributors \-i_ with the authors of commits, according to the number of commits per author\. | ||
.TE | ||
.P | ||
See the "MAPPING AUTHORS" section of \fBgit\-shortlog\fR(1) to coalesce together commits by the same person\. | ||
. | ||
.SH "OPTIONS" | ||
\-l, \-\-list | ||
. | ||
.P | ||
Show authors\. | ||
. | ||
.P | ||
\-\-no\-email | ||
. | ||
.P | ||
Don\'t show authors\' email\. | ||
. | ||
.SH "EXAMPLES" | ||
. | ||
.TP | ||
Updating AUTHORS file: | ||
. | ||
.IP | ||
.IP "" 4 | ||
.nf | ||
$ git authors | ||
. | ||
.TP | ||
.fi | ||
.IP "" 0 | ||
.P | ||
Listing authors: | ||
. | ||
.IP | ||
$ git authors \-\-list | ||
. | ||
.IP "" 4 | ||
. | ||
.nf | ||
|
||
$ git authors \-\-list | ||
TJ Holowaychuk <tj@vision\-media\.ca> | ||
hemanth\.hm <hemanth\.hm@gmail\.com> | ||
Jonhnny Weslley <jw@jonhnnyweslley\.net> | ||
nickl\- <github@jigsoft\.co\.za> | ||
Leila Muhtasib <muhtasib@gmail\.com> | ||
. | ||
.fi | ||
. | ||
.IP "" 0 | ||
|
||
. | ||
.TP | ||
.P | ||
Listing authors without email: | ||
. | ||
.IP | ||
$ git authors \-\-list \-\-no\-email | ||
. | ||
.IP "" 4 | ||
. | ||
.nf | ||
|
||
$ git authors \-\-list \-\-no\-email | ||
TJ Holowaychuk | ||
hemanth\.hm | ||
Jonhnny Weslley | ||
nickl\- | ||
Leila Muhtasib | ||
. | ||
.fi | ||
. | ||
.IP "" 0 | ||
|
||
. | ||
.SH "AUTHOR" | ||
Written by Titus Wormer <\fItituswormer@gmail\.com\fR> | ||
. | ||
.SH "REPORTING BUGS" | ||
<\fIhttps://github\.com/tj/git\-extras/issues\fR> | ||
. | ||
.SH "SEE ALSO" | ||
<\fIhttps://github\.com/tj/git\-extras\fR> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ git-authors(1) -- Generate authors report | |
## DESCRIPTION | ||
|
||
Populates the file matching _authors|contributors -i_ with the authors of commits, according to the number of commits per author. | ||
Opens the file in **$EDITOR** when set. | ||
|
||
See the "MAPPING AUTHORS" section of **git-shortlog**(1) to coalesce together commits by the same person. | ||
|
||
|
@@ -24,33 +23,27 @@ git-authors(1) -- Generate authors report | |
|
||
## EXAMPLES | ||
|
||
* Updating AUTHORS file: | ||
Updating AUTHORS file: | ||
|
||
$ git authors | ||
|
||
* Listing authors: | ||
Listing authors: | ||
|
||
$ git authors --list | ||
|
||
``` | ||
TJ Holowaychuk <[email protected]> | ||
hemanth.hm <[email protected]> | ||
Jonhnny Weslley <[email protected]> | ||
nickl- <[email protected]> | ||
Leila Muhtasib <[email protected]> | ||
``` | ||
|
||
* Listing authors without email: | ||
Listing authors without email: | ||
|
||
$ git authors --list --no-email | ||
``` | ||
TJ Holowaychuk | ||
hemanth.hm | ||
Jonhnny Weslley | ||
nickl- | ||
Leila Muhtasib | ||
``` | ||
|
||
## AUTHOR | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import os, subprocess | ||
|
||
expected_authors_list = "test <[email protected]>\ntestagain <[email protected]>\n" | ||
expected_authors_list_without_email = "test\ntestagain\n" | ||
authors_file = "AUTHORS" | ||
|
||
class TestGitAuthors: | ||
def test_init(self, temp_repo): | ||
git = temp_repo.get_repo_git() | ||
tmp_file = temp_repo.get_file(0) | ||
temp_repo.writefile(tmp_file, "A") | ||
git.add(".") | ||
git.commit("-m", "test: add data A") | ||
git.config("--local", "user.name", "testagain") | ||
git.config("--local", "user.email", "[email protected]") | ||
temp_repo.writefile(tmp_file, "B") | ||
git.add(".") | ||
git.commit("-m", "test: add data B") | ||
|
||
def test_output_authors_has_email_without_any_parameter(self, temp_repo): | ||
git = temp_repo.get_repo_git() | ||
rs = temp_repo.invoke_extras_command("authors") | ||
with open(authors_file) as f: | ||
content = f.read() | ||
print(content) | ||
print(expected_authors_list) | ||
assert content == expected_authors_list | ||
|
||
def test_list_authors_has_email_defaultly(self, temp_repo): | ||
git = temp_repo.get_repo_git() | ||
actual = temp_repo.invoke_extras_command("authors", "--list") | ||
actual = actual.stdout.decode() | ||
assert actual == expected_authors_list | ||
actual = temp_repo.invoke_extras_command("authors", "-l") | ||
actual = actual.stdout.decode() | ||
assert actual == expected_authors_list | ||
|
||
def test_list_authors_has_not_email(self, temp_repo): | ||
git = temp_repo.get_repo_git() | ||
actual = temp_repo.invoke_extras_command("authors", "--list", "--no-email") | ||
actual = actual.stdout.decode() | ||
assert actual == expected_authors_list_without_email | ||
actual = temp_repo.invoke_extras_command("authors", "-l", "--no-email") | ||
actual = actual.stdout.decode() | ||
assert actual == expected_authors_list_without_email |