Re: [RFC PATCH] repack: rewrite the shell script in C.
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:58:25
Stefan Beller [off-list ref] writes:
quoted hunk
diff --git a/builtin/repack.c b/builtin/repack.c new file mode 100644 index 0000000..d39c34e --- /dev/null +++ b/builtin/repack.c@@ -0,0 +1,410 @@ +/* + * The shell version was written by Linus Torvalds (2005) and many others. + * This is a translation into C by Stefan Beller (2013) + */ + +#include "builtin.h" +#include "cache.h" +#include "dir.h" +#include "parse-options.h" +#include "run-command.h" +#include "sigchain.h" +#include "strbuf.h" +#include "string-list.h" + +#include <sys/types.h> +#include <unistd.h> +#include <stdio.h> +#include <dirent.h>
If you need these system-includes here, it means that our own platform-portability layer "git-compat-util.h" is broken. On various systems, often some system header files are missing, need a few feature macros to be defined before including, and/or need to be included in certain order, etc., and "git-compat-util.h" is meant to hide all such details from the programmers. I do not think the above four needs to be included in *.c, as long as you include either builtin.h or cache.h, both of which includes the compat-util header.