{"thread":{"id":"43884","subject":"[PATCH] Revert \"display HTML in default browser using Windows' shell API\"","startedAt":"2016-08-19T08:39:52Z","lastAt":"2016-08-19T08:39:52Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"299688","messageId":"03ae6a9d47cb95a54960bfdc90c5392f890ff1e3.1471595956.git.johannes.schindelin@gmx.de","threadId":"43884","inReplyTo":null,"subject":"[PATCH] Revert \"display HTML in default browser using Windows' shell API\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-08-19T08:39:38Z","receivedAt":"2016-08-19T08:39:52Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Since 4804aab (help (Windows): Display HTML in default browser using\nWindows' shell API, 2008-07-13), Git for Windows used to call\n`ShellExecute()` to launch the default Windows handler for `.html`\nfiles.\n\nThe idea was to avoid going through a shell script, for performance\nreasons.\n\nHowever, this change ignores the `help.browser` config setting. Together\nwith browsing help not being a performance-critical operation, let's\njust revert that patch.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\nPublished-As: https://github.com/dscho/git/releases/tag/mingw-help-v1\nFetch-It-Via: git fetch https://github.com/dscho/git mingw-help-v1\n\n builtin/help.c |  7 -------\n compat/mingw.c | 42 ------------------------------------------\n compat/mingw.h |  3 ---\n 3 files changed, 52 deletions(-)\n\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 8848013..e8f79d7 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -379,17 +379,10 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)\n \tfree(to_free);\n }\n \n-/*\n- * If open_html is not defined in a platform-specific way (see for\n- * example compat/mingw.h), we use the script web--browse to display\n- * HTML.\n- */\n-#ifndef open_html\n static void open_html(const char *path)\n {\n \texecl_git_cmd(\"web--browse\", \"-c\", \"help.browser\", path, (char *)NULL);\n }\n-#endif\n \n static void show_html_page(const char *git_cmd)\n {\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 2b5467d..3fbfda5 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -1930,48 +1930,6 @@ int mingw_raise(int sig)\n \t}\n }\n \n-\n-static const char *make_backslash_path(const char *path)\n-{\n-\tstatic char buf[PATH_MAX + 1];\n-\tchar *c;\n-\n-\tif (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)\n-\t\tdie(\"Too long path: %.*s\", 60, path);\n-\n-\tfor (c = buf; *c; c++) {\n-\t\tif (*c == '/')\n-\t\t\t*c = '\\\\';\n-\t}\n-\treturn buf;\n-}\n-\n-void mingw_open_html(const char *unixpath)\n-{\n-\tconst char *htmlpath = make_backslash_path(unixpath);\n-\ttypedef HINSTANCE (WINAPI *T)(HWND, const char *,\n-\t\t\tconst char *, const char *, const char *, INT);\n-\tT ShellExecute;\n-\tHMODULE shell32;\n-\tint r;\n-\n-\tshell32 = LoadLibrary(\"shell32.dll\");\n-\tif (!shell32)\n-\t\tdie(\"cannot load shell32.dll\");\n-\tShellExecute = (T)GetProcAddress(shell32, \"ShellExecuteA\");\n-\tif (!ShellExecute)\n-\t\tdie(\"cannot run browser\");\n-\n-\tprintf(\"Launching default browser to display HTML ...\\n\");\n-\tr = HCAST(int, ShellExecute(NULL, \"open\", htmlpath,\n-\t\t\t\tNULL, \"\\\\\", SW_SHOWNORMAL));\n-\tFreeLibrary(shell32);\n-\t/* see the MSDN documentation referring to the result codes here */\n-\tif (r <= 32) {\n-\t\tdie(\"failed to launch browser for %.*s\", MAX_PATH, unixpath);\n-\t}\n-}\n-\n int link(const char *oldpath, const char *newpath)\n {\n \ttypedef BOOL (WINAPI *T)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES);\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 95e128f..2cadb81 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -417,9 +417,6 @@ int mingw_offset_1st_component(const char *path);\n #include <inttypes.h>\n #endif\n \n-void mingw_open_html(const char *path);\n-#define open_html mingw_open_html\n-\n /**\n  * Converts UTF-8 encoded string to UTF-16LE.\n  *\n-- \n2.9.2.691.g78954f3\n\nbase-commit: d63263a4dee8fc7da9b97bbdedf9c0d1f33024d4\n"}]}