Skip to content

Commit

Permalink
revert: Don't check lone argument in get_encoding
Browse files Browse the repository at this point in the history
The only place get_encoding uses the global "commit" variable is when
writing an error message explaining that its lone argument was NULL.
Since the function's only caller ensures that a NULL argument isn't
passed, we can remove this check with two beneficial consequences:

1. Since the function doesn't use the global "commit" variable any
   more, it won't need to change when we eliminate the global variable
   later in the series.
2. Translators no longer need to localize an error message that will
   never be shown.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Mentored-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ramkumar Ramachandra authored and Junio C Hamano committed Aug 4, 2011
1 parent be33c46 commit a2ec3ad
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions builtin/revert.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,6 @@ static char *get_encoding(const char *message)
{
const char *p = message, *eol;

if (!p)
die (_("Could not read commit message of %s"),
sha1_to_hex(commit->object.sha1));
while (*p && *p != '\n') {
for (eol = p + 1; *eol && *eol != '\n'; eol++)
; /* do nothing */
Expand Down

0 comments on commit a2ec3ad

Please sign in to comment.