Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

help: include <common-cmds.h> only in one file

This header not only declares but also defines the contents of the
array that holds the list of command names and help text.  Do not
include it in multiple places to waste text space.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information...
commit 1542d4cdad9287896fd80d84a4c2256197087308 1 parent e4f59a3
Junio C Hamano authored January 18, 2013

Showing 2 changed files with 17 additions and 18 deletions. Show diff stats Hide diff stats

  1. 18  builtin/help.c
  2. 17  help.c
18  builtin/help.c
@@ -6,7 +6,6 @@
6 6
 #include "cache.h"
7 7
 #include "builtin.h"
8 8
 #include "exec_cmd.h"
9  
-#include "common-cmds.h"
10 9
 #include "parse-options.h"
11 10
 #include "run-command.h"
12 11
 #include "column.h"
@@ -287,23 +286,6 @@ static int git_help_config(const char *var, const char *value, void *cb)
287 286
 
288 287
 static struct cmdnames main_cmds, other_cmds;
289 288
 
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  
-
307 289
 static int is_git_command(const char *s)
308 290
 {
309 291
 	return is_in_cmdlist(&main_cmds, s) ||
17  help.c
@@ -223,6 +223,23 @@ void list_commands(unsigned int colopts,
223 223
 	}
224 224
 }
225 225
 
  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
+
226 243
 int is_in_cmdlist(struct cmdnames *c, const char *s)
227 244
 {
228 245
 	int i;

0 notes on commit 1542d4c

Please sign in to comment.
Something went wrong with that request. Please try again.