Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Jun 20, 2024
1 parent e258908 commit c6144fa
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ CINNABAR_OBJECTS += regex.o
PATCHES = $(notdir $(wildcard $(SOURCE_DIR)/src/*.patch))

define patch
$1.patched.c: $$(SOURCE_DIR)/src/$1.c.patch $$(firstword $$(wildcard $$(SOURCE_DIR)/git-core/$1.c $$(SOURCE_DIR)/git-core/builtin/$1.c $$(SOURCE_DIR)/git-core/compat/win32/$1.c))
$1.patched.c: $$(SOURCE_DIR)/src/$1.c.patch $$(firstword $$(wildcard $$(SOURCE_DIR)/git-core/$1.c $$(SOURCE_DIR)/git-core/builtin/$1.c $$(SOURCE_DIR)/git-core/compat/$1.c $$(SOURCE_DIR)/git-core/compat/win32/$1.c))
patch -p1 -F0 -o $$@ $$(lastword $$^) < $$<
endef

Expand Down Expand Up @@ -99,7 +99,7 @@ missing_obj_dirs := $(filter-out $(wildcard $(obj_dirs)),$(obj_dirs))
$(ALL_CINNABAR_OBJECTS) $(LIB_OBJS) $(REFTABLE_OBJS) $(XDIFF_OBJS): $(missing_obj_dirs)
endif

PATCHED_GIT_OBJECTS := $(filter-out fast-import.patched.o,$(PATCHES:%.c.patch=%.patched.o))
PATCHED_GIT_OBJECTS := $(filter-out mingw.patched.o fast-import.patched.o,$(PATCHES:%.c.patch=%.patched.o))
ifeq (,$(filter compat/win32/fscache.o,$(LIB_OBJS)))
PATCHED_GIT_OBJECTS := $(filter-out fscache.patched.o,$(PATCHED_GIT_OBJECTS))
endif
Expand Down Expand Up @@ -137,6 +137,9 @@ linker-flags: GIT-LDFLAGS FORCE
$(CINNABAR_OBJECTS): %.o: $(SOURCE_DIR)/src/%.c
$(PATCHED_GIT_OBJECTS): %.o: %.c
cinnabar-fast-import.o: fast-import.patched.c
ifeq ($(uname_S),MINGW)
mingw.o: mingw.patched.c
endif
$(ALL_CINNABAR_OBJECTS): GIT-CFLAGS $(missing_dep_dirs)

$(ALL_CINNABAR_OBJECTS):
Expand Down
2 changes: 1 addition & 1 deletion src/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ static inline void winansi_init(void) {}
extern int cinnabar_main(int argc, const char *argv[]);
// Work around the function being declared despite NO_UNIX_SOCKETS.
int mingw_have_unix_sockets(void);
#include "compat/mingw.c"
#include "mingw.patched.c"
#else
typedef int make_pedantic_happy;
#endif
57 changes: 57 additions & 0 deletions src/mingw.c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
diff --git a/compat/mingw.c b/compat/mingw.c
index 303ffaa19f..e87f407f95 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1,30 +1,30 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
#include "win32.h"
#include <aclapi.h>
#include <sddl.h>
#include <conio.h>
#include <wchar.h>
#include <winioctl.h>
-#include "../strbuf.h"
-#include "../run-command.h"
-#include "../abspath.h"
-#include "../alloc.h"
+#include "strbuf.h"
+#include "run-command.h"
+#include "abspath.h"
+#include "alloc.h"
#include "win32/exit-process.h"
#include "win32/lazyload.h"
-#include "../config.h"
-#include "../environment.h"
-#include "../trace2.h"
-#include "../symlinks.h"
-#include "../wrapper.h"
+#include "config.h"
+#include "environment.h"
+#include "trace2.h"
+#include "symlinks.h"
+#include "wrapper.h"
#include "dir.h"
#include "gettext.h"
#define SECURITY_WIN32
#include <sspi.h>
-#include "../write-or-die.h"
-#include "../repository.h"
+#include "write-or-die.h"
+#include "repository.h"
#include "win32/fscache.h"
-#include "../attr.h"
-#include "../string-list.h"
+#include "attr.h"
+#include "string-list.h"
#include "win32/wsl.h"

#define HCAST(type, handle) ((type)(intptr_t)handle)
@@ -32,7 +32,6 @@
void open_in_gdb(void)
{
static struct child_process cp = CHILD_PROCESS_INIT;
- extern char *_pgmptr;

strvec_pushl(&cp.args, "mintty", "gdb", NULL);
strvec_pushf(&cp.args, "--pid=%d", getpid());

0 comments on commit c6144fa

Please sign in to comment.