Skip to content

Commit 6db5967

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0b65a8d commit 6db5967

File tree

3 files changed

+0
-52
lines changed

3 files changed

+0
-52
lines changed

builtin/help.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -379,17 +379,10 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
379379
free(to_free);
380380
}
381381

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
388382
static void open_html(const char *path)
389383
{
390384
execl_git_cmd("web--browse", "-c", "help.browser", path, (char *)NULL);
391385
}
392-
#endif
393386

394387
static void show_html_page(const char *git_cmd)
395388
{

compat/mingw.c

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,48 +1930,6 @@ int mingw_raise(int sig)
19301930
}
19311931
}
19321932

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-
19751933
int link(const char *oldpath, const char *newpath)
19761934
{
19771935
typedef BOOL (WINAPI *T)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES);

compat/mingw.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,6 @@ int mingw_offset_1st_component(const char *path);
414414
#include <inttypes.h>
415415
#endif
416416

417-
void mingw_open_html(const char *path);
418-
#define open_html mingw_open_html
419-
420417
/**
421418
* Converts UTF-8 encoded string to UTF-16LE.
422419
*

0 commit comments

Comments
 (0)