Skip to content

Commit ee0e2cb

Browse files
committed
commit: mention -e as nice option
Even though just passing `-e` works (as it is just passed to git), many users don't know the existence of this option, so now I publish it in help. Closes: https://bugs.gentoo.org/846785 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent 729947a commit ee0e2cb

5 files changed

Lines changed: 16 additions & 1 deletion

File tree

completion/bash/pkgdev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ _pkgdev() {
7575
--signoff
7676
-m --message
7777
-M --message-template
78+
-e --edit
7879
-u --update
7980
-a --all
8081
"

completion/zsh/_pkgdev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ case $state in
5050
'--signoff[add a Signed-off-by trailer]' \
5151
\*{--message,-m}'[specify commit message]:message' \
5252
{'(--message-template)-M','(-M)--message-template'}'[use commit message template from specified file]:template:_files' \
53+
{'(--edit)-e','(-e)--edit'}'[force edit of commit]' \
5354
{'(--update)-u','(-u)--update'}'[stage all changed files]' \
5455
{'(--all)-a','(-a)--all'}'[stage all changed/new/removed files]' \
5556
&& ret=0

doc/man/pkgdev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/arthur/src/pkgcore/pkgdev/doc/generated/pkgdev

src/pkgdev/scripts/pkgdev_commit.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def parse_known_args(self, args=None, namespace=None):
4545
args.append('-v')
4646
if namespace.signoff:
4747
args.append('--signoff')
48+
if namespace.edit:
49+
args.append('--edit')
4850
namespace.commit_args = args
4951
return namespace, []
5052

@@ -161,6 +163,14 @@ def __call__(self, parser, namespace, value, option_string=None):
161163
""")
162164
msg_actions.add_argument('-F', '--file', help=argparse.SUPPRESS)
163165
msg_actions.add_argument('-t', '--template', help=argparse.SUPPRESS)
166+
msg_actions.add_argument(
167+
'-e', '--edit', action='store_true',
168+
help='force edit of commit',
169+
docs="""
170+
The message taken from command line with -m, and from automatically
171+
generated one are usually used as the commit log message unmodified.
172+
This option lets you further edit the message taken from these sources.
173+
""")
164174

165175
add_actions = commit_opts.add_mutually_exclusive_group()
166176
add_actions.add_argument(

tests/scripts/test_pkgdev_commit.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ def test_git_commit_args(self, repo, make_git_repo, tool):
8484
('--dry-run', '--dry-run'),
8585
('-v', '-v'),
8686
('--verbose', '-v'),
87+
('-e', '--edit'),
88+
('--edit', '--edit'),
8789
):
8890
options, _ = tool.parse_args(['commit', opt])
8991
assert expected in options.commit_args
@@ -94,7 +96,7 @@ def test_git_commit_args_passthrough(self, repo, make_git_repo, tool):
9496
repo.create_ebuild('cat/pkg-0')
9597
git_repo.add_all('cat/pkg-0', commit=False)
9698
with chdir(repo.location):
97-
for opt in ('--author="A U Thor <author@example.com>"', '-e'):
99+
for opt in ('--author="A U Thor <author@example.com>"', '-p'):
98100
options, _ = tool.parse_args(['commit', opt])
99101
assert options.commit_args == [opt]
100102

0 commit comments

Comments
 (0)