Skip to content

Commit a2ec3ad

Browse files
artagnongitster
authored andcommitted
revert: Don't check lone argument in get_encoding
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 <[email protected]> Mentored-by: Jonathan Nieder <[email protected]> Signed-off-by: Ramkumar Ramachandra <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent be33c46 commit a2ec3ad

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

builtin/revert.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,6 @@ static char *get_encoding(const char *message)
167167
{
168168
const char *p = message, *eol;
169169

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

0 commit comments

Comments
 (0)