[PATCH 2/3] add config-mak git command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This records the contents of your config.mak at build time
and prints them later.

Signed-off-by: Sverre Rabbelier <srabbelier@xxxxxxxxx>
Signed-off-by: Sam Vilain <sam@xxxxxxxxxx>
Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
Signed-off-by: Nick Edelen <sirnot@xxxxxxxxx>
Signed-off-by: "J.H." <warthog9@xxxxxxxxxx>
Signed-off-by: Brandon Casey <drafnel@xxxxxxxxx>
Signed-off-by: Jeff King <peff@xxxxxxxx>
---
 .gitignore |    1 +
 Makefile   |    8 ++++++++
 builtin.h  |    1 +
 git.c      |    1 +
 help.c     |    7 +++++++
 5 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 1e547e7..cf0d8b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -191,3 +191,4 @@ cscope*
 Debug/
 Release/
 git-splash
+config-mak.c
diff --git a/Makefile b/Makefile
index 36e1a61..ae4b9fc 100644
--- a/Makefile
+++ b/Makefile
@@ -480,6 +480,7 @@ LIB_OBJS += color.o
 LIB_OBJS += combine-diff.o
 LIB_OBJS += commit.o
 LIB_OBJS += config.o
+LIB_OBJS += config-mak.o
 LIB_OBJS += connect.o
 LIB_OBJS += convert.o
 LIB_OBJS += copy.o
@@ -1931,6 +1932,13 @@ coverage-clean:
 COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
 COVERAGE_LDFLAGS = $(CFLAGS)  -O0 -lgcov
 
+config-mak.c: config.mak
+	(echo 'const char *config_mak ='; \
+	 sed < config.mak -e 's/\\/\\\\/g; s/"/\\"/g; s/^/"/; s/$$/\\n"/'; \
+	 echo ';' \
+	) >$@+
+	mv $@+ $@
+
 coverage-build: coverage-clean
 	$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
 	$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
diff --git a/builtin.h b/builtin.h
index a2174dc..2ac8f3a 100644
--- a/builtin.h
+++ b/builtin.h
@@ -113,5 +113,6 @@ extern int cmd_verify_pack(int argc, const char **argv, const char *prefix);
 extern int cmd_show_ref(int argc, const char **argv, const char *prefix);
 extern int cmd_pack_refs(int argc, const char **argv, const char *prefix);
 extern int cmd_replace(int argc, const char **argv, const char *prefix);
+extern int cmd_config_mak(int argc, const char **argv, const char *prefix);
 
 #endif
diff --git a/git.c b/git.c
index 86dcfee..01ddf06 100644
--- a/git.c
+++ b/git.c
@@ -368,6 +368,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "verify-pack", cmd_verify_pack },
 		{ "show-ref", cmd_show_ref, RUN_SETUP },
 		{ "pack-refs", cmd_pack_refs, RUN_SETUP },
+		{ "config-mak", cmd_config_mak, },
 	};
 	int i;
 	static const char ext[] = STRIP_EXTENSION;
diff --git a/help.c b/help.c
index e8db31f..422259a 100644
--- a/help.c
+++ b/help.c
@@ -365,3 +365,10 @@ int cmd_version(int argc, const char **argv, const char *prefix)
 	printf("git version %s\n", git_version_string);
 	return 0;
 }
+
+extern const char *config_mak;
+int cmd_config_mak(int argc, const char **argv, const char *prefix)
+{
+	fputs(config_mak, stdout);
+	return 0;
+}
-- 
1.6.5.1.3.g9d77a

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]