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

Commitb47eedc

Browse files
mpapisjcouball
authored andcommitted
Improved error message of rev_parse
As described by git-rev-parse: Many Git porcelainish commands take mixture of flags (i.e. parameters that begin with a dash -) and parameters meant for the underlying git rev-list command they use internally and flags and parameters for the other commands they use downstream of git rev-list. This command is used to distinguish between them.Using the `--` to separate revisions from paths is at the core of git.I do not think this behavior will ever change.The message without the extra parameters: fatal: ambiguous argument 'v3': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]'The message with new parameters: fatal: bad revision 'NOTFOUND'I think it's way more descriptive.
1 parent9d44146 commitb47eedc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎lib/git/lib.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def full_log_commits(opts = {})
333333
defrev_parse(revision)
334334
assert_args_are_not_options('rev',revision)
335335

336-
command('rev-parse',revision)
336+
command('rev-parse','--revs-only','--end-of-options',revision,'--')
337337
end
338338

339339
# For backwards compatibility with the old method name

‎tests/units/test_lib.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def test_rev_parse_with_bad_revision
199199
end
200200

201201
deftest_rev_parse_with_unknown_revision
202-
assert_raise(Git::FailedError)do
202+
assert_raise_with_message(Git::FailedError,/exit 128, stderr: "fatal: bad revision 'NOTFOUND'"/)do
203203
@lib.rev_parse('NOTFOUND')
204204
end
205205
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp