Skip to content

Commit d959a78

Browse files
committed
Merge branch 'jc/help'
A header file that has the definition of a static array was included in two places, wasting the space. * jc/help: help: include <common-cmds.h> only in one file
2 parents 38f7636 + 1542d4c commit d959a78

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

builtin/help.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "cache.h"
77
#include "builtin.h"
88
#include "exec_cmd.h"
9-
#include "common-cmds.h"
109
#include "parse-options.h"
1110
#include "run-command.h"
1211
#include "column.h"
@@ -287,23 +286,6 @@ static int git_help_config(const char *var, const char *value, void *cb)
287286

288287
static struct cmdnames main_cmds, other_cmds;
289288

290-
void list_common_cmds_help(void)
291-
{
292-
int i, longest = 0;
293-
294-
for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
295-
if (longest < strlen(common_cmds[i].name))
296-
longest = strlen(common_cmds[i].name);
297-
}
298-
299-
puts(_("The most commonly used git commands are:"));
300-
for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
301-
printf(" %s ", common_cmds[i].name);
302-
mput_char(' ', longest - strlen(common_cmds[i].name));
303-
puts(_(common_cmds[i].help));
304-
}
305-
}
306-
307289
static int is_git_command(const char *s)
308290
{
309291
return is_in_cmdlist(&main_cmds, s) ||

help.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,23 @@ void list_commands(unsigned int colopts,
223223
}
224224
}
225225

226+
void list_common_cmds_help(void)
227+
{
228+
int i, longest = 0;
229+
230+
for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
231+
if (longest < strlen(common_cmds[i].name))
232+
longest = strlen(common_cmds[i].name);
233+
}
234+
235+
puts(_("The most commonly used git commands are:"));
236+
for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
237+
printf(" %s ", common_cmds[i].name);
238+
mput_char(' ', longest - strlen(common_cmds[i].name));
239+
puts(_(common_cmds[i].help));
240+
}
241+
}
242+
226243
int is_in_cmdlist(struct cmdnames *c, const char *s)
227244
{
228245
int i;

0 commit comments

Comments
 (0)