Revert "display HTML in default browser using Windows' shell API"
Since 4804aab (help (Windows): Display HTML in default browser using Windows' shell API, 2008-07-13), Git for Windows used to call `ShellExecute()` to launch the default Windows handler for `.html` files. The idea was to avoid going through a shell script, for performance reasons. However, this change ignores the `help.browser` config setting. Together with browsing help not being a performance-critical operation, let's just revert that patch. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Aug 19, 2016 at 10:39 UTC
6db5967d4e6640c5a3ee3cde151c5fdde5ab508f
3 files changed
-52
builtin/help.c
-7
@@ -379,17 +379,10 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
379
free(to_free);
380
}
381
382
-/*
383
- * If open_html is not defined in a platform-specific way (see for
384
- * example compat/mingw.h), we use the script web--browse to display
385
- * HTML.
386
- */
387
-#ifndef open_html
382
static void open_html(const char *path)
383
{
384
execl_git_cmd("web--browse", "-c", "help.browser", path, (char *)NULL);
385
}
392
-#endif
386
387
static void show_html_page(const char *git_cmd)
388
{
compat/mingw.c
-42
@@ -1930,48 +1930,6 @@ int mingw_raise(int sig)
1930
}
1931
}
1932
1933
-
1934
-static const char *make_backslash_path(const char *path)
1935
-{
1936
- static char buf[PATH_MAX + 1];
1937
- char *c;
1938
-
1939
- if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
1940
- die("Too long path: %.*s", 60, path);
1941
-
1942
- for (c = buf; *c; c++) {
1943
- if (*c == '/')
1944
- *c = '\\';
1945
- }
1946
- return buf;
1947
-}
1948
-
1949
-void mingw_open_html(const char *unixpath)
1950
-{
1951
- const char *htmlpath = make_backslash_path(unixpath);
1952
- typedef HINSTANCE (WINAPI *T)(HWND, const char *,
1953
- const char *, const char *, const char *, INT);
1954
- T ShellExecute;
1955
- HMODULE shell32;
1956
- int r;
1957
-
1958
- shell32 = LoadLibrary("shell32.dll");
1959
- if (!shell32)
1960
- die("cannot load shell32.dll");
1961
- ShellExecute = (T)GetProcAddress(shell32, "ShellExecuteA");
1962
- if (!ShellExecute)
1963
- die("cannot run browser");
1964
-
1965
- printf("Launching default browser to display HTML ...\n");
1966
- r = HCAST(int, ShellExecute(NULL, "open", htmlpath,
1967
- NULL, "\\", SW_SHOWNORMAL));
1968
- FreeLibrary(shell32);
1969
- /* see the MSDN documentation referring to the result codes here */
1970
- if (r <= 32) {
1971
- die("failed to launch browser for %.*s", MAX_PATH, unixpath);
1972
- }
1973
-}
1974
-
1933
int link(const char *oldpath, const char *newpath)
1934
{
1935
typedef BOOL (WINAPI *T)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES);
compat/mingw.h
-3
@@ -414,9 +414,6 @@ int mingw_offset_1st_component(const char *path);
414
#include <inttypes.h>
415
#endif
416
417
-void mingw_open_html(const char *path);
418
-#define open_html mingw_open_html
419
-
417
/**
418
* Converts UTF-8 encoded string to UTF-16LE.
419
*