{"thread":{"id":"14193","subject":"[PATCH] shrink git-shell by avoiding redundant dependencies","startedAt":"2008-06-27T21:35:38Z","lastAt":"2008-07-18T10:55:16Z","messageCount":16,"participants":["Dmitry Potapov","Junio C Hamano","Johannes Schindelin","Stephan Beyer","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"81474","messageId":"1214602538-7888-1-git-send-email-dpotapov@gmail.com","threadId":"14193","inReplyTo":null,"subject":"[PATCH] shrink git-shell by avoiding redundant dependencies","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-06-27T21:35:38Z","receivedAt":"2008-06-27T21:35:38Z","isPatch":true,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"A lot of modules that have nothing to do with git-shell functionality\nwere linked in, bloating git-shell more than 8 times.\n\nThis patch cuts off redundant dependencies by:\n1. providing stubs for three functions that make no sense for git-shell;\n2. moving quote_path_fully from environment.c to quote.c to make the\n   later self sufficient;\n3. moving make_absolute_path into a new separate file.\n\nThe following numbers have been received with the default optimization\nsettings on master using GCC 4.1.2:\n\nBefore:\n   text    data     bss     dec     hex filename\n 143915    1348   93168  238431   3a35f git-shell\n\nAfter:\n   text    data     bss     dec     hex filename\n  17670     788    8232   26690    6842 git-shell\n---\n Makefile      |    1 +\n abspath.c     |   80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n environment.c |    1 -\n path.c        |   67 -----------------------------------------------\n quote.c       |    2 +\n shell.c       |    8 +++++\n 6 files changed, 91 insertions(+), 68 deletions(-)\n create mode 100644 abspath.c\n\ndiff --git a/Makefile b/Makefile\nindex 3584b8c..bf77292 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -378,6 +378,7 @@ LIB_H += unpack-trees.h\n LIB_H += utf8.h\n LIB_H += wt-status.h\n \n+LIB_OBJS += abspath.o\n LIB_OBJS += alias.o\n LIB_OBJS += alloc.o\n LIB_OBJS += archive.o\ndiff --git a/abspath.c b/abspath.c\nnew file mode 100644\nindex 0000000..4becedf\n--- /dev/null\n+++ b/abspath.c\n@@ -0,0 +1,80 @@\n+/*\n+ * I'm tired of doing \"vsnprintf()\" etc just to open a\n+ * file, so here's a \"return static buffer with printf\"\n+ * interface for paths.\n+ *\n+ * It's obviously not thread-safe. Sue me. But it's quite\n+ * useful for doing things like\n+ *\n+ *   f = open(mkpath(\"%s/%s.git\", base, name), O_RDONLY);\n+ *\n+ * which is what it's designed for.\n+ */\n+#include \"cache.h\"\n+\n+/* We allow \"recursive\" symbolic links. Only within reason, though. */\n+#define MAXDEPTH 5\n+\n+const char *make_absolute_path(const char *path)\n+{\n+\tstatic char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1];\n+\tchar cwd[1024] = \"\";\n+\tint buf_index = 1, len;\n+\n+\tint depth = MAXDEPTH;\n+\tchar *last_elem = NULL;\n+\tstruct stat st;\n+\n+\tif (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)\n+\t\tdie (\"Too long path: %.*s\", 60, path);\n+\n+\twhile (depth--) {\n+\t\tif (stat(buf, &st) || !S_ISDIR(st.st_mode)) {\n+\t\t\tchar *last_slash = strrchr(buf, '/');\n+\t\t\tif (last_slash) {\n+\t\t\t\t*last_slash = '\\0';\n+\t\t\t\tlast_elem = xstrdup(last_slash + 1);\n+\t\t\t} else {\n+\t\t\t\tlast_elem = xstrdup(buf);\n+\t\t\t\t*buf = '\\0';\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (*buf) {\n+\t\t\tif (!*cwd && !getcwd(cwd, sizeof(cwd)))\n+\t\t\t\tdie (\"Could not get current working directory\");\n+\n+\t\t\tif (chdir(buf))\n+\t\t\t\tdie (\"Could not switch to '%s'\", buf);\n+\t\t}\n+\t\tif (!getcwd(buf, PATH_MAX))\n+\t\t\tdie (\"Could not get current working directory\");\n+\n+\t\tif (last_elem) {\n+\t\t\tint len = strlen(buf);\n+\t\t\tif (len + strlen(last_elem) + 2 > PATH_MAX)\n+\t\t\t\tdie (\"Too long path name: '%s/%s'\",\n+\t\t\t\t\t\tbuf, last_elem);\n+\t\t\tbuf[len] = '/';\n+\t\t\tstrcpy(buf + len + 1, last_elem);\n+\t\t\tfree(last_elem);\n+\t\t\tlast_elem = NULL;\n+\t\t}\n+\n+\t\tif (!lstat(buf, &st) && S_ISLNK(st.st_mode)) {\n+\t\t\tlen = readlink(buf, next_buf, PATH_MAX);\n+\t\t\tif (len < 0)\n+\t\t\t\tdie (\"Invalid symlink: %s\", buf);\n+\t\t\tnext_buf[len] = '\\0';\n+\t\t\tbuf = next_buf;\n+\t\t\tbuf_index = 1 - buf_index;\n+\t\t\tnext_buf = bufs[buf_index];\n+\t\t} else\n+\t\t\tbreak;\n+\t}\n+\n+\tif (*cwd && chdir(cwd))\n+\t\tdie (\"Could not change back to '%s'\", cwd);\n+\n+\treturn buf;\n+}\ndiff --git a/environment.c b/environment.c\nindex 084ac8a..4a88a17 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -13,7 +13,6 @@ char git_default_email[MAX_GITNAME];\n char git_default_name[MAX_GITNAME];\n int user_ident_explicitly_given;\n int trust_executable_bit = 1;\n-int quote_path_fully = 1;\n int has_symlinks = 1;\n int ignore_case;\n int assume_unchanged;\ndiff --git a/path.c b/path.c\nindex 6e3df18..496123c 100644\n--- a/path.c\n+++ b/path.c\n@@ -327,9 +327,6 @@ const char *make_nonrelative_path(const char *path)\n \treturn buf;\n }\n \n-/* We allow \"recursive\" symbolic links. Only within reason, though. */\n-#define MAXDEPTH 5\n-\n const char *make_relative_path(const char *abs, const char *base)\n {\n \tstatic char buf[PATH_MAX + 1];\n@@ -346,67 +343,3 @@ const char *make_relative_path(const char *abs, const char *base)\n \tstrcpy(buf, abs + baselen);\n \treturn buf;\n }\n-\n-const char *make_absolute_path(const char *path)\n-{\n-\tstatic char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1];\n-\tchar cwd[1024] = \"\";\n-\tint buf_index = 1, len;\n-\n-\tint depth = MAXDEPTH;\n-\tchar *last_elem = NULL;\n-\tstruct stat st;\n-\n-\tif (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)\n-\t\tdie (\"Too long path: %.*s\", 60, path);\n-\n-\twhile (depth--) {\n-\t\tif (stat(buf, &st) || !S_ISDIR(st.st_mode)) {\n-\t\t\tchar *last_slash = strrchr(buf, '/');\n-\t\t\tif (last_slash) {\n-\t\t\t\t*last_slash = '\\0';\n-\t\t\t\tlast_elem = xstrdup(last_slash + 1);\n-\t\t\t} else {\n-\t\t\t\tlast_elem = xstrdup(buf);\n-\t\t\t\t*buf = '\\0';\n-\t\t\t}\n-\t\t}\n-\n-\t\tif (*buf) {\n-\t\t\tif (!*cwd && !getcwd(cwd, sizeof(cwd)))\n-\t\t\t\tdie (\"Could not get current working directory\");\n-\n-\t\t\tif (chdir(buf))\n-\t\t\t\tdie (\"Could not switch to '%s'\", buf);\n-\t\t}\n-\t\tif (!getcwd(buf, PATH_MAX))\n-\t\t\tdie (\"Could not get current working directory\");\n-\n-\t\tif (last_elem) {\n-\t\t\tint len = strlen(buf);\n-\t\t\tif (len + strlen(last_elem) + 2 > PATH_MAX)\n-\t\t\t\tdie (\"Too long path name: '%s/%s'\",\n-\t\t\t\t\t\tbuf, last_elem);\n-\t\t\tbuf[len] = '/';\n-\t\t\tstrcpy(buf + len + 1, last_elem);\n-\t\t\tfree(last_elem);\n-\t\t\tlast_elem = NULL;\n-\t\t}\n-\n-\t\tif (!lstat(buf, &st) && S_ISLNK(st.st_mode)) {\n-\t\t\tlen = readlink(buf, next_buf, PATH_MAX);\n-\t\t\tif (len < 0)\n-\t\t\t\tdie (\"Invalid symlink: %s\", buf);\n-\t\t\tnext_buf[len] = '\\0';\n-\t\t\tbuf = next_buf;\n-\t\t\tbuf_index = 1 - buf_index;\n-\t\t\tnext_buf = bufs[buf_index];\n-\t\t} else\n-\t\t\tbreak;\n-\t}\n-\n-\tif (*cwd && chdir(cwd))\n-\t\tdie (\"Could not change back to '%s'\", cwd);\n-\n-\treturn buf;\n-}\ndiff --git a/quote.c b/quote.c\nindex d5cf9d8..6a52085 100644\n--- a/quote.c\n+++ b/quote.c\n@@ -1,6 +1,8 @@\n #include \"cache.h\"\n #include \"quote.h\"\n \n+int quote_path_fully = 1;\n+\n /* Help to copy the thing properly quoted for the shell safety.\n  * any single quote is replaced with '\\'', any exclamation point\n  * is replaced with '\\!', and the whole thing is enclosed in a\ndiff --git a/shell.c b/shell.c\nindex b27d01c..91ca7de 100644\n--- a/shell.c\n+++ b/shell.c\n@@ -3,6 +3,14 @@\n #include \"exec_cmd.h\"\n #include \"strbuf.h\"\n \n+/* Stubs for functions that make no sense for git-shell. These stubs\n+ * are provided here to avoid linking in external redundant modules.\n+ */\n+void release_pack_memory(size_t need, int fd){}\n+void trace_argv_printf(const char **argv, const char *fmt, ...){}\n+void trace_printf(const char *fmt, ...){}\n+\n+\n static int do_generic_cmd(const char *me, char *arg)\n {\n \tconst char *my_argv[4];\n-- \n1.5.6.1\n"},{"id":"81477","messageId":"7vod5mpmp7.fsf@gitster.siamese.dyndns.org","threadId":"14193","inReplyTo":"1214602538-7888-1-git-send-email-dpotapov@gmail.com","subject":"Re: [PATCH] shrink git-shell by avoiding redundant dependencies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-27T21:55:32Z","receivedAt":"2008-06-27T21:55:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dmitry Potapov <dpotapov@gmail.com> writes:\n\n> diff --git a/abspath.c b/abspath.c\n> new file mode 100644\n> index 0000000..4becedf\n> --- /dev/null\n> +++ b/abspath.c\n> @@ -0,0 +1,80 @@\n> +/*\n> + * I'm tired of doing \"vsnprintf()\" etc just to open a\n> + * file, so here's a \"return static buffer with printf\"\n> + * interface for paths.\n> + *\n> + * It's obviously not thread-safe. Sue me. But it's quite\n> + * useful for doing things like\n> + *\n> + *   f = open(mkpath(\"%s/%s.git\", base, name), O_RDONLY);\n> + *\n> + * which is what it's designed for.\n> + */\n\nThis is not a comment you would want to move to the resulting file that\ncontains only make_absolute_path().\n"},{"id":"81505","messageId":"20080627223107.GH5737@dpotapov.dyndns.org","threadId":"14193","inReplyTo":"7vod5mpmp7.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] shrink git-shell by avoiding redundant dependencies","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-06-27T22:31:07Z","receivedAt":"2008-06-27T22:31:07Z","isPatch":true,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Fri, Jun 27, 2008 at 02:55:32PM -0700, Junio C Hamano wrote:\n> Dmitry Potapov <dpotapov@gmail.com> writes:\n> \n> > diff --git a/abspath.c b/abspath.c\n> > new file mode 100644\n> > index 0000000..4becedf\n> > --- /dev/null\n> > +++ b/abspath.c\n> > @@ -0,0 +1,80 @@\n> > +/*\n> > + * I'm tired of doing \"vsnprintf()\" etc just to open a\n> > + * file, so here's a \"return static buffer with printf\"\n> > + * interface for paths.\n> > + *\n> > + * It's obviously not thread-safe. Sue me. But it's quite\n> > + * useful for doing things like\n> > + *\n> > + *   f = open(mkpath(\"%s/%s.git\", base, name), O_RDONLY);\n> > + *\n> > + * which is what it's designed for.\n> > + */\n> \n> This is not a comment you would want to move to the resulting file that\n> contains only make_absolute_path().\n\nI am sorry... I removed this comment. Here is the corrected patch.\n\n-- 8< --\nFrom: Dmitry Potapov <dpotapov@gmail.com>\nDate: Sat, 28 Jun 2008 00:46:42 +0400\nSubject: [PATCH] shrink git-shell by avoiding redundant dependencies\n\nA lot of modules that have nothing to do with git-shell functionality\nwere linked in, bloating git-shell more than 8 times.\n\nThis patch cuts off redundant dependencies by:\n1. providing stubs for three functions that make no sense for git-shell;\n2. moving quote_path_fully from environment.c to quote.c to make the\n   later self sufficient;\n3. moving make_absolute_path into a new separate file.\n\nThe following numbers have been received with the default optimization\nsettings on master using GCC 4.1.2:\n\nBefore:\n   text    data     bss     dec     hex filename\n 143915    1348   93168  238431   3a35f git-shell\n\nAfter:\n   text    data     bss     dec     hex filename\n  17670     788    8232   26690    6842 git-shell\n---\n Makefile      |    1 +\n abspath.c     |   68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n environment.c |    1 -\n path.c        |   67 --------------------------------------------------------\n quote.c       |    2 +\n shell.c       |    8 ++++++\n 6 files changed, 79 insertions(+), 68 deletions(-)\n create mode 100644 abspath.c\n\ndiff --git a/Makefile b/Makefile\nindex 3584b8c..bf77292 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -378,6 +378,7 @@ LIB_H += unpack-trees.h\n LIB_H += utf8.h\n LIB_H += wt-status.h\n \n+LIB_OBJS += abspath.o\n LIB_OBJS += alias.o\n LIB_OBJS += alloc.o\n LIB_OBJS += archive.o\ndiff --git a/abspath.c b/abspath.c\nnew file mode 100644\nindex 0000000..4f95a95\n--- /dev/null\n+++ b/abspath.c\n@@ -0,0 +1,68 @@\n+#include \"cache.h\"\n+\n+/* We allow \"recursive\" symbolic links. Only within reason, though. */\n+#define MAXDEPTH 5\n+\n+const char *make_absolute_path(const char *path)\n+{\n+\tstatic char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1];\n+\tchar cwd[1024] = \"\";\n+\tint buf_index = 1, len;\n+\n+\tint depth = MAXDEPTH;\n+\tchar *last_elem = NULL;\n+\tstruct stat st;\n+\n+\tif (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)\n+\t\tdie (\"Too long path: %.*s\", 60, path);\n+\n+\twhile (depth--) {\n+\t\tif (stat(buf, &st) || !S_ISDIR(st.st_mode)) {\n+\t\t\tchar *last_slash = strrchr(buf, '/');\n+\t\t\tif (last_slash) {\n+\t\t\t\t*last_slash = '\\0';\n+\t\t\t\tlast_elem = xstrdup(last_slash + 1);\n+\t\t\t} else {\n+\t\t\t\tlast_elem = xstrdup(buf);\n+\t\t\t\t*buf = '\\0';\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (*buf) {\n+\t\t\tif (!*cwd && !getcwd(cwd, sizeof(cwd)))\n+\t\t\t\tdie (\"Could not get current working directory\");\n+\n+\t\t\tif (chdir(buf))\n+\t\t\t\tdie (\"Could not switch to '%s'\", buf);\n+\t\t}\n+\t\tif (!getcwd(buf, PATH_MAX))\n+\t\t\tdie (\"Could not get current working directory\");\n+\n+\t\tif (last_elem) {\n+\t\t\tint len = strlen(buf);\n+\t\t\tif (len + strlen(last_elem) + 2 > PATH_MAX)\n+\t\t\t\tdie (\"Too long path name: '%s/%s'\",\n+\t\t\t\t\t\tbuf, last_elem);\n+\t\t\tbuf[len] = '/';\n+\t\t\tstrcpy(buf + len + 1, last_elem);\n+\t\t\tfree(last_elem);\n+\t\t\tlast_elem = NULL;\n+\t\t}\n+\n+\t\tif (!lstat(buf, &st) && S_ISLNK(st.st_mode)) {\n+\t\t\tlen = readlink(buf, next_buf, PATH_MAX);\n+\t\t\tif (len < 0)\n+\t\t\t\tdie (\"Invalid symlink: %s\", buf);\n+\t\t\tnext_buf[len] = '\\0';\n+\t\t\tbuf = next_buf;\n+\t\t\tbuf_index = 1 - buf_index;\n+\t\t\tnext_buf = bufs[buf_index];\n+\t\t} else\n+\t\t\tbreak;\n+\t}\n+\n+\tif (*cwd && chdir(cwd))\n+\t\tdie (\"Could not change back to '%s'\", cwd);\n+\n+\treturn buf;\n+}\ndiff --git a/environment.c b/environment.c\nindex 084ac8a..4a88a17 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -13,7 +13,6 @@ char git_default_email[MAX_GITNAME];\n char git_default_name[MAX_GITNAME];\n int user_ident_explicitly_given;\n int trust_executable_bit = 1;\n-int quote_path_fully = 1;\n int has_symlinks = 1;\n int ignore_case;\n int assume_unchanged;\ndiff --git a/path.c b/path.c\nindex 6e3df18..496123c 100644\n--- a/path.c\n+++ b/path.c\n@@ -327,9 +327,6 @@ const char *make_nonrelative_path(const char *path)\n \treturn buf;\n }\n \n-/* We allow \"recursive\" symbolic links. Only within reason, though. */\n-#define MAXDEPTH 5\n-\n const char *make_relative_path(const char *abs, const char *base)\n {\n \tstatic char buf[PATH_MAX + 1];\n@@ -346,67 +343,3 @@ const char *make_relative_path(const char *abs, const char *base)\n \tstrcpy(buf, abs + baselen);\n \treturn buf;\n }\n-\n-const char *make_absolute_path(const char *path)\n-{\n-\tstatic char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1];\n-\tchar cwd[1024] = \"\";\n-\tint buf_index = 1, len;\n-\n-\tint depth = MAXDEPTH;\n-\tchar *last_elem = NULL;\n-\tstruct stat st;\n-\n-\tif (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)\n-\t\tdie (\"Too long path: %.*s\", 60, path);\n-\n-\twhile (depth--) {\n-\t\tif (stat(buf, &st) || !S_ISDIR(st.st_mode)) {\n-\t\t\tchar *last_slash = strrchr(buf, '/');\n-\t\t\tif (last_slash) {\n-\t\t\t\t*last_slash = '\\0';\n-\t\t\t\tlast_elem = xstrdup(last_slash + 1);\n-\t\t\t} else {\n-\t\t\t\tlast_elem = xstrdup(buf);\n-\t\t\t\t*buf = '\\0';\n-\t\t\t}\n-\t\t}\n-\n-\t\tif (*buf) {\n-\t\t\tif (!*cwd && !getcwd(cwd, sizeof(cwd)))\n-\t\t\t\tdie (\"Could not get current working directory\");\n-\n-\t\t\tif (chdir(buf))\n-\t\t\t\tdie (\"Could not switch to '%s'\", buf);\n-\t\t}\n-\t\tif (!getcwd(buf, PATH_MAX))\n-\t\t\tdie (\"Could not get current working directory\");\n-\n-\t\tif (last_elem) {\n-\t\t\tint len = strlen(buf);\n-\t\t\tif (len + strlen(last_elem) + 2 > PATH_MAX)\n-\t\t\t\tdie (\"Too long path name: '%s/%s'\",\n-\t\t\t\t\t\tbuf, last_elem);\n-\t\t\tbuf[len] = '/';\n-\t\t\tstrcpy(buf + len + 1, last_elem);\n-\t\t\tfree(last_elem);\n-\t\t\tlast_elem = NULL;\n-\t\t}\n-\n-\t\tif (!lstat(buf, &st) && S_ISLNK(st.st_mode)) {\n-\t\t\tlen = readlink(buf, next_buf, PATH_MAX);\n-\t\t\tif (len < 0)\n-\t\t\t\tdie (\"Invalid symlink: %s\", buf);\n-\t\t\tnext_buf[len] = '\\0';\n-\t\t\tbuf = next_buf;\n-\t\t\tbuf_index = 1 - buf_index;\n-\t\t\tnext_buf = bufs[buf_index];\n-\t\t} else\n-\t\t\tbreak;\n-\t}\n-\n-\tif (*cwd && chdir(cwd))\n-\t\tdie (\"Could not change back to '%s'\", cwd);\n-\n-\treturn buf;\n-}\ndiff --git a/quote.c b/quote.c\nindex d5cf9d8..6a52085 100644\n--- a/quote.c\n+++ b/quote.c\n@@ -1,6 +1,8 @@\n #include \"cache.h\"\n #include \"quote.h\"\n \n+int quote_path_fully = 1;\n+\n /* Help to copy the thing properly quoted for the shell safety.\n  * any single quote is replaced with '\\'', any exclamation point\n  * is replaced with '\\!', and the whole thing is enclosed in a\ndiff --git a/shell.c b/shell.c\nindex b27d01c..91ca7de 100644\n--- a/shell.c\n+++ b/shell.c\n@@ -3,6 +3,14 @@\n #include \"exec_cmd.h\"\n #include \"strbuf.h\"\n \n+/* Stubs for functions that make no sense for git-shell. These stubs\n+ * are provided here to avoid linking in external redundant modules.\n+ */\n+void release_pack_memory(size_t need, int fd){}\n+void trace_argv_printf(const char **argv, const char *fmt, ...){}\n+void trace_printf(const char *fmt, ...){}\n+\n+\n static int do_generic_cmd(const char *me, char *arg)\n {\n \tconst char *my_argv[4];\n-- \n1.5.6.1\n"},{"id":"81506","messageId":"7v1w2ipkww.fsf@gitster.siamese.dyndns.org","threadId":"14193","inReplyTo":"20080627223107.GH5737@dpotapov.dyndns.org","subject":"Re: [PATCH] shrink git-shell by avoiding redundant dependencies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-27T22:34:07Z","receivedAt":"2008-06-27T22:34:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dmitry Potapov <dpotapov@gmail.com> writes:\n\n> On Fri, Jun 27, 2008 at 02:55:32PM -0700, Junio C Hamano wrote:\n>> Dmitry Potapov <dpotapov@gmail.com> writes:\n>> \n>> > diff --git a/abspath.c b/abspath.c\n>> > new file mode 100644\n>> > index 0000000..4becedf\n>> > --- /dev/null\n>> > +++ b/abspath.c\n>> > @@ -0,0 +1,80 @@\n>> > +/*\n>> > + * I'm tired of doing \"vsnprintf()\" etc just to open a\n>> > + * file, so here's a \"return static buffer with printf\"\n>> > + * interface for paths.\n>> > + *\n>> > + * It's obviously not thread-safe. Sue me. But it's quite\n>> > + * useful for doing things like\n>> > + *\n>> > + *   f = open(mkpath(\"%s/%s.git\", base, name), O_RDONLY);\n>> > + *\n>> > + * which is what it's designed for.\n>> > + */\n>> \n>> This is not a comment you would want to move to the resulting file that\n>> contains only make_absolute_path().\n>\n> I am sorry... I removed this comment. Here is the corrected patch.\n\nNo need to say nor be sorry.  The rest looks sane from a quick glance,\nexcept that we may want to have a separate clean-up patch that\nconsolidates MAXDEPTH in many places that limits our manual symlink\nresolution.\n"},{"id":"81560","messageId":"alpine.DEB.1.00.0806281542160.9925@racer","threadId":"14193","inReplyTo":"1214602538-7888-1-git-send-email-dpotapov@gmail.com","subject":"Re: [PATCH] shrink git-shell by avoiding redundant dependencies","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-28T14:51:21Z","receivedAt":"2008-06-28T14:51:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 28 Jun 2008, Dmitry Potapov wrote:\n\n> A lot of modules that have nothing to do with git-shell functionality\n> were linked in, bloating git-shell more than 8 times.\n\n/me wonders if \"strip git-shell\" would not take care of all that.\n\nJust curious,\nDscho\n"},{"id":"81565","messageId":"37fcd2780806280948y143b619p60f05495ca85454b@mail.gmail.com","threadId":"14193","inReplyTo":"alpine.DEB.1.00.0806281542160.9925@racer","subject":"Re: [PATCH] shrink git-shell by avoiding redundant dependencies","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-06-28T16:48:54Z","receivedAt":"2008-06-28T16:48:54Z","isPatch":true,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Sat, Jun 28, 2008 at 6:51 PM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n>\n> /me wonders if \"strip git-shell\" would not take care of all that.\n\n\"strip\" removes only debug information. It has no affect on text, data, and bss\nsections. You can try to run \"size git-shell\" before and after\n\"strip\", and you'll\nsee the same numbers.\n\nBTW, it is possible to reduce the \"text\" and \"data\" size twice more\nusing the whole\nprogram optimization, as it will discard some functions that are not\nactually used,\nbut I don't think it is worth pursuing as it will complicate complication.\n\nDmitry\n"},{"id":"81571","messageId":"alpine.DEB.1.00.0806281830410.9925@racer","threadId":"14193","inReplyTo":"37fcd2780806280948y143b619p60f05495ca85454b@mail.gmail.com","subject":"Re: [PATCH] shrink git-shell by avoiding redundant dependencies","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-28T17:31:45Z","receivedAt":"2008-06-28T17:31:45Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nThanks for the explanation.  Somehow I thought \"strip\" would do what an \nefficient linker should have done before, but I was wrong.\n\nOn Sat, 28 Jun 2008, Dmitry Potapov wrote:\n\n> BTW, it is possible to reduce the \"text\" and \"data\" size twice more \n> using the whole program optimization, as it will discard some functions \n> that are not actually used, but I don't think it is worth pursuing as it \n> will complicate complication.\n\nHeh.  Indeed, the complication will be complicated ;-)\n\nCiao,\nDscho\n"},{"id":"83775","messageId":"20080718002620.GE8421@leksak.fem-net","threadId":"14193","inReplyTo":"20080627223107.GH5737@dpotapov.dyndns.org","subject":"Re: [PATCH] shrink git-shell by avoiding redundant dependencies","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2008-07-18T00:26:20Z","receivedAt":"2008-07-18T00:26:20Z","isPatch":true,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"Hi,\n\nDmitry Potapov wrote:\n> diff --git a/shell.c b/shell.c\n> index b27d01c..91ca7de 100644\n> --- a/shell.c\n> +++ b/shell.c\n> @@ -3,6 +3,14 @@\n>  #include \"exec_cmd.h\"\n>  #include \"strbuf.h\"\n>  \n> +/* Stubs for functions that make no sense for git-shell. These stubs\n> + * are provided here to avoid linking in external redundant modules.\n> + */\n> +void release_pack_memory(size_t need, int fd){}\n> +void trace_argv_printf(const char **argv, const char *fmt, ...){}\n> +void trace_printf(const char *fmt, ...){}\n> +\n> +\n\nI don't really understand why this works.\nYou redefine libgit.a functions here\n\nSo the linker should complain like that:\n\tlibgit.a(sha1_file.o): In function `release_pack_memory':\n\t/home/sbeyer/src/git/sha1_file.c:624: multiple definition of `release_pack_memory'\n\tshell.o:/home/sbeyer/src/git/shell.c:9: first defined here\n\tcollect2: ld returned 1 exit status\n\nAnd, in fact, it does when I move a function from a builtin to a lib\nsource file, for example launch_editor() from builtin-tag.c to strbuf.c,\nlike the following one:\n\n---\n builtin-tag.c |   53 -----------------------------------------------------\n strbuf.c      |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 54 insertions(+), 53 deletions(-)\n\ndiff --git a/builtin-tag.c b/builtin-tag.c\nindex c2cca6c..219f51d 100644\n--- a/builtin-tag.c\n+++ b/builtin-tag.c\n@@ -23,59 +23,6 @@ static const char * const git_tag_usage[] = {\n \n static char signingkey[1000];\n \n-void launch_editor(const char *path, struct strbuf *buffer, const char *const *env)\n-{\n-\tconst char *editor, *terminal;\n-\n-\teditor = getenv(\"GIT_EDITOR\");\n-\tif (!editor && editor_program)\n-\t\teditor = editor_program;\n-\tif (!editor)\n-\t\teditor = getenv(\"VISUAL\");\n-\tif (!editor)\n-\t\teditor = getenv(\"EDITOR\");\n-\n-\tterminal = getenv(\"TERM\");\n-\tif (!editor && (!terminal || !strcmp(terminal, \"dumb\"))) {\n-\t\tfprintf(stderr,\n-\t\t\"Terminal is dumb but no VISUAL nor EDITOR defined.\\n\"\n-\t\t\"Please supply the message using either -m or -F option.\\n\");\n-\t\texit(1);\n-\t}\n-\n-\tif (!editor)\n-\t\teditor = \"vi\";\n-\n-\tif (strcmp(editor, \":\")) {\n-\t\tsize_t len = strlen(editor);\n-\t\tint i = 0;\n-\t\tconst char *args[6];\n-\t\tstruct strbuf arg0;\n-\n-\t\tstrbuf_init(&arg0, 0);\n-\t\tif (strcspn(editor, \"$ \\t'\") != len) {\n-\t\t\t/* there are specials */\n-\t\t\tstrbuf_addf(&arg0, \"%s \\\"$@\\\"\", editor);\n-\t\t\targs[i++] = \"sh\";\n-\t\t\targs[i++] = \"-c\";\n-\t\t\targs[i++] = arg0.buf;\n-\t\t}\n-\t\targs[i++] = editor;\n-\t\targs[i++] = path;\n-\t\targs[i] = NULL;\n-\n-\t\tif (run_command_v_opt_cd_env(args, 0, NULL, env))\n-\t\t\tdie(\"There was a problem with the editor %s.\", editor);\n-\t\tstrbuf_release(&arg0);\n-\t}\n-\n-\tif (!buffer)\n-\t\treturn;\n-\tif (strbuf_read_file(buffer, path, 0) < 0)\n-\t\tdie(\"could not read message file '%s': %s\",\n-\t\t    path, strerror(errno));\n-}\n-\n struct tag_filter {\n \tconst char *pattern;\n \tint lines;\ndiff --git a/strbuf.c b/strbuf.c\nindex 720737d..6419e02 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"run-command.h\"\n \n int prefixcmp(const char *str, const char *prefix)\n {\n@@ -308,3 +309,56 @@ int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint)\n \n \treturn len;\n }\n+\n+void launch_editor(const char *path, struct strbuf *buffer, const char *const *env)\n+{\n+\tconst char *editor, *terminal;\n+\n+\teditor = getenv(\"GIT_EDITOR\");\n+\tif (!editor && editor_program)\n+\t\teditor = editor_program;\n+\tif (!editor)\n+\t\teditor = getenv(\"VISUAL\");\n+\tif (!editor)\n+\t\teditor = getenv(\"EDITOR\");\n+\n+\tterminal = getenv(\"TERM\");\n+\tif (!editor && (!terminal || !strcmp(terminal, \"dumb\"))) {\n+\t\tfprintf(stderr,\n+\t\t\"Terminal is dumb but no VISUAL nor EDITOR defined.\\n\"\n+\t\t\"Please supply the message using either -m or -F option.\\n\");\n+\t\texit(1);\n+\t}\n+\n+\tif (!editor)\n+\t\teditor = \"vi\";\n+\n+\tif (strcmp(editor, \":\")) {\n+\t\tsize_t len = strlen(editor);\n+\t\tint i = 0;\n+\t\tconst char *args[6];\n+\t\tstruct strbuf arg0;\n+\n+\t\tstrbuf_init(&arg0, 0);\n+\t\tif (strcspn(editor, \"$ \\t'\") != len) {\n+\t\t\t/* there are specials */\n+\t\t\tstrbuf_addf(&arg0, \"%s \\\"$@\\\"\", editor);\n+\t\t\targs[i++] = \"sh\";\n+\t\t\targs[i++] = \"-c\";\n+\t\t\targs[i++] = arg0.buf;\n+\t\t}\n+\t\targs[i++] = editor;\n+\t\targs[i++] = path;\n+\t\targs[i] = NULL;\n+\n+\t\tif (run_command_v_opt_cd_env(args, 0, NULL, env))\n+\t\t\tdie(\"There was a problem with the editor %s.\", editor);\n+\t\tstrbuf_release(&arg0);\n+\t}\n+\n+\tif (!buffer)\n+\t\treturn;\n+\tif (strbuf_read_file(buffer, path, 0) < 0)\n+\t\tdie(\"could not read message file '%s': %s\",\n+\t\t    path, strerror(errno));\n+}\n-- \nStephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F\n"},{"id":"83778","messageId":"20080718005814.GA4155@spearce.org","threadId":"14193","inReplyTo":"20080718002620.GE8421@leksak.fem-net","subject":"Re: [PATCH] shrink git-shell by avoiding redundant dependencies","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-18T00:58:14Z","receivedAt":"2008-07-18T00:58:14Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Stephan Beyer <s-beyer@gmx.net> wrote:\n> >  \n> > +/* Stubs for functions that make no sense for git-shell. These stubs\n> > + * are provided here to avoid linking in external redundant modules.\n> > + */\n> > +void release_pack_memory(size_t need, int fd){}\n> > +void trace_argv_printf(const char **argv, const char *fmt, ...){}\n> > +void trace_printf(const char *fmt, ...){}\n> \n> I don't really understand why this works.\n> You redefine libgit.a functions here\n\nOn Solaris you cannot compile git with the Solaris compiler\nand linker, as the linker will not put up with the duplicate\ndefinition of these functions.\n\nI told my co-worker who is taking over \"that git stuff\" from\nme at day-job to post a message to the list, or look at the\nSolaris manual pages and figure out what he needs to do in\nthe Makefile to get it to work right.  Neither has happened\nyet, and those day-job systems are the only Solaris boxen I\ntouch, so I won't be fixing it anytime soon myself.\n\nI have to wonder why its important we avoid linking to\nall of libgit.a here.  So what if git-shell is a little\nbigger?  This is certainly not fully portable, and does\ngive warnings on some systems.\n\n-- \nShawn.\n"},{"id":"83779","messageId":"1216343070-20237-1-git-send-email-s-beyer@gmx.net","threadId":"14193","inReplyTo":"20080718005814.GA4155@spearce.org","subject":"[PATCH] Link git-shell only to a subset of libgit.a","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2008-07-18T01:04:30Z","receivedAt":"2008-07-18T01:04:30Z","isPatch":true,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"Commit 5b8e6f85 introduced stubs for three functions that make no sense\nfor git-shell. But those stubs defined libgit.a functions a second time\nso that a linker can complain.\n\nNow git-shell is only linked to a subset of libgit.a.\n\nSigned-off-by: Stephan Beyer <s-beyer@gmx.net>\n---\nHi Shawn,\n\ndoes this compile on Solaris?\n\n\nFor Dmitry: this is even smaller, but not significant ;-)\n\nBefore:\n  text    data     bss     dec     hex filename\n 24798    1304    8232   34334    861e git-shell\n\nAfter:\n   text    data     bss     dec     hex filename\n  24504    1264    8248   34016    84e0 git-shell\n\n*hide&run*\nStephan.\n\n Makefile |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 4bec4b3..a5626dc 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1204,6 +1204,9 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n \t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n \n+git-shell$X: compat/strlcpy.o abspath.o ctype.o exec_cmd.o quote.o strbuf.o usage.o wrapper.o shell.o\n+\t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^)\n+\n $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)\n $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)\n builtin-revert.o wt-status.o: wt-status.h\n-- \n1.5.6.3.390.g7b30\n"},{"id":"83780","messageId":"20080718010616.GB4155@spearce.org","threadId":"14193","inReplyTo":"1216343070-20237-1-git-send-email-s-beyer@gmx.net","subject":"Re: [PATCH] Link git-shell only to a subset of libgit.a","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-18T01:06:16Z","receivedAt":"2008-07-18T01:06:16Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Stephan Beyer <s-beyer@gmx.net> wrote:\n> Commit 5b8e6f85 introduced stubs for three functions that make no sense\n> for git-shell. But those stubs defined libgit.a functions a second time\n> so that a linker can complain.\n> \n> Now git-shell is only linked to a subset of libgit.a.\n> \n> Signed-off-by: Stephan Beyer <s-beyer@gmx.net>\n> ---\n> Hi Shawn,\n> \n> does this compile on Solaris?\n\nCan't, and won't test it.  Tomorrow is my last day at work and\nI won't have time to test it on Solaris.  I don't have any other\nSolaris boxes to test on, and don't care to either.\n\n-- \nShawn.\n"},{"id":"83781","messageId":"1216343197-20290-1-git-send-email-s-beyer@gmx.net","threadId":"14193","inReplyTo":"20080718005814.GA4155@spearce.org","subject":"[PATCH] Remove function stubs in shell.c","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2008-07-18T01:06:37Z","receivedAt":"2008-07-18T01:06:37Z","isPatch":true,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"These function stubs may be useful, but because they redefine\nfunctions, they provoke a linker error.\n\nSigned-off-by: Stephan Beyer <s-beyer@gmx.net>\n---\nOr would you rather like this one? ;)\n\n shell.c |    8 --------\n 1 files changed, 0 insertions(+), 8 deletions(-)\n\ndiff --git a/shell.c b/shell.c\nindex 91ca7de..b27d01c 100644\n--- a/shell.c\n+++ b/shell.c\n@@ -3,14 +3,6 @@\n #include \"exec_cmd.h\"\n #include \"strbuf.h\"\n \n-/* Stubs for functions that make no sense for git-shell. These stubs\n- * are provided here to avoid linking in external redundant modules.\n- */\n-void release_pack_memory(size_t need, int fd){}\n-void trace_argv_printf(const char **argv, const char *fmt, ...){}\n-void trace_printf(const char *fmt, ...){}\n-\n-\n static int do_generic_cmd(const char *me, char *arg)\n {\n \tconst char *my_argv[4];\n-- \n1.5.6.3.390.g7b30\n"},{"id":"83827","messageId":"20080718055902.GI2925@dpotapov.dyndns.org","threadId":"14193","inReplyTo":"20080718002620.GE8421@leksak.fem-net","subject":"Re: [PATCH] shrink git-shell by avoiding redundant dependencies","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-07-18T05:59:02Z","receivedAt":"2008-07-18T05:59:02Z","isPatch":true,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Fri, Jul 18, 2008 at 02:26:20AM +0200, Stephan Beyer wrote:\n> \n> Dmitry Potapov wrote:\n> > diff --git a/shell.c b/shell.c\n> > index b27d01c..91ca7de 100644\n> > --- a/shell.c\n> > +++ b/shell.c\n> > @@ -3,6 +3,14 @@\n> >  #include \"exec_cmd.h\"\n> >  #include \"strbuf.h\"\n> >  \n> > +/* Stubs for functions that make no sense for git-shell. These stubs\n> > + * are provided here to avoid linking in external redundant modules.\n> > + */\n> > +void release_pack_memory(size_t need, int fd){}\n> > +void trace_argv_printf(const char **argv, const char *fmt, ...){}\n> > +void trace_printf(const char *fmt, ...){}\n> > +\n> > +\n> \n> I don't really understand why this works.\n> You redefine libgit.a functions here\n> \n> So the linker should complain like that:\n> \tlibgit.a(sha1_file.o): In function `release_pack_memory':\n> \t/home/sbeyer/src/git/sha1_file.c:624: multiple definition of `release_pack_memory'\n> \tshell.o:/home/sbeyer/src/git/shell.c:9: first defined here\n> \tcollect2: ld returned 1 exit status\n> \n> And, in fact, it does when I move a function from a builtin to a lib\n> source file, for example launch_editor() from builtin-tag.c to strbuf.c,\n> like the following one:\n\nIt works because these functions are defined in object files, so the\nlinker should not search for them in libraries. However, if the linker\nis forced to link sha1_file.c for some other reason, you will get the\nconflict.\n\nDmitry\n"},{"id":"83828","messageId":"20080718060321.GJ2925@dpotapov.dyndns.org","threadId":"14193","inReplyTo":"1216343070-20237-1-git-send-email-s-beyer@gmx.net","subject":"Re: [PATCH] Link git-shell only to a subset of libgit.a","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-07-18T06:03:21Z","receivedAt":"2008-07-18T06:03:21Z","isPatch":true,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Fri, Jul 18, 2008 at 03:04:30AM +0200, Stephan Beyer wrote:\n> Commit 5b8e6f85 introduced stubs for three functions that make no sense\n> for git-shell. But those stubs defined libgit.a functions a second time\n> so that a linker can complain.\n> \n> Now git-shell is only linked to a subset of libgit.a.\n> \n> Signed-off-by: Stephan Beyer <s-beyer@gmx.net>\n\nI agree, it is probably better to specify explicitly what files to link\nfor git-shell if we want to keep it small and avoid the problem with\nsome linkers.\n\nDmitry\n"},{"id":"83829","messageId":"20080718060634.GK2925@dpotapov.dyndns.org","threadId":"14193","inReplyTo":"1216343197-20290-1-git-send-email-s-beyer@gmx.net","subject":"Re: [PATCH] Remove function stubs in shell.c","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-07-18T06:06:34Z","receivedAt":"2008-07-18T06:06:34Z","isPatch":true,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Fri, Jul 18, 2008 at 03:06:37AM +0200, Stephan Beyer wrote:\n> These function stubs may be useful, but because they redefine\n> functions, they provoke a linker error.\n> \n> Signed-off-by: Stephan Beyer <s-beyer@gmx.net>\n> ---\n> Or would you rather like this one? ;)\n\nUnfortunately, this one will increase the size of git-shell\nconsiderably:\n\n   text    data     bss     dec     hex filename\n  18182     824    8232   27238    6a66 git-shell\n===\n   text    data     bss     dec     hex filename\n 146738    1376   93164  241278   3ae7e git-shell\n\nSo, personally, I don't like it.\n\nDmitry\n"},{"id":"83865","messageId":"alpine.DEB.1.00.0807181253080.3932@eeepc-johanness","threadId":"14193","inReplyTo":"20080718060321.GJ2925@dpotapov.dyndns.org","subject":"Re: [PATCH] Link git-shell only to a subset of libgit.a","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-07-18T10:55:16Z","receivedAt":"2008-07-18T10:55:16Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 18 Jul 2008, Dmitry Potapov wrote:\n\n> On Fri, Jul 18, 2008 at 03:04:30AM +0200, Stephan Beyer wrote:\n> > Commit 5b8e6f85 introduced stubs for three functions that make no \n> > sense for git-shell. But those stubs defined libgit.a functions a \n> > second time so that a linker can complain.\n> > \n> > Now git-shell is only linked to a subset of libgit.a.\n> > \n> > Signed-off-by: Stephan Beyer <s-beyer@gmx.net>\n> \n> I agree, it is probably better to specify explicitly what files to link \n> for git-shell if we want to keep it small and avoid the problem with \n> some linkers.\n\nIt is also more elegant in general, as it does not play tricks to do what \nwe want, but it does explicitely what we want.\n\nFWIW I only removed almost the exact launch_editor() patch Stephan posted \nfrom my personal Git fork because of this trickery (which I did not have \nthe time to fix).\n\nCiao,\nDscho\n"}]}