[PATCH] help.c: Pull cmd_version out of this file.

Subsystems: kernel build + files below scripts/ (unless maintained elsewhere), the rest

STALE3736d

6 messages, 3 authors, 2016-06-15 · open the first message on its own page

[PATCH] help.c: Pull cmd_version out of this file.

From: Thiago Farina <hidden>
Date: 2016-06-15 22:49:24

Promote cmd_version to a builtin, by moving it to its own file
in builtin/version.c

Signed-off-by: Thiago Farina <redacted>
---
 Makefile          |    1 +
 builtin/version.c |    7 +++++++
 help.c            |    6 ------
 3 files changed, 8 insertions(+), 6 deletions(-)
 create mode 100644 builtin/version.c
diff --git a/Makefile b/Makefile
index b4745a5..0f3b6d8 100644
--- a/Makefile
+++ b/Makefile
@@ -738,6 +738,7 @@ BUILTIN_OBJS += builtin/upload-archive.o
 BUILTIN_OBJS += builtin/var.o
 BUILTIN_OBJS += builtin/verify-pack.o
 BUILTIN_OBJS += builtin/verify-tag.o
+BUILTIN_OBJS += builtin/version.o
 BUILTIN_OBJS += builtin/write-tree.o
 
 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
diff --git a/builtin/version.c b/builtin/version.c
new file mode 100644
index 0000000..d98e260
--- /dev/null
+++ b/builtin/version.c
@@ -0,0 +1,7 @@
+#include "builtin.h"
+
+int cmd_version(int argc, const char **argv, const char *prefix)
+{
+	printf("git version %s\n", git_version_string);
+	return 0;
+}
diff --git a/help.c b/help.c
index 7f4928e..ad4f923 100644
--- a/help.c
+++ b/help.c
@@ -362,9 +362,3 @@ const char *help_unknown_cmd(const char *cmd)
 
 	exit(1);
 }
-
-int cmd_version(int argc, const char **argv, const char *prefix)
-{
-	printf("git version %s\n", git_version_string);
-	return 0;
-}
-- 
1.7.2.1.95.g3d045

Re: [PATCH] help.c: Pull cmd_version out of this file.

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:49:24

Thiago Farina wrote:
Promote cmd_version to a builtin, by moving it to its own file
in builtin/version.c
Could you explain further?  If the goal is "one command per source
file", then we already violate that in a number of places:

 - "git blame" and "git pickaxe" are both cmd_blame() in
   builtin/blame.c.

 - "git whatchanged", "git show", "git reflog", and "git log" are
   separate builtins in builtin/log.c.

 - etc

What does this make easier?

Re: [PATCH] help.c: Pull cmd_version out of this file.

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:49:24

Jonathan Nieder wrote:
Thiago Farina wrote:
quoted
Promote cmd_version to a builtin, by moving it to its own file
in builtin/version.c
[...]
What does this make easier?
To answer my own question: it moves the code to the builtin/
subdirectory.

 $ git grep -F -e cmd_version -- builtin;	# before
 $ git grep -F -e cmd_version -- builtin;	# after
 builtin/version.c:int cmd_version(int argc, const char **argv, const char *prefix)

So for what it's worth,

Acked-by: Jonathan Nieder <redacted>

Re: [PATCH] help.c: Pull cmd_version out of this file.

From: Thiago Farina <hidden>
Date: 2016-06-15 22:49:27

On Sun, Aug 29, 2010 at 11:40 PM, Jonathan Nieder [off-list ref] wrote:
Jonathan Nieder wrote:
quoted
Thiago Farina wrote:
quoted
Promote cmd_version to a builtin, by moving it to its own file
in builtin/version.c
[...]
So for what it's worth,

Acked-by: Jonathan Nieder <redacted>
Ping Junio.

Re: [PATCH] help.c: Pull cmd_version out of this file.

From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:49:27

On Wed, Sep 1, 2010 at 12:38 PM, Thiago Farina [off-list ref] wrote:
On Sun, Aug 29, 2010 at 11:40 PM, Jonathan Nieder [off-list ref] wrote:
quoted
Jonathan Nieder wrote:
quoted
Thiago Farina wrote:
quoted
Promote cmd_version to a builtin, by moving it to its own file
in builtin/version.c
[...]
So for what it's worth,

Acked-by: Jonathan Nieder <redacted>
Ping Junio.
Not my call, but should you also update .gitignore to ignore git-version?
-- 
Duy

Re: [PATCH] help.c: Pull cmd_version out of this file.

From: Thiago Farina <hidden>
Date: 2016-06-15 22:49:27

On Wed, Sep 1, 2010 at 12:04 AM, Nguyen Thai Ngoc Duy [off-list ref] wrote:
Not my call, but should you also update .gitignore to ignore git-version?
Thanks for the catch, fixed in patchset v2.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help