Skip to content

Commit 37bc0e5

Browse files
boumenotdscho
authored andcommitted
mingw: delete call to ShellExecute for opening help.
The Windows flavor of git calls ShellExecute to view web pages. This call launches the default handler for .html files. The user is not able to configure an alternative despite git having full support for doing so on Windows. The original request for this change dates back to 12-May-2014, and refers to dropping commit 4804aab from the msysgit repository. This is exactly what this commit does.
1 parent 27df15d commit 37bc0e5

File tree

3 files changed

+0
-44
lines changed

3 files changed

+0
-44
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 & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,40 +2185,6 @@ int mingw_raise(int sig)
21852185
}
21862186

21872187

2188-
static const char *make_backslash_path(const char *path)
2189-
{
2190-
static char buf[PATH_MAX + 1];
2191-
char *c;
2192-
2193-
if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
2194-
die("Too long path: %.*s", 60, path);
2195-
2196-
for (c = buf; *c; c++) {
2197-
if (*c == '/')
2198-
*c = '\\';
2199-
}
2200-
return buf;
2201-
}
2202-
2203-
void mingw_open_html(const char *unixpath)
2204-
{
2205-
const char *htmlpath = make_backslash_path(unixpath);
2206-
int r;
2207-
DECLARE_PROC_ADDR(shell32.dll, HINSTANCE, ShellExecuteA,
2208-
HWND, LPCSTR, LPCSTR, LPCSTR, LPCSTR, INT);
2209-
2210-
if (!INIT_PROC_ADDR(ShellExecuteA))
2211-
die("cannot load shell32.dll");
2212-
2213-
printf("Launching default browser to display HTML ...\n");
2214-
r = HCAST(int, ShellExecuteA(NULL, "open", htmlpath,
2215-
NULL, "\\", SW_SHOWNORMAL));
2216-
/* see the MSDN documentation referring to the result codes here */
2217-
if (r <= 32) {
2218-
die("failed to launch browser for %.*s", MAX_PATH, unixpath);
2219-
}
2220-
}
2221-
22222188
int link(const char *oldpath, const char *newpath)
22232189
{
22242190
DECLARE_PROC_ADDR(kernel32.dll, BOOL, CreateHardLinkW,

compat/mingw.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,6 @@ extern char *mingw_query_user_email(void);
459459
#include <inttypes.h>
460460
#endif
461461

462-
void mingw_open_html(const char *path);
463-
#define open_html mingw_open_html
464-
465462
/**
466463
* Max length of long paths (exceeding MAX_PATH). The actual maximum supported
467464
* by NTFS is 32,767 (* sizeof(wchar_t)), but we choose an arbitrary smaller

0 commit comments

Comments
 (0)