git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: "Torsten Bögershausen" <tboegi@web.de>,
	"Jean-Noël AVILA" <avila.jn@gmail.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"Jeff King" <peff@peff.net>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Felipe Contreras" <felipe.contreras@gmail.com>
Subject: [PATCH 1/2] help: include <common-cmds.h> only in one file
Date: Sat, 19 Jan 2013 00:00:31 -0800	[thread overview]
Message-ID: <7vpq11ob4w.fsf_-_@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7vwqv9obie.fsf_-_@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Fri, 18 Jan 2013 23:52:25 -0800")

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>
---

 * This is a real "cleanup" patch.

 builtin/help.c | 18 ------------------
 help.c         | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/builtin/help.c b/builtin/help.c
index bd86253..6067a61 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -6,7 +6,6 @@
 #include "cache.h"
 #include "builtin.h"
 #include "exec_cmd.h"
-#include "common-cmds.h"
 #include "parse-options.h"
 #include "run-command.h"
 #include "column.h"
@@ -287,23 +286,6 @@ static int git_help_config(const char *var, const char *value, void *cb)
 
 static struct cmdnames main_cmds, other_cmds;
 
-void list_common_cmds_help(void)
-{
-	int i, longest = 0;
-
-	for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
-		if (longest < strlen(common_cmds[i].name))
-			longest = strlen(common_cmds[i].name);
-	}
-
-	puts(_("The most commonly used git commands are:"));
-	for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
-		printf("   %s   ", common_cmds[i].name);
-		mput_char(' ', longest - strlen(common_cmds[i].name));
-		puts(_(common_cmds[i].help));
-	}
-}
-
 static int is_git_command(const char *s)
 {
 	return is_in_cmdlist(&main_cmds, s) ||
diff --git a/help.c b/help.c
index 2a42ec6..1dfa0b0 100644
--- a/help.c
+++ b/help.c
@@ -223,6 +223,23 @@ void list_commands(unsigned int colopts,
 	}
 }
 
+void list_common_cmds_help(void)
+{
+	int i, longest = 0;
+
+	for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
+		if (longest < strlen(common_cmds[i].name))
+			longest = strlen(common_cmds[i].name);
+	}
+
+	puts(_("The most commonly used git commands are:"));
+	for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
+		printf("   %s   ", common_cmds[i].name);
+		mput_char(' ', longest - strlen(common_cmds[i].name));
+		puts(_(common_cmds[i].help));
+	}
+}
+
 int is_in_cmdlist(struct cmdnames *c, const char *s)
 {
 	int i;
-- 
1.8.1.1.454.g48d39c0

  reply	other threads:[~2013-01-19  8:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 13:35 [PATCH] attr: fix off-by-one directory component length calculation Nguyễn Thái Ngọc Duy
2013-01-15 16:17 ` Junio C Hamano
2013-01-15 19:14 ` Jean-Noël AVILA
2013-01-15 19:29   ` Junio C Hamano
2013-01-15 19:53     ` Jean-Noël AVILA
2013-01-15 20:49       ` Junio C Hamano
2013-01-15 23:24         ` Jeff King
2013-01-16  6:15           ` t9902 fails (Was: [PATCH] attr: fix off-by-one directory component length calculation) Torsten Bögershausen
2013-01-17 22:47             ` Jean-Noël AVILA
2013-01-18  0:04               ` Jonathan Nieder
2013-01-18  0:12                 ` t9902 fails Junio C Hamano
2013-01-18  5:20                 ` t9902 fails (Was: [PATCH] attr: fix off-by-one directory component length calculation) Torsten Bögershausen
2013-01-18 16:49                 ` t9902 fails Junio C Hamano
2013-01-18 20:15                   ` Junio C Hamano
2013-01-18 22:23                     ` Jean-Noël AVILA
2013-01-18 22:37                       ` Junio C Hamano
2013-01-18 22:57                         ` Junio C Hamano
2013-01-19  5:38                       ` Torsten Bögershausen
2013-01-19  7:52                         ` Re* " Junio C Hamano
2013-01-19  8:00                           ` Junio C Hamano [this message]
2013-01-19  8:02                             ` [PATCH 2/2] help --standard: list standard commands Junio C Hamano
2013-01-19 10:32                               ` Jean-Noël AVILA
2013-01-19 13:43                           ` Re* t9902 fails Jean-Noël AVILA
2013-01-19 10:23                         ` Jean-Noël AVILA
2013-01-16  1:08     ` [PATCH] attr: fix off-by-one directory component length calculation Duy Nguyen
2013-01-16  2:09       ` Duy Nguyen
2013-01-16  2:33         ` Junio C Hamano
2013-01-16  3:12           ` Duy Nguyen
2013-01-16  5:35             ` Junio C Hamano
2013-01-16  6:02               ` Duy Nguyen
2013-01-16 19:07                 ` Junio C Hamano
2013-01-16  1:03   ` Duy Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vpq11ob4w.fsf_-_@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=avila.jn@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).