{"thread":{"id":"20965","subject":"[PATCH 01/15] Avoid declaration after statement","startedAt":"2009-09-16T08:20:16Z","lastAt":"2009-09-25T13:34:50Z","messageCount":50,"participants":["Marius Storm-Olsen","Erik Faye-Lund","Johannes Sixt","Alexey Borzenkov","Junio C Hamano","Sebastian Schuberth","Johannes Schindelin","Frank Li"],"isPatch":true,"patchVersion":1,"patchTotal":15},"messages":[{"id":"123314","messageId":"cover.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":null,"subject":"[PATCH v4 00/15] Build Git with MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:16Z","receivedAt":"2009-09-16T08:20:16Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\n=== V4 2009.09.16 ===\n\n1) Removed the _fmode extern, and if(std*) statements, as pointed out\n   by Alexey Borzenkov.\n2) Renumbered the points in the compat/vcbuild/README (affects 2\n   patches), as pointed out by Thiago Farina.\n3) Added flag to lib command to invoke the Link Time Code Generation\n   to avoid warnings about restarting the libifier with this option.\n4) Added a patch to the end of the series, which tags the GIT_VERSION\n   with \".MSVC\", to ease debugging/problem solving on Windows, when we\n   start getting reports from both MSysGit and MSVCGit people.\n   NOTE: If people are OK with this patch, it should probably be\n   squashed into patch 12. If not, just skip it.\n\nThe overall difference between v4 and v3 of this series is rather small\nbut since it touches several patches due to context (thus conflicts\nappear), I push out a new version of the whole serie.\n\nv3 to v4 diff:\ndiff --git a/Makefile b/Makefile\nindex 761cef1..2c20922 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -878,6 +878,7 @@ ifneq (,$(findstring CYGWIN,$(uname_S)))\n \tUNRELIABLE_FSTAT = UnfortunatelyYes\n endif\n ifdef MSVC\n+\tGIT_VERSION := $(GIT_VERSION).MSVC\n \tpathsep = ;\n \tNO_PREAD = YesPlease\n \tNO_OPENSSL = YesPlease\n@@ -923,6 +924,7 @@ ifdef MSVC\n ifndef DEBUG\n \tBASIC_CFLAGS += -GL -Os -MT\n \tBASIC_LDFLAGS += -LTCG\n+\tAR += -LTCG\n else\n \tBASIC_CFLAGS += -Zi -MTd\n endif\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 544b576..5b5258b 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -229,20 +229,17 @@ void free_environ(char **env);\n \n /*\n  * A replacement of main() that ensures that argv[0] has a path\n+ * and that default fmode and std(in|out|err) are in binary mode\n  */\n \n-extern int _fmode;\n #define main(c,v) dummy_decl_mingw_main(); \\\n static int mingw_main(); \\\n int main(int argc, const char **argv) \\\n { \\\n \t_fmode = _O_BINARY; \\\n-\tif (stdin) \\\n-\t\t_setmode(_fileno(stdin), _O_BINARY); \\\n-\tif (stdout) \\\n-\t\t_setmode(_fileno(stdout), _O_BINARY); \\\n-\tif (stderr) \\\n-\t\t_setmode(_fileno(stderr), _O_BINARY); \\\n+\t_setmode(_fileno(stdin), _O_BINARY); \\\n+\t_setmode(_fileno(stdout), _O_BINARY); \\\n+\t_setmode(_fileno(stderr), _O_BINARY); \\\n \targv[0] = xstrdup(_pgmptr); \\\n \treturn mingw_main(argc, argv); \\\n } \\\ndiff --git a/compat/vcbuild/README b/compat/vcbuild/README\nindex e64f7e5..df8a657 100644\n--- a/compat/vcbuild/README\n+++ b/compat/vcbuild/README\n@@ -29,11 +29,11 @@ The Steps of Build Git with VS2008\n    executables, since Git might need to run scripts which are part of\n    the git operations.\n \n-4. Inside Git's directory run the command:\n+3. Inside Git's directory run the command:\n        make common-cmds.h\n    to generate the common-cmds.h file needed to compile git.\n \n-5. Then either build Git with the GNU Make Makefile in the Git projects\n+4. Then either build Git with the GNU Make Makefile in the Git projects\n    root\n        make MSVC=1\n    or generate Visual Studio solution/projects (.sln/.vcproj) with the\n-- \nEOD\n\n=== V3 2009.09.15 ===\n\n1) Reworded patch 01: s/Microsoft Visual C++/MSVC/\n2) Nuked patch 02\n3) Merged patch 03 into path 08\n4) Rewrote patch 06 to set _fmode instead for both MinGW and MSVC\n5) Fix patch 07 to use __stdcall for thread functions instead of WINAPI\n6) Rewrote patch 14 to rather use a define to _chsize\n7) Fix patch 15 to use \"-o $@\" instead of \"-o git.o\"\n\nThink that's it..\n\n=== V2 2009.09.14 ===\n\nHere's a second roll of the series for supporting compilation of Git\nusing Visual C++ (MSVC). (Sorry for the long delay on a followup, time\nis in short supply these days)\n\nThere's no guarantee that the compiled result will work as well as the\ncurrent MinGW compile, or at all. However, I think it's important to\nget the Git repo to a compilable state with MSVC as quickly as\npossible, to further enable contributions from the Windows developers\nwhich we are sorely lacking at the moment.\nI hope that a repo which compiles successfully with the tools they are\naccustomed to (also a very good debugger) will entice them to send more\npatches.\n\nIn addition to this series, I have also setup a repo with binaries of\nthe required libs to compile Git with MSVC. Only 32bit versions for now.\nSo, the developer can choose to either use that, or Frank's source code\nrepo to build Git with MSVC. You'll find the binary repo here:\n    http://repo.or.cz/w/msvcgit.git\n\nNote that the binaries will still require the msysgit environment for\nexecution, due to the non-binary components of Git. (Scripts, gitk,\ngit-gui, etc). You'll find that repo here:\n    http://repo.or.cz/w/msysgit.git\n\n1) Rebased ontop on current git.git 'next'.\n2) Fixed code and commit msgs based on the previous feedback.\n   Let me know if I forgot anything!\n3) Added a proper Makefile patch for MSVC support.\n   You now compile with 'make MSVC=1'.\n4) Added perl scripts (contrib) which uses GNU Make output to generate\n   MSVC IDE (.sln & .vcproj) projects and QMake projects, and picking\n   up the project settings from the Makefile, so it's all in one place.\n5) Added necessary patches to make things compile ontop of current\n   'next'.\n\n=== V1 2009.08.21 ===\nSo, Frank Li started this series, and I took it upon my self to help\nout a bit; cleaning, reorganizing, rebasing the series. Hopefully\nwe're now a bit closer to including the series into mainline..\n\nHere's a summary of what has happend:\n1) This series is rebased ontop of git.git 'next', which needed an\n   extra patch to avoid a non-constant array creation, which\n   mscv doesn't like.\n2) I've polished (tied to anyways) the commit messages a bit.\n3) I've applied much of the feedback provided to the first round of\n   the patches.\n4) I've split, merged and reordered some of the patches, so things\n   that belong together are in the same commits, and in a order of\n   'importance'\n5) I've removed the\n       #define func _func\n   stuff, as it's not needed and Microsoft cannot really kill the\n   compatibility functions anyways. So, adding the define\n       _CRT_NONSTDC_NO_DEPRECATE\n   will kill the warnings seen without the defines above.\n6) ..probably much more as well, but I forget..\n\nNote: I did not sign off on the last two commits, which involve the\nadding of the vcproj files, since I don't agree on adding them as is.\nWe need a Makefile way of compiling primarily, and second, a script\nto generate the vcproj, as already discussed. But the commits are\nincluded for completeness, at to let others compile and play with it.\n\nI've kept the original author as is, and just signed the patches..\nThanks for watching, now bring on the comments!\n\nFrank Li (6):\n  Avoid declaration after statement\n  Change regerror() declaration from K&R style to ANSI C (C89)\n  Fix __stdcall placement and function prototype\n  Test for WIN32 instead of __MINGW32_\n  Add MinGW header files to build git with MSVC\n  Add platform files for MSVC porting\n\nMarius Storm-Olsen (9):\n  Add define guards to compat/win32.h\n  Set _O_BINARY as default fmode for both MinGW and MSVC\n  Add empty header files for MSVC port\n  Make usage of windows.h lean and mean\n  Define strncasecmp and ftruncate for MSVC\n  Add MSVC to Makefile\n  Add README for MSVC build\n  Add scripts to generate projects for other buildsystems (MSVC vcproj,\n    QMake)\n  Tag GIT_VERSION when Git is built with MSVC\n\n .gitignore                                |   11 +\n Makefile                                  |   56 +++-\n compat/mingw.c                            |   20 +-\n compat/mingw.h                            |    7 +\n compat/msvc.c                             |   35 ++\n compat/msvc.h                             |   50 +++\n compat/regex/regex.c                      |    7 +-\n compat/snprintf.c                         |   10 +-\n compat/vcbuild/README                     |   50 +++\n compat/vcbuild/include/alloca.h           |    1 +\n compat/vcbuild/include/arpa/inet.h        |    1 +\n compat/vcbuild/include/dirent.h           |  128 ++++++\n compat/vcbuild/include/grp.h              |    1 +\n compat/vcbuild/include/inttypes.h         |    1 +\n compat/vcbuild/include/netdb.h            |    1 +\n compat/vcbuild/include/netinet/in.h       |    1 +\n compat/vcbuild/include/netinet/tcp.h      |    1 +\n compat/vcbuild/include/pwd.h              |    1 +\n compat/vcbuild/include/sys/ioctl.h        |    1 +\n compat/vcbuild/include/sys/param.h        |    1 +\n compat/vcbuild/include/sys/poll.h         |    1 +\n compat/vcbuild/include/sys/select.h       |    1 +\n compat/vcbuild/include/sys/socket.h       |    1 +\n compat/vcbuild/include/sys/time.h         |    1 +\n compat/vcbuild/include/sys/utime.h        |   34 ++\n compat/vcbuild/include/sys/wait.h         |    1 +\n compat/vcbuild/include/unistd.h           |   92 ++++\n compat/vcbuild/include/utime.h            |    1 +\n compat/vcbuild/scripts/clink.pl           |   48 +++\n compat/vcbuild/scripts/lib.pl             |   26 ++\n compat/win32.h                            |    7 +\n compat/winansi.c                          |    1 -\n contrib/buildsystems/Generators.pm        |   42 ++\n contrib/buildsystems/Generators/QMake.pm  |  189 +++++++++\n contrib/buildsystems/Generators/Vcproj.pm |  639 +++++++++++++++++++++++++++++\n contrib/buildsystems/engine.pl            |  353 ++++++++++++++++\n contrib/buildsystems/generate             |   29 ++\n contrib/buildsystems/parse.pl             |  228 ++++++++++\n git-compat-util.h                         |    9 +\n help.c                                    |    5 +-\n pager.c                                   |    4 +-\n run-command.c                             |   12 +-\n run-command.h                             |    2 +-\n setup.c                                   |    2 +-\n thread-utils.c                            |    5 +-\n 45 files changed, 2084 insertions(+), 33 deletions(-)\n create mode 100644 compat/msvc.c\n create mode 100644 compat/msvc.h\n create mode 100644 compat/vcbuild/README\n create mode 100644 compat/vcbuild/include/alloca.h\n create mode 100644 compat/vcbuild/include/arpa/inet.h\n create mode 100644 compat/vcbuild/include/dirent.h\n create mode 100644 compat/vcbuild/include/grp.h\n create mode 100644 compat/vcbuild/include/inttypes.h\n create mode 100644 compat/vcbuild/include/netdb.h\n create mode 100644 compat/vcbuild/include/netinet/in.h\n create mode 100644 compat/vcbuild/include/netinet/tcp.h\n create mode 100644 compat/vcbuild/include/pwd.h\n create mode 100644 compat/vcbuild/include/sys/ioctl.h\n create mode 100644 compat/vcbuild/include/sys/param.h\n create mode 100644 compat/vcbuild/include/sys/poll.h\n create mode 100644 compat/vcbuild/include/sys/select.h\n create mode 100644 compat/vcbuild/include/sys/socket.h\n create mode 100644 compat/vcbuild/include/sys/time.h\n create mode 100644 compat/vcbuild/include/sys/utime.h\n create mode 100644 compat/vcbuild/include/sys/wait.h\n create mode 100644 compat/vcbuild/include/unistd.h\n create mode 100644 compat/vcbuild/include/utime.h\n create mode 100644 compat/vcbuild/scripts/clink.pl\n create mode 100644 compat/vcbuild/scripts/lib.pl\n create mode 100644 contrib/buildsystems/Generators.pm\n create mode 100644 contrib/buildsystems/Generators/QMake.pm\n create mode 100644 contrib/buildsystems/Generators/Vcproj.pm\n create mode 100644 contrib/buildsystems/engine.pl\n create mode 100644 contrib/buildsystems/generate\n create mode 100644 contrib/buildsystems/parse.pl\n"},{"id":"123311","messageId":"213f3c7799721c3f42ffa689498175f0495048eb.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"cover.1253088099.git.mstormo@gmail.com","subject":"[PATCH 01/15] Avoid declaration after statement","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:17Z","receivedAt":"2009-09-16T08:20:17Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Frank Li <lznuaa@gmail.com>\n\nMSVC does not understand this C99 style\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/mingw.c |   14 ++++++++++----\n help.c         |    3 ++-\n run-command.c  |    2 ++\n 3 files changed, 14 insertions(+), 5 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 36ef8d3..5478b74 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -123,13 +123,17 @@ int mingw_open (const char *filename, int oflags, ...)\n {\n \tva_list args;\n \tunsigned mode;\n+\tint fd;\n+\n \tva_start(args, oflags);\n \tmode = va_arg(args, int);\n \tva_end(args);\n \n \tif (!strcmp(filename, \"/dev/null\"))\n \t\tfilename = \"nul\";\n-\tint fd = open(filename, oflags, mode);\n+\n+\tfd = open(filename, oflags, mode);\n+\n \tif (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {\n \t\tDWORD attrs = GetFileAttributes(filename);\n \t\tif (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))\n@@ -580,10 +584,11 @@ static char **get_path_split(void)\n \n static void free_path_split(char **path)\n {\n+\tchar **p = path;\n+\n \tif (!path)\n \t\treturn;\n \n-\tchar **p = path;\n \twhile (*p)\n \t\tfree(*p++);\n \tfree(path);\n@@ -1120,9 +1125,9 @@ int sigaction(int sig, struct sigaction *in, struct sigaction *out)\n #undef signal\n sig_handler_t mingw_signal(int sig, sig_handler_t handler)\n {\n+\tsig_handler_t old = timer_fn;\n \tif (sig != SIGALRM)\n \t\treturn signal(sig, handler);\n-\tsig_handler_t old = timer_fn;\n \ttimer_fn = handler;\n \treturn old;\n }\n@@ -1209,8 +1214,9 @@ struct dirent *mingw_readdir(DIR *dir)\n \n \tif (dir->dd_handle == (long)INVALID_HANDLE_VALUE && dir->dd_stat == 0)\n \t{\n+\t\tDWORD lasterr;\n \t\thandle = FindFirstFileA(dir->dd_name, &buf);\n-\t\tDWORD lasterr = GetLastError();\n+\t\tlasterr = GetLastError();\n \t\tdir->dd_handle = (long)handle;\n \t\tif (handle == INVALID_HANDLE_VALUE && (lasterr != ERROR_NO_MORE_FILES)) {\n \t\t\terrno = err_win_to_posix(lasterr);\ndiff --git a/help.c b/help.c\nindex 294337e..fd51b8e 100644\n--- a/help.c\n+++ b/help.c\n@@ -127,7 +127,7 @@ static int is_executable(const char *name)\n \t\treturn 0;\n \n #ifdef __MINGW32__\n-\t/* cannot trust the executable bit, peek into the file instead */\n+{\t/* cannot trust the executable bit, peek into the file instead */\n \tchar buf[3] = { 0 };\n \tint n;\n \tint fd = open(name, O_RDONLY);\n@@ -140,6 +140,7 @@ static int is_executable(const char *name)\n \t\t\t\tst.st_mode |= S_IXUSR;\n \t\tclose(fd);\n \t}\n+}\n #endif\n \treturn st.st_mode & S_IXUSR;\n }\ndiff --git a/run-command.c b/run-command.c\nindex ac314a5..02aaedf 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -134,6 +134,7 @@ fail_pipe:\n \t\terror(\"cannot fork() for %s: %s\", cmd->argv[0],\n \t\t\tstrerror(failed_errno = errno));\n #else\n+{\n \tint s0 = -1, s1 = -1, s2 = -1;\t/* backups of stdin, stdout, stderr */\n \tconst char **sargv = cmd->argv;\n \tchar **env = environ;\n@@ -197,6 +198,7 @@ fail_pipe:\n \t\tdup2(s1, 1), close(s1);\n \tif (s2 >= 0)\n \t\tdup2(s2, 2), close(s2);\n+}\n #endif\n \n \tif (cmd->pid < 0) {\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123312","messageId":"26c067500d8adf17a2d75e2956e4d4a6cef27fc1.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"213f3c7799721c3f42ffa689498175f0495048eb.1253088099.git.mstormo@gmail.com","subject":"[PATCH 02/15] Add define guards to compat/win32.h","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:18Z","receivedAt":"2009-09-16T08:20:18Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/win32.h |    5 +++++\n 1 files changed, 5 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/win32.h b/compat/win32.h\nindex c26384e..e8c178d 100644\n--- a/compat/win32.h\n+++ b/compat/win32.h\n@@ -1,3 +1,6 @@\n+#ifndef WIN32_H\n+#define WIN32_H\n+\n /* common Win32 functions for MinGW and Cygwin */\n #include <windows.h>\n \n@@ -32,3 +35,5 @@ static inline int get_file_attr(const char *fname, WIN32_FILE_ATTRIBUTE_DATA *fd\n \t\treturn ENOENT;\n \t}\n }\n+\n+#endif\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123316","messageId":"6e6345fb3fbc19b1a2467e33e1633fe9025e547b.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"26c067500d8adf17a2d75e2956e4d4a6cef27fc1.1253088099.git.mstormo@gmail.com","subject":"[PATCH 03/15] Change regerror() declaration from K&R style to ANSI C (C89)","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:19Z","receivedAt":"2009-09-16T08:20:19Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Frank Li <lznuaa@gmail.com>\n\nThe MSVC headers typedef errcode as int, and thus confused the\ncompiler in the K&R style definition. ANSI style deconfuses it.\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/regex/regex.c |    7 ++-----\n 1 files changed, 2 insertions(+), 5 deletions(-)\n\ndiff --git a/compat/regex/regex.c b/compat/regex/regex.c\nindex 5ea0075..67d5c37 100644\n--- a/compat/regex/regex.c\n+++ b/compat/regex/regex.c\n@@ -4852,11 +4852,8 @@ regexec (preg, string, nmatch, pmatch, eflags)\n    from either regcomp or regexec.   We don't use PREG here.  */\n \n size_t\n-regerror (errcode, preg, errbuf, errbuf_size)\n-    int errcode;\n-    const regex_t *preg;\n-    char *errbuf;\n-    size_t errbuf_size;\n+regerror(int errcode, const regex_t *preg,\n+\t char *errbuf, size_t errbuf_size)\n {\n   const char *msg;\n   size_t msg_size;\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123313","messageId":"929c5a34cd2621af24bcda7e47ff2e76b51c2e09.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"6e6345fb3fbc19b1a2467e33e1633fe9025e547b.1253088099.git.mstormo@gmail.com","subject":"[PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:20Z","receivedAt":"2009-09-16T08:20:20Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Marius Storm-Olsen <marius.storm-olsen@nokia.com>\n\nMinGW set the _CRT_fmode to set both the default fmode and\n_O_BINARY on stdin/stdout/stderr. Rather use the main()\ndefine in mingw.h to set this for both MinGW and MSVC.\n\nThis will ensure that a MinGW and MSVC build will handle\ninput and output identically.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/mingw.c |    2 --\n compat/mingw.h |    5 +++++\n 2 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 5478b74..5a8fae8 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3,8 +3,6 @@\n #include <conio.h>\n #include \"../strbuf.h\"\n \n-unsigned int _CRT_fmode = _O_BINARY;\n-\n static int err_win_to_posix(DWORD winerr)\n {\n \tint error = ENOSYS;\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex c43917c..bcd23b0 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -227,12 +227,17 @@ void free_environ(char **env);\n \n /*\n  * A replacement of main() that ensures that argv[0] has a path\n+ * and that default fmode and std(in|out|err) are in binary mode\n  */\n \n #define main(c,v) dummy_decl_mingw_main(); \\\n static int mingw_main(); \\\n int main(int argc, const char **argv) \\\n { \\\n+\t_fmode = _O_BINARY; \\\n+\t_setmode(_fileno(stdin), _O_BINARY); \\\n+\t_setmode(_fileno(stdout), _O_BINARY); \\\n+\t_setmode(_fileno(stderr), _O_BINARY); \\\n \targv[0] = xstrdup(_pgmptr); \\\n \treturn mingw_main(argc, argv); \\\n } \\\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123315","messageId":"eec2b652c5a8e3e21348a8211d336fce66cb21a5.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"929c5a34cd2621af24bcda7e47ff2e76b51c2e09.1253088099.git.mstormo@gmail.com","subject":"[PATCH 05/15] Fix __stdcall placement and function prototype","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:21Z","receivedAt":"2009-09-16T08:20:21Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Frank Li <lznuaa@gmail.com>\n\nMSVC requires __stdcall to be between the functions return value and\nthe function name, and that the function pointer type is in the form\nof\n    return_type (WINAPI *function_name)(arguments...)\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/mingw.c |    4 ++--\n run-command.c  |    2 +-\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 5a8fae8..34ee427 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -1027,7 +1027,7 @@ static sig_handler_t timer_fn = SIG_DFL;\n  * length to call the signal handler.\n  */\n \n-static __stdcall unsigned ticktack(void *dummy)\n+static unsigned __stdcall ticktack(void *dummy)\n {\n \twhile (WaitForSingleObject(timer_event, timer_interval) == WAIT_TIMEOUT) {\n \t\tif (timer_fn == SIG_DFL)\n@@ -1154,7 +1154,7 @@ void mingw_open_html(const char *unixpath)\n \n int link(const char *oldpath, const char *newpath)\n {\n-\ttypedef BOOL WINAPI (*T)(const char*, const char*, LPSECURITY_ATTRIBUTES);\n+\ttypedef BOOL (WINAPI *T)(const char*, const char*, LPSECURITY_ATTRIBUTES);\n \tstatic T create_hard_link = NULL;\n \tif (!create_hard_link) {\n \t\tcreate_hard_link = (T) GetProcAddress(\ndiff --git a/run-command.c b/run-command.c\nindex 02aaedf..bb76750 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -316,7 +316,7 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const\n }\n \n #ifdef __MINGW32__\n-static __stdcall unsigned run_thread(void *data)\n+static unsigned __stdcall run_thread(void *data)\n {\n \tstruct async *async = data;\n \treturn async->proc(async->fd_for_proc, async->data);\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123317","messageId":"28e3400f29353cf8f93b4ca054b87f083f9e33e1.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"eec2b652c5a8e3e21348a8211d336fce66cb21a5.1253088099.git.mstormo@gmail.com","subject":"[PATCH 06/15] Test for WIN32 instead of __MINGW32_","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:22Z","receivedAt":"2009-09-16T08:20:22Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Frank Li <lznuaa@gmail.com>\n\nThe code which is conditional on MinGW32 is actually conditional on Windows.\nUse the WIN32 symbol, which is defined by the MINGW32 and MSVC environments,\nbut not by Cygwin.\n\nDefine SNPRINTF_SIZE_CORR=1 for MSVC too, as its vsnprintf function does\nnot add NUL at the end of the buffer if the result fits the buffer size\nexactly.\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/snprintf.c |   10 ++++++----\n help.c            |    2 +-\n pager.c           |    4 ++--\n run-command.c     |    8 ++++----\n run-command.h     |    2 +-\n setup.c           |    2 +-\n 6 files changed, 15 insertions(+), 13 deletions(-)\n\ndiff --git a/compat/snprintf.c b/compat/snprintf.c\nindex 4d07087..e1e0e75 100644\n--- a/compat/snprintf.c\n+++ b/compat/snprintf.c\n@@ -2,12 +2,14 @@\n \n /*\n  * The size parameter specifies the available space, i.e. includes\n- * the trailing NUL byte; but Windows's vsnprintf expects the\n- * number of characters to write, and does not necessarily write the\n- * trailing NUL.\n+ * the trailing NUL byte; but Windows's vsnprintf uses the entire\n+ * buffer and avoids the trailing NUL, should the buffer be exactly\n+ * big enough for the result. Defining SNPRINTF_SIZE_CORR to 1 will\n+ * therefore remove 1 byte from the reported buffer size, so we\n+ * always have room for a trailing NUL byte.\n  */\n #ifndef SNPRINTF_SIZE_CORR\n-#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 4\n+#if defined(WIN32) && (!defined(__GNUC__) || __GNUC__ < 4)\n #define SNPRINTF_SIZE_CORR 1\n #else\n #define SNPRINTF_SIZE_CORR 0\ndiff --git a/help.c b/help.c\nindex fd51b8e..e8db31f 100644\n--- a/help.c\n+++ b/help.c\n@@ -126,7 +126,7 @@ static int is_executable(const char *name)\n \t    !S_ISREG(st.st_mode))\n \t\treturn 0;\n \n-#ifdef __MINGW32__\n+#ifdef WIN32\n {\t/* cannot trust the executable bit, peek into the file instead */\n \tchar buf[3] = { 0 };\n \tint n;\ndiff --git a/pager.c b/pager.c\nindex f416d38..86facec 100644\n--- a/pager.c\n+++ b/pager.c\n@@ -9,7 +9,7 @@\n \n static int spawned_pager;\n \n-#ifndef __MINGW32__\n+#ifndef WIN32\n static void pager_preexec(void)\n {\n \t/*\n@@ -72,7 +72,7 @@ void setup_pager(void)\n \t\tstatic const char *env[] = { \"LESS=FRSX\", NULL };\n \t\tpager_process.env = env;\n \t}\n-#ifndef __MINGW32__\n+#ifndef WIN32\n \tpager_process.preexec_cb = pager_preexec;\n #endif\n \tif (start_command(&pager_process))\ndiff --git a/run-command.c b/run-command.c\nindex bb76750..cf2d8f7 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -75,7 +75,7 @@ fail_pipe:\n \n \ttrace_argv_printf(cmd->argv, \"trace: run_command:\");\n \n-#ifndef __MINGW32__\n+#ifndef WIN32\n \tfflush(NULL);\n \tcmd->pid = fork();\n \tif (!cmd->pid) {\n@@ -315,7 +315,7 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const\n \treturn run_command(&cmd);\n }\n \n-#ifdef __MINGW32__\n+#ifdef WIN32\n static unsigned __stdcall run_thread(void *data)\n {\n \tstruct async *async = data;\n@@ -331,7 +331,7 @@ int start_async(struct async *async)\n \t\treturn error(\"cannot create pipe: %s\", strerror(errno));\n \tasync->out = pipe_out[0];\n \n-#ifndef __MINGW32__\n+#ifndef WIN32\n \t/* Flush stdio before fork() to avoid cloning buffers */\n \tfflush(NULL);\n \n@@ -360,7 +360,7 @@ int start_async(struct async *async)\n \n int finish_async(struct async *async)\n {\n-#ifndef __MINGW32__\n+#ifndef WIN32\n \tint ret = wait_or_whine(async->pid, \"child process\", 0);\n #else\n \tDWORD ret = 0;\ndiff --git a/run-command.h b/run-command.h\nindex 0c00b25..fb34209 100644\n--- a/run-command.h\n+++ b/run-command.h\n@@ -70,7 +70,7 @@ struct async {\n \tint (*proc)(int fd, void *data);\n \tvoid *data;\n \tint out;\t/* caller reads from here and closes it */\n-#ifndef __MINGW32__\n+#ifndef WIN32\n \tpid_t pid;\n #else\n \tHANDLE tid;\ndiff --git a/setup.c b/setup.c\nindex e3781b6..029371e 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -41,7 +41,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)\n const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)\n {\n \tstatic char path[PATH_MAX];\n-#ifndef __MINGW32__\n+#ifndef WIN32\n \tif (!pfx || !*pfx || is_absolute_path(arg))\n \t\treturn arg;\n \tmemcpy(path, pfx, pfx_len);\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123323","messageId":"8f578bb08bf5663a8ce5b02e3e4f77727692c501.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"28e3400f29353cf8f93b4ca054b87f083f9e33e1.1253088099.git.mstormo@gmail.com","subject":"[PATCH 07/15] Add empty header files for MSVC port","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:23Z","receivedAt":"2009-09-16T08:20:23Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nMSVC lacks many of the header files included by git-compat-util.h,\nso add blank header files for these instead of going ifdef crazy.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/vcbuild/include/arpa/inet.h   |    1 +\n compat/vcbuild/include/grp.h         |    1 +\n compat/vcbuild/include/inttypes.h    |    1 +\n compat/vcbuild/include/netdb.h       |    1 +\n compat/vcbuild/include/netinet/in.h  |    1 +\n compat/vcbuild/include/netinet/tcp.h |    1 +\n compat/vcbuild/include/pwd.h         |    1 +\n compat/vcbuild/include/sys/ioctl.h   |    1 +\n compat/vcbuild/include/sys/param.h   |    1 +\n compat/vcbuild/include/sys/poll.h    |    1 +\n compat/vcbuild/include/sys/select.h  |    1 +\n compat/vcbuild/include/sys/socket.h  |    1 +\n compat/vcbuild/include/sys/time.h    |    1 +\n compat/vcbuild/include/sys/wait.h    |    1 +\n 14 files changed, 14 insertions(+), 0 deletions(-)\n create mode 100644 compat/vcbuild/include/arpa/inet.h\n create mode 100644 compat/vcbuild/include/grp.h\n create mode 100644 compat/vcbuild/include/inttypes.h\n create mode 100644 compat/vcbuild/include/netdb.h\n create mode 100644 compat/vcbuild/include/netinet/in.h\n create mode 100644 compat/vcbuild/include/netinet/tcp.h\n create mode 100644 compat/vcbuild/include/pwd.h\n create mode 100644 compat/vcbuild/include/sys/ioctl.h\n create mode 100644 compat/vcbuild/include/sys/param.h\n create mode 100644 compat/vcbuild/include/sys/poll.h\n create mode 100644 compat/vcbuild/include/sys/select.h\n create mode 100644 compat/vcbuild/include/sys/socket.h\n create mode 100644 compat/vcbuild/include/sys/time.h\n create mode 100644 compat/vcbuild/include/sys/wait.h\n\ndiff --git a/compat/vcbuild/include/arpa/inet.h b/compat/vcbuild/include/arpa/inet.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/arpa/inet.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/grp.h b/compat/vcbuild/include/grp.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/grp.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/inttypes.h b/compat/vcbuild/include/inttypes.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/inttypes.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/netdb.h b/compat/vcbuild/include/netdb.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/netdb.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/netinet/in.h b/compat/vcbuild/include/netinet/in.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/netinet/in.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/netinet/tcp.h b/compat/vcbuild/include/netinet/tcp.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/netinet/tcp.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/pwd.h b/compat/vcbuild/include/pwd.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/pwd.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/ioctl.h b/compat/vcbuild/include/sys/ioctl.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/ioctl.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/param.h b/compat/vcbuild/include/sys/param.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/param.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/poll.h b/compat/vcbuild/include/sys/poll.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/poll.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/select.h b/compat/vcbuild/include/sys/select.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/select.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/socket.h b/compat/vcbuild/include/sys/socket.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/socket.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/time.h b/compat/vcbuild/include/sys/time.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/time.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/wait.h b/compat/vcbuild/include/sys/wait.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/wait.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123319","messageId":"7afd55f9b2f0f7859f757c715034cc3520e07f0e.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"8f578bb08bf5663a8ce5b02e3e4f77727692c501.1253088099.git.mstormo@gmail.com","subject":"[PATCH 08/15] Add MinGW header files to build git with MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:24Z","receivedAt":"2009-09-16T08:20:24Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Frank Li <lznuaa@gmail.com>\n\nAdded the header files dirent.h, unistd.h and utime.h\nAdd alloca.h, which simply includes malloc.h, which defines alloca\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/vcbuild/include/alloca.h    |    1 +\n compat/vcbuild/include/dirent.h    |  128 ++++++++++++++++++++++++++++++++++++\n compat/vcbuild/include/sys/utime.h |   34 ++++++++++\n compat/vcbuild/include/unistd.h    |   92 ++++++++++++++++++++++++++\n compat/vcbuild/include/utime.h     |    1 +\n 5 files changed, 256 insertions(+), 0 deletions(-)\n create mode 100644 compat/vcbuild/include/alloca.h\n create mode 100644 compat/vcbuild/include/dirent.h\n create mode 100644 compat/vcbuild/include/sys/utime.h\n create mode 100644 compat/vcbuild/include/unistd.h\n create mode 100644 compat/vcbuild/include/utime.h\n\ndiff --git a/compat/vcbuild/include/alloca.h b/compat/vcbuild/include/alloca.h\nnew file mode 100644\nindex 0000000..c0d7985\n--- /dev/null\n+++ b/compat/vcbuild/include/alloca.h\n@@ -0,0 +1 @@\n+#include <malloc.h>\ndiff --git a/compat/vcbuild/include/dirent.h b/compat/vcbuild/include/dirent.h\nnew file mode 100644\nindex 0000000..440618d\n--- /dev/null\n+++ b/compat/vcbuild/include/dirent.h\n@@ -0,0 +1,128 @@\n+/*\n+ * DIRENT.H (formerly DIRLIB.H)\n+ * This file has no copyright assigned and is placed in the Public Domain.\n+ * This file is a part of the mingw-runtime package.\n+ *\n+ * The mingw-runtime package and its code is distributed in the hope that it\n+ * will be useful but WITHOUT ANY WARRANTY.  ALL WARRANTIES, EXPRESSED OR\n+ * IMPLIED ARE HEREBY DISCLAIMED.  This includes but is not limited to\n+ * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n+ *\n+ * You are free to use this package and its code without limitation.\n+ */\n+#ifndef _DIRENT_H_\n+#define _DIRENT_H_\n+#include <io.h>\n+\n+#define PATH_MAX 512\n+\n+#define __MINGW_NOTHROW\n+\n+#ifndef RC_INVOKED\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+struct dirent\n+{\n+\tlong\t\td_ino;\t\t/* Always zero. */\n+\tunsigned short\td_reclen;\t/* Always zero. */\n+\tunsigned short\td_namlen;\t/* Length of name in d_name. */\n+\tchar\t\td_name[FILENAME_MAX]; /* File name. */\n+};\n+\n+/*\n+ * This is an internal data structure. Good programmers will not use it\n+ * except as an argument to one of the functions below.\n+ * dd_stat field is now int (was short in older versions).\n+ */\n+typedef struct\n+{\n+\t/* disk transfer area for this dir */\n+\tstruct _finddata_t\tdd_dta;\n+\n+\t/* dirent struct to return from dir (NOTE: this makes this thread\n+\t * safe as long as only one thread uses a particular DIR struct at\n+\t * a time) */\n+\tstruct dirent\t\tdd_dir;\n+\n+\t/* _findnext handle */\n+\tlong\t\t\tdd_handle;\n+\n+\t/*\n+\t * Status of search:\n+\t *   0 = not started yet (next entry to read is first entry)\n+\t *  -1 = off the end\n+\t *   positive = 0 based index of next entry\n+\t */\n+\tint\t\t\tdd_stat;\n+\n+\t/* given path for dir with search pattern (struct is extended) */\n+\tchar\t\t\tdd_name[PATH_MAX+3];\n+} DIR;\n+\n+DIR* __cdecl __MINGW_NOTHROW opendir (const char*);\n+struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*);\n+int __cdecl __MINGW_NOTHROW closedir (DIR*);\n+void __cdecl __MINGW_NOTHROW rewinddir (DIR*);\n+long __cdecl __MINGW_NOTHROW telldir (DIR*);\n+void __cdecl __MINGW_NOTHROW seekdir (DIR*, long);\n+\n+\n+/* wide char versions */\n+\n+struct _wdirent\n+{\n+\tlong\t\td_ino;\t\t/* Always zero. */\n+\tunsigned short\td_reclen;\t/* Always zero. */\n+\tunsigned short\td_namlen;\t/* Length of name in d_name. */\n+\twchar_t\t\td_name[FILENAME_MAX]; /* File name. */\n+};\n+\n+/*\n+ * This is an internal data structure. Good programmers will not use it\n+ * except as an argument to one of the functions below.\n+ */\n+typedef struct\n+{\n+\t/* disk transfer area for this dir */\n+\t//struct _wfinddata_t\tdd_dta;\n+\n+\t/* dirent struct to return from dir (NOTE: this makes this thread\n+\t * safe as long as only one thread uses a particular DIR struct at\n+\t * a time) */\n+\tstruct _wdirent\t\tdd_dir;\n+\n+\t/* _findnext handle */\n+\tlong\t\t\tdd_handle;\n+\n+\t/*\n+\t * Status of search:\n+\t *   0 = not started yet (next entry to read is first entry)\n+\t *  -1 = off the end\n+\t *   positive = 0 based index of next entry\n+\t */\n+\tint\t\t\tdd_stat;\n+\n+\t/* given path for dir with search pattern (struct is extended) */\n+\twchar_t\t\t\tdd_name[1];\n+} _WDIR;\n+\n+\n+\n+_WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*);\n+struct _wdirent*  __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*);\n+int __cdecl __MINGW_NOTHROW _wclosedir (_WDIR*);\n+void __cdecl __MINGW_NOTHROW _wrewinddir (_WDIR*);\n+long __cdecl __MINGW_NOTHROW _wtelldir (_WDIR*);\n+void __cdecl __MINGW_NOTHROW _wseekdir (_WDIR*, long);\n+\n+\n+#ifdef\t__cplusplus\n+}\n+#endif\n+\n+#endif\t/* Not RC_INVOKED */\n+\n+#endif\t/* Not _DIRENT_H_ */\ndiff --git a/compat/vcbuild/include/sys/utime.h b/compat/vcbuild/include/sys/utime.h\nnew file mode 100644\nindex 0000000..582589c\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/utime.h\n@@ -0,0 +1,34 @@\n+#ifndef\t_UTIME_H_\n+#define\t_UTIME_H_\n+/*\n+ * UTIME.H\n+ * This file has no copyright assigned and is placed in the Public Domain.\n+ * This file is a part of the mingw-runtime package.\n+ *\n+ * The mingw-runtime package and its code is distributed in the hope that it\n+ * will be useful but WITHOUT ANY WARRANTY.  ALL WARRANTIES, EXPRESSED OR\n+ * IMPLIED ARE HEREBY DISCLAIMED.  This includes but is not limited to\n+ * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n+ *\n+ * You are free to use this package and its code without limitation.\n+ */\n+\n+/*\n+ * Structure used by _utime function.\n+ */\n+struct _utimbuf\n+{\n+\ttime_t\tactime;\t\t/* Access time */\n+\ttime_t\tmodtime;\t/* Modification time */\n+};\n+\n+#ifndef\t_NO_OLDNAMES\n+/* NOTE: Must be the same as _utimbuf above. */\n+struct utimbuf\n+{\n+\ttime_t\tactime;\n+\ttime_t\tmodtime;\n+};\n+#endif\t/* Not _NO_OLDNAMES */\n+\n+#endif\ndiff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h\nnew file mode 100644\nindex 0000000..2a4f276\n--- /dev/null\n+++ b/compat/vcbuild/include/unistd.h\n@@ -0,0 +1,92 @@\n+#ifndef _UNISTD_\n+#define _UNISTD_\n+\n+/* Win32 define for porting git*/\n+\n+#ifndef _MODE_T_\n+#define\t_MODE_T_\n+typedef unsigned short _mode_t;\n+\n+#ifndef\t_NO_OLDNAMES\n+typedef _mode_t\tmode_t;\n+#endif\n+#endif\t/* Not _MODE_T_ */\n+\n+#ifndef _SSIZE_T_\n+#define _SSIZE_T_\n+typedef long _ssize_t;\n+\n+#ifndef\t_OFF_T_\n+#define\t_OFF_T_\n+typedef long _off_t;\n+\n+#ifndef\t_NO_OLDNAMES\n+typedef _off_t\toff_t;\n+#endif\n+#endif\t/* Not _OFF_T_ */\n+\n+\n+#ifndef\t_NO_OLDNAMES\n+typedef _ssize_t ssize_t;\n+#endif\n+#endif /* Not _SSIZE_T_ */\n+\n+typedef signed char int8_t;\n+typedef unsigned char   uint8_t;\n+typedef short  int16_t;\n+typedef unsigned short  uint16_t;\n+typedef int  int32_t;\n+typedef unsigned   uint32_t;\n+typedef long long  int64_t;\n+typedef unsigned long long   uint64_t;\n+\n+typedef long long  intmax_t;\n+typedef unsigned long long uintmax_t;\n+\n+typedef int64_t off64_t;\n+\n+#define STDOUT_FILENO 1\n+#define STDERR_FILENO 2\n+\n+/* Some defines for _access nAccessMode (MS doesn't define them, but\n+ * it doesn't seem to hurt to add them). */\n+#define\tF_OK\t0\t/* Check for file existence */\n+/* Well maybe it does hurt.  On newer versions of MSVCRT, an access mode\n+   of 1 causes invalid parameter error. */\n+#define\tX_OK\t0\t/* MS access() doesn't check for execute permission. */\n+#define\tW_OK\t2\t/* Check for write permission */\n+#define\tR_OK\t4\t/* Check for read permission */\n+\n+#define\t_S_IFIFO\t0x1000\t/* FIFO */\n+#define\t_S_IFCHR\t0x2000\t/* Character */\n+#define\t_S_IFBLK\t0x3000\t/* Block: Is this ever set under w32? */\n+#define\t_S_IFDIR\t0x4000\t/* Directory */\n+#define\t_S_IFREG\t0x8000\t/* Regular */\n+\n+#define\t_S_IFMT\t\t0xF000\t/* File type mask */\n+\n+#define\t_S_IXUSR\t_S_IEXEC\n+#define\t_S_IWUSR\t_S_IWRITE\n+#define\t_S_IRUSR\t_S_IREAD\n+#define\t_S_ISDIR(m)\t(((m) & _S_IFMT) == _S_IFDIR)\n+\n+#define\tS_IFIFO\t\t_S_IFIFO\n+#define\tS_IFCHR\t\t_S_IFCHR\n+#define\tS_IFBLK\t\t_S_IFBLK\n+#define\tS_IFDIR\t\t_S_IFDIR\n+#define\tS_IFREG\t\t_S_IFREG\n+#define\tS_IFMT\t\t_S_IFMT\n+#define\tS_IEXEC\t\t_S_IEXEC\n+#define\tS_IWRITE\t_S_IWRITE\n+#define\tS_IREAD\t\t_S_IREAD\n+#define\tS_IRWXU\t\t_S_IRWXU\n+#define\tS_IXUSR\t\t_S_IXUSR\n+#define\tS_IWUSR\t\t_S_IWUSR\n+#define\tS_IRUSR\t\t_S_IRUSR\n+\n+\n+#define\tS_ISDIR(m)\t(((m) & S_IFMT) == S_IFDIR)\n+#define\tS_ISREG(m)\t(((m) & S_IFMT) == S_IFREG)\n+#define\tS_ISFIFO(m)\t(((m) & S_IFMT) == S_IFIFO)\n+\n+#endif\ndiff --git a/compat/vcbuild/include/utime.h b/compat/vcbuild/include/utime.h\nnew file mode 100644\nindex 0000000..8285f38\n--- /dev/null\n+++ b/compat/vcbuild/include/utime.h\n@@ -0,0 +1 @@\n+#include <sys/utime.h>\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123320","messageId":"489a0e7c6c41985a5208e85e9b24900c97dcacdb.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"7afd55f9b2f0f7859f757c715034cc3520e07f0e.1253088099.git.mstormo@gmail.com","subject":"[PATCH 09/15] Add platform files for MSVC porting","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:25Z","receivedAt":"2009-09-16T08:20:25Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Frank Li <lznuaa@gmail.com>\n\nAdd msvc.c and msvc.h to build git under MSVC\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/msvc.c     |   35 +++++++++++++++++++++++++++++++++\n compat/msvc.h     |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++\n git-compat-util.h |    3 ++\n 3 files changed, 93 insertions(+), 0 deletions(-)\n create mode 100644 compat/msvc.c\n create mode 100644 compat/msvc.h\n\ndiff --git a/compat/msvc.c b/compat/msvc.c\nnew file mode 100644\nindex 0000000..ac04a4c\n--- /dev/null\n+++ b/compat/msvc.c\n@@ -0,0 +1,35 @@\n+#include \"../git-compat-util.h\"\n+#include \"win32.h\"\n+#include <conio.h>\n+#include \"../strbuf.h\"\n+\n+DIR *opendir(const char *name)\n+{\n+\tint len;\n+\tDIR *p;\n+\tp = (DIR*)malloc(sizeof(DIR));\n+\tmemset(p, 0, sizeof(DIR));\n+\tstrncpy(p->dd_name, name, PATH_MAX);\n+\tlen = strlen(p->dd_name);\n+\tp->dd_name[len] = '/';\n+\tp->dd_name[len+1] = '*';\n+\n+\tif (p == NULL)\n+\t\treturn NULL;\n+\n+\tp->dd_handle = _findfirst(p->dd_name, &p->dd_dta);\n+\n+\tif (p->dd_handle == -1) {\n+\t\tfree(p);\n+\t\treturn NULL;\n+\t}\n+\treturn p;\n+}\n+int closedir(DIR *dir)\n+{\n+\t_findclose(dir->dd_handle);\n+\tfree(dir);\n+\treturn 0;\n+}\n+\n+#include \"mingw.c\"\ndiff --git a/compat/msvc.h b/compat/msvc.h\nnew file mode 100644\nindex 0000000..6daf313\n--- /dev/null\n+++ b/compat/msvc.h\n@@ -0,0 +1,55 @@\n+#ifndef __MSVC__HEAD\n+#define __MSVC__HEAD\n+\n+/* Define minimize windows version */\n+#define WINVER 0x0500\n+#define _WIN32_WINNT 0x0500\n+#define _WIN32_WINDOWS 0x0410\n+#define _WIN32_IE 0x0700\n+#define NTDDI_VERSION NTDDI_WIN2KSP1\n+#include <winsock2.h>\n+#include <direct.h>\n+#include <process.h>\n+#include <malloc.h>\n+\n+/* porting function */\n+#define inline __inline\n+#define __inline__ __inline\n+#define __attribute__(x)\n+#define va_copy(dst, src)     ((dst) = (src))\n+\n+static __inline int strcasecmp (const char *s1, const char *s2)\n+{\n+\tint size1 = strlen(s1);\n+\tint sisz2 = strlen(s2);\n+\treturn _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);\n+}\n+\n+#undef ERROR\n+#undef stat\n+#undef _stati64\n+#include \"compat/mingw.h\"\n+#undef stat\n+#define stat _stati64\n+#define _stat64(x,y) mingw_lstat(x,y)\n+\n+/*\n+   Even though _stati64 is normally just defined at _stat64\n+   on Windows, we specify it here as a proper struct to avoid\n+   compiler warnings about macro redefinition due to magic in\n+   mingw.h. Struct taken from ReactOS (GNU GPL license).\n+*/\n+struct _stati64 {\n+\t_dev_t  st_dev;\n+\t_ino_t  st_ino;\n+\tunsigned short st_mode;\n+\tshort   st_nlink;\n+\tshort   st_uid;\n+\tshort   st_gid;\n+\t_dev_t  st_rdev;\n+\t__int64 st_size;\n+\ttime_t  st_atime;\n+\ttime_t  st_mtime;\n+\ttime_t  st_ctime;\n+};\n+#endif\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex e5e9f39..8ea444f 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -113,6 +113,9 @@\n /* pull in Windows compatibility stuff */\n #include \"compat/mingw.h\"\n #endif\t/* __MINGW32__ */\n+#ifdef _MSC_VER\n+#include \"compat/msvc.h\"\n+#endif\n \n #ifndef NO_LIBGEN_H\n #include <libgen.h>\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123321","messageId":"38f180f3899d1f7a6acc8cf8c65f5f0ffb61699a.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"489a0e7c6c41985a5208e85e9b24900c97dcacdb.1253088099.git.mstormo@gmail.com","subject":"[PATCH 10/15] Make usage of windows.h lean and mean","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:26Z","receivedAt":"2009-09-16T08:20:26Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nCentralize the include of windows.h in git-compat-util.h, turn on\nWIN32_LEAN_AND_MEAN to avoid including plenty of other header files\nwhich is not needed in Git. Also ensure we load winsock2.h first,\nso we don't load the older winsock definitions at a later stage,\nsince they contain duplicate definitions.\n\nWhen moving windows.h into git-compat-util.h, we need to protect\nthe definition of struct pollfd in mingw.h, since this file is used\nby both MinGW and MSVC, and the latter defines this struct in\nwinsock2.h.\n\nWe need to keep the windows.h include in compat/win32.h, since its\nshared by both MinGW and Cygwin, and we're not touching Cygwin in\nthis commit. The include in git-compat-util.h is protected with an\nifdef WIN32, which is not the case when compiling for Cygwin.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/mingw.c    |    2 ++\n compat/mingw.h    |    2 ++\n compat/msvc.h     |    7 -------\n compat/win32.h    |    2 ++\n compat/winansi.c  |    1 -\n git-compat-util.h |    6 ++++++\n thread-utils.c    |    5 +----\n 7 files changed, 13 insertions(+), 12 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 34ee427..6b5b5b2 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3,6 +3,8 @@\n #include <conio.h>\n #include \"../strbuf.h\"\n \n+#include <shellapi.h>\n+\n static int err_win_to_posix(DWORD winerr)\n {\n \tint error = ENOSYS;\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex bcd23b0..5b5258b 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -41,6 +41,7 @@ struct passwd {\n \n extern char *getpass(const char *prompt);\n \n+#ifndef POLLIN\n struct pollfd {\n \tint fd;           /* file descriptor */\n \tshort events;     /* requested events */\n@@ -48,6 +49,7 @@ struct pollfd {\n };\n #define POLLIN 1\n #define POLLHUP 2\n+#endif\n \n typedef void (__cdecl *sig_handler_t)(int);\n struct sigaction {\ndiff --git a/compat/msvc.h b/compat/msvc.h\nindex 6daf313..53a6d30 100644\n--- a/compat/msvc.h\n+++ b/compat/msvc.h\n@@ -1,13 +1,6 @@\n #ifndef __MSVC__HEAD\n #define __MSVC__HEAD\n \n-/* Define minimize windows version */\n-#define WINVER 0x0500\n-#define _WIN32_WINNT 0x0500\n-#define _WIN32_WINDOWS 0x0410\n-#define _WIN32_IE 0x0700\n-#define NTDDI_VERSION NTDDI_WIN2KSP1\n-#include <winsock2.h>\n #include <direct.h>\n #include <process.h>\n #include <malloc.h>\ndiff --git a/compat/win32.h b/compat/win32.h\nindex e8c178d..8ce9104 100644\n--- a/compat/win32.h\n+++ b/compat/win32.h\n@@ -2,7 +2,9 @@\n #define WIN32_H\n \n /* common Win32 functions for MinGW and Cygwin */\n+#ifndef WIN32         /* Not defined by Cygwin */\n #include <windows.h>\n+#endif\n \n static inline int file_attr_to_st_mode (DWORD attr)\n {\ndiff --git a/compat/winansi.c b/compat/winansi.c\nindex 9217c24..dedce21 100644\n--- a/compat/winansi.c\n+++ b/compat/winansi.c\n@@ -2,7 +2,6 @@\n  * Copyright 2008 Peter Harris <git@peter.is-a-geek.org>\n  */\n \n-#include <windows.h>\n #include \"../git-compat-util.h\"\n \n /*\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 8ea444f..8d6e29c 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -65,6 +65,12 @@\n #define _NETBSD_SOURCE 1\n #define _SGI_SOURCE 1\n \n+#ifdef WIN32 /* Both MinGW and MSVC */\n+#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */\n+#include <winsock2.h>\n+#include <windows.h>\n+#endif\n+\n #include <unistd.h>\n #include <stdio.h>\n #include <sys/stat.h>\ndiff --git a/thread-utils.c b/thread-utils.c\nindex 55e7e29..4f9c829 100644\n--- a/thread-utils.c\n+++ b/thread-utils.c\n@@ -1,9 +1,6 @@\n #include \"cache.h\"\n \n-#ifdef _WIN32\n-#  define WIN32_LEAN_AND_MEAN\n-#  include <windows.h>\n-#elif defined(hpux) || defined(__hpux) || defined(_hpux)\n+#if defined(hpux) || defined(__hpux) || defined(_hpux)\n #  include <sys/pstat.h>\n #endif\n \n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123318","messageId":"e9ffbe6e71d7f27c4ee5d31f59f860827c5a2f94.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"38f180f3899d1f7a6acc8cf8c65f5f0ffb61699a.1253088099.git.mstormo@gmail.com","subject":"[PATCH 11/15] Define strncasecmp and ftruncate for MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:27Z","receivedAt":"2009-09-16T08:20:27Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/msvc.h |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/msvc.h b/compat/msvc.h\nindex 53a6d30..9c753a5 100644\n--- a/compat/msvc.h\n+++ b/compat/msvc.h\n@@ -10,6 +10,8 @@\n #define __inline__ __inline\n #define __attribute__(x)\n #define va_copy(dst, src)     ((dst) = (src))\n+#define strncasecmp  _strnicmp\n+#define ftruncate    _chsize\n \n static __inline int strcasecmp (const char *s1, const char *s2)\n {\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123326","messageId":"49b1712beea2ac9eb00c61c8d92c035a7c412d69.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"e9ffbe6e71d7f27c4ee5d31f59f860827c5a2f94.1253088099.git.mstormo@gmail.com","subject":"[PATCH 12/15] Add MSVC to Makefile","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:28Z","receivedAt":"2009-09-16T08:20:28Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nEnable MSVC builds with GNU Make by simply calling\n    make MSVC=1\n(Debug build possible by adding DEBUG=1 as well)\n\nTwo scripts, clink.pl and lib.pl, are used to convert certain GCC\nspecific command line options into something MSVC understands.\nBy building for MSVC with GNU Make, we can ensure that the MSVC\nport always follows the latest code, and does not lag behind due\nto unmaintained NMake Makefile or IDE projects.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n Makefile                        |   55 ++++++++++++++++++++++++++++++++++++++-\n compat/vcbuild/scripts/clink.pl |   48 ++++++++++++++++++++++++++++++++++\n compat/vcbuild/scripts/lib.pl   |   26 ++++++++++++++++++\n 3 files changed, 128 insertions(+), 1 deletions(-)\n create mode 100644 compat/vcbuild/scripts/clink.pl\n create mode 100644 compat/vcbuild/scripts/lib.pl\n\ndiff --git a/Makefile b/Makefile\nindex bde2acd..aa918eb 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -877,6 +877,58 @@ ifneq (,$(findstring CYGWIN,$(uname_S)))\n \tCOMPAT_OBJS += compat/cygwin.o\n \tUNRELIABLE_FSTAT = UnfortunatelyYes\n endif\n+ifdef MSVC\n+\tpathsep = ;\n+\tNO_PREAD = YesPlease\n+\tNO_OPENSSL = YesPlease\n+\tNO_LIBGEN_H = YesPlease\n+\tNO_SYMLINK_HEAD = YesPlease\n+\tNO_IPV6 = YesPlease\n+\tNO_SETENV = YesPlease\n+\tNO_UNSETENV = YesPlease\n+\tNO_STRCASESTR = YesPlease\n+\tNO_STRLCPY = YesPlease\n+\tNO_MEMMEM = YesPlease\n+\t# NEEDS_LIBICONV = YesPlease\n+\tNO_ICONV = YesPlease\n+\tNO_C99_FORMAT = YesPlease\n+\tNO_STRTOUMAX = YesPlease\n+\tNO_STRTOULL = YesPlease\n+\tNO_MKDTEMP = YesPlease\n+\tNO_MKSTEMPS = YesPlease\n+\tSNPRINTF_RETURNS_BOGUS = YesPlease\n+\tNO_SVN_TESTS = YesPlease\n+\tNO_PERL_MAKEMAKER = YesPlease\n+\tRUNTIME_PREFIX = YesPlease\n+\tNO_POSIX_ONLY_PROGRAMS = YesPlease\n+\tNO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease\n+\tNO_NSEC = YesPlease\n+\tUSE_WIN32_MMAP = YesPlease\n+\t# USE_NED_ALLOCATOR = YesPlease\n+\tUNRELIABLE_FSTAT = UnfortunatelyYes\n+\tOBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo\n+\tNO_REGEX = YesPlease\n+\tNO_CURL = YesPlease\n+\tNO_PTHREADS = YesPlease\n+\n+\tCC = compat/vcbuild/scripts/clink.pl\n+\tAR = compat/vcbuild/scripts/lib.pl\n+\tCFLAGS =\n+\tBASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32-D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE\n+\tCOMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o\n+\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/fnmatch -Icompat/regex -Icompat/fnmatch -DSTRIP_EXTENSION=\\\".exe\\\"\n+\tBASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib\n+\tEXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib\n+\tlib =\n+ifndef DEBUG\n+\tBASIC_CFLAGS += -GL -Os -MT\n+\tBASIC_LDFLAGS += -LTCG\n+\tAR += -LTCG\n+else\n+\tBASIC_CFLAGS += -Zi -MTd\n+endif\n+\tX = .exe\n+else\n ifneq (,$(findstring MINGW,$(uname_S)))\n \tpathsep = ;\n \tNO_PREAD = YesPlease\n@@ -925,6 +977,7 @@ else\n \tNO_PTHREADS = YesPlease\n endif\n endif\n+endif\n \n -include config.mak.autogen\n -include config.mak\n@@ -1327,7 +1380,7 @@ strip: $(PROGRAMS) git$X\n git.o: git.c common-cmds.h GIT-CFLAGS\n \t$(QUIET_CC)$(CC) -DGIT_VERSION='\"$(GIT_VERSION)\"' \\\n \t\t'-DGIT_HTML_PATH=\"$(htmldir_SQ)\"' \\\n-\t\t$(ALL_CFLAGS) -c $(filter %.c,$^)\n+\t\t$(ALL_CFLAGS) -o $@ -c $(filter %.c,$^)\n \n git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \\\ndiff --git a/compat/vcbuild/scripts/clink.pl b/compat/vcbuild/scripts/clink.pl\nnew file mode 100644\nindex 0000000..0ffd59f\n--- /dev/null\n+++ b/compat/vcbuild/scripts/clink.pl\n@@ -0,0 +1,48 @@\n+#!/usr/bin/perl -w\n+######################################################################\n+# Compiles or links files\n+#\n+# This is a wrapper to facilitate the compilation of Git with MSVC\n+# using GNU Make as the build system. So, instead of manipulating the\n+# Makefile into something nasty, just to support non-space arguments\n+# etc, we use this wrapper to fix the command line options\n+#\n+# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>\n+######################################################################\n+use strict;\n+my @args = ();\n+my @cflags = ();\n+my $is_linking = 0;\n+while (@ARGV) {\n+\tmy $arg = shift @ARGV;\n+\tif (\"$arg\" =~ /^-[DIMGO]/) {\n+\t\tpush(@cflags, $arg);\n+\t} elsif (\"$arg\" eq \"-o\") {\n+\t\tmy $file_out = shift @ARGV;\n+\t\tif (\"$file_out\" =~ /exe$/) {\n+\t\t\t$is_linking = 1;\n+\t\t\tpush(@args, \"-OUT:$file_out\");\n+\t\t} else {\n+\t\t\tpush(@args, \"-Fo$file_out\");\n+\t\t}\n+\t} elsif (\"$arg\" eq \"-lz\") {\n+\t\tpush(@args, \"zlib.lib\");\n+\t} elsif (\"$arg\" eq \"-liconv\") {\n+\t\tpush(@args, \"iconv.lib\");\n+\t} elsif (\"$arg\" =~ /^-L/ && \"$arg\" ne \"-LTCG\") {\n+\t\t$arg =~ s/^-L/-LIBPATH:/;\n+\t\tpush(@args, $arg);\n+\t} elsif (\"$arg\" =~ /^-R/) {\n+\t\t# eat\n+\t} else {\n+\t\tpush(@args, $arg);\n+\t}\n+}\n+if ($is_linking) {\n+\tunshift(@args, \"link.exe\");\n+} else {\n+\tunshift(@args, \"cl.exe\");\n+\tpush(@args, @cflags);\n+}\n+#printf(\"**** @args\\n\");\n+exit system(@args);\ndiff --git a/compat/vcbuild/scripts/lib.pl b/compat/vcbuild/scripts/lib.pl\nnew file mode 100644\nindex 0000000..68f6644\n--- /dev/null\n+++ b/compat/vcbuild/scripts/lib.pl\n@@ -0,0 +1,26 @@\n+#!/usr/bin/perl -w\n+######################################################################\n+# Libifies files on Windows\n+#\n+# This is a wrapper to facilitate the compilation of Git with MSVC\n+# using GNU Make as the build system. So, instead of manipulating the\n+# Makefile into something nasty, just to support non-space arguments\n+# etc, we use this wrapper to fix the command line options\n+#\n+# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>\n+######################################################################\n+use strict;\n+my @args = ();\n+while (@ARGV) {\n+\tmy $arg = shift @ARGV;\n+\tif (\"$arg\" eq \"rcs\") {\n+\t\t# Consume the rcs option\n+\t} elsif (\"$arg\" =~ /\\.a$/) {\n+\t\tpush(@args, \"-OUT:$arg\");\n+\t} else {\n+\t\tpush(@args, $arg);\n+\t}\n+}\n+unshift(@args, \"lib.exe\");\n+# printf(\"**** @args\\n\");\n+exit system(@args);\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123324","messageId":"260603a54845df34659d605fadaf663d0094c8cb.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"49b1712beea2ac9eb00c61c8d92c035a7c412d69.1253088099.git.mstormo@gmail.com","subject":"[PATCH 13/15] Add README for MSVC build","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:29Z","receivedAt":"2009-09-16T08:20:29Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nBased on original README patch from Frank Li\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/vcbuild/README |   39 +++++++++++++++++++++++++++++++++++++++\n 1 files changed, 39 insertions(+), 0 deletions(-)\n create mode 100644 compat/vcbuild/README\n\ndiff --git a/compat/vcbuild/README b/compat/vcbuild/README\nnew file mode 100644\nindex 0000000..354526a\n--- /dev/null\n+++ b/compat/vcbuild/README\n@@ -0,0 +1,39 @@\n+The Steps of Build Git with VS2008\n+\n+1. You need the build environment, which contains the Git dependencies\n+   to be able to compile, link and run Git with MSVC.\n+\n+   You can either use the binary repository:\n+\n+       WWW: http://repo.or.cz/w/msvcgit.git\n+       Git: git clone git://repo.or.cz/msvcgit.git\n+       Zip: http://repo.or.cz/w/msvcgit.git?a=snapshot;h=master;sf=zip\n+\n+   and call the setup_32bit_env.cmd batch script before compiling Git,\n+   (see repo/package README for details), or the source repository:\n+\n+       WWW: http://repo.or.cz/w/gitbuild.git\n+       Git: git clone git://repo.or.cz/gitbuild.git\n+       Zip: (None, as it's a project with submodules)\n+\n+   and build the support libs as instructed in that repo/package.\n+\n+2. Ensure you have the msysgit environment in your path, so you have\n+   GNU Make, bash and perl available.\n+\n+       WWW: http://repo.or.cz/w/msysgit.git\n+       Git: git clone git://repo.or.cz/msysgit.git\n+       Zip: http://repo.or.cz/w/msysgit.git?a=snapshot;h=master;sf=zip\n+\n+   This environment is also needed when you use the resulting\n+   executables, since Git might need to run scripts which are part of\n+   the git operations.\n+\n+3. Inside Git's directory run the command:\n+       make common-cmds.h\n+   to generate the common-cmds.h file needed to compile git.\n+\n+4. Then build Git with the GNU Make Makefile in the Git projects root\n+       make MSVC=1\n+\n+Done!\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123322","messageId":"aa80ad559c731ca73179956e34b2743d903fbbec.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"260603a54845df34659d605fadaf663d0094c8cb.1253088099.git.mstormo@gmail.com","subject":"[PATCH 14/15] Add scripts to generate projects for other buildsystems (MSVC vcproj, QMake)","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:30Z","receivedAt":"2009-09-16T08:20:30Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nThese scripts generate projects for the MSVC IDE (.vcproj files) or\nQMake (.pro files), based on the output of a 'make -n MSVC=1 V=1' run.\n\nThis enables us to simply do the necesarry changes in the Makefile, and you\ncan update the other buildsystems by regenerating the files. Keeping the\nother buildsystems up-to-date with main development.\n\nThe generator system is designed to easily drop in pm's for other\nbuildsystems as well, if someone has an itch. However, the focus has been\nWindows development, so the 'engine' might need patches to support any\nplatform.\n\nAlso add some .gitignore entries for MSVC files.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n .gitignore                                |   11 +\n compat/vcbuild/README                     |   13 +-\n contrib/buildsystems/Generators.pm        |   42 ++\n contrib/buildsystems/Generators/QMake.pm  |  189 +++++++++\n contrib/buildsystems/Generators/Vcproj.pm |  639 +++++++++++++++++++++++++++++\n contrib/buildsystems/engine.pl            |  353 ++++++++++++++++\n contrib/buildsystems/generate             |   29 ++\n contrib/buildsystems/parse.pl             |  228 ++++++++++\n 8 files changed, 1503 insertions(+), 1 deletions(-)\n create mode 100644 contrib/buildsystems/Generators.pm\n create mode 100644 contrib/buildsystems/Generators/QMake.pm\n create mode 100644 contrib/buildsystems/Generators/Vcproj.pm\n create mode 100644 contrib/buildsystems/engine.pl\n create mode 100644 contrib/buildsystems/generate\n create mode 100644 contrib/buildsystems/parse.pl\n\ndiff --git a/.gitignore b/.gitignore\nindex 47672b0..51a37b1 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -179,3 +179,14 @@ configure\n tags\n TAGS\n cscope*\n+*.obj\n+*.lib\n+*.sln\n+*.suo\n+*.ncb\n+*.vcproj\n+*.user\n+*.idb\n+*.pdb\n+Debug/\n+Release/\ndiff --git a/compat/vcbuild/README b/compat/vcbuild/README\nindex 354526a..df8a657 100644\n--- a/compat/vcbuild/README\n+++ b/compat/vcbuild/README\n@@ -33,7 +33,18 @@ The Steps of Build Git with VS2008\n        make common-cmds.h\n    to generate the common-cmds.h file needed to compile git.\n \n-4. Then build Git with the GNU Make Makefile in the Git projects root\n+4. Then either build Git with the GNU Make Makefile in the Git projects\n+   root\n        make MSVC=1\n+   or generate Visual Studio solution/projects (.sln/.vcproj) with the\n+   command\n+       perl contrib/buildsystems/generate -g Vcproj\n+   and open and build the solution with the IDE\n+       devenv git.sln /useenv\n+   or build with the IDE build engine directly from the command line\n+       devenv git.sln /useenv /build \"Release|Win32\"\n+   The /useenv option is required, so Visual Studio picks up the\n+   environment variables for the support libraries required to build\n+   Git, which you set up in step 1.\n \n Done!\ndiff --git a/contrib/buildsystems/Generators.pm b/contrib/buildsystems/Generators.pm\nnew file mode 100644\nindex 0000000..408ef71\n--- /dev/null\n+++ b/contrib/buildsystems/Generators.pm\n@@ -0,0 +1,42 @@\n+package Generators;\n+require Exporter;\n+\n+use strict;\n+use File::Basename;\n+no strict 'refs';\n+use vars qw($VERSION @AVAILABLE);\n+\n+our $VERSION = '1.00';\n+our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);\n+@ISA = qw(Exporter);\n+\n+BEGIN {\n+    local(*D);\n+    my $me = $INC{\"Generators.pm\"};\n+    die \"Couldn't find myself in \\@INC, which is required to load the generators!\" if (\"$me\" eq \"\");\n+    $me = dirname($me);\n+    if (opendir(D,\"$me/Generators\")) {\n+        foreach my $gen (readdir(D)) {\n+            next if ($gen  =~ /^\\.\\.?$/);\n+            require \"${me}/Generators/$gen\";\n+            $gen =~ s,\\.pm,,;\n+            push(@AVAILABLE, $gen);\n+        }\n+        closedir(D);\n+        my $gens = join(', ', @AVAILABLE);\n+    }\n+\n+    push @EXPORT_OK, qw(available);\n+}\n+\n+sub available {\n+    return @AVAILABLE;\n+}\n+\n+sub generate {\n+    my ($gen, $git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    return eval(\"Generators::${gen}::generate(\\$git_dir, \\$out_dir, \\$rel_dir, \\%build_structure)\") if grep(/^$gen$/, @AVAILABLE);\n+    die \"Generator \\\"${gen}\\\" is not available!\\nAvailable generators are: @AVAILABLE\\n\";\n+}\n+\n+1;\ndiff --git a/contrib/buildsystems/Generators/QMake.pm b/contrib/buildsystems/Generators/QMake.pm\nnew file mode 100644\nindex 0000000..ff3b657\n--- /dev/null\n+++ b/contrib/buildsystems/Generators/QMake.pm\n@@ -0,0 +1,189 @@\n+package Generators::QMake;\n+require Exporter;\n+\n+use strict;\n+use vars qw($VERSION);\n+\n+our $VERSION = '1.00';\n+our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);\n+@ISA = qw(Exporter);\n+\n+BEGIN {\n+    push @EXPORT_OK, qw(generate);\n+}\n+\n+sub generate {\n+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+\n+    my @libs = @{$build_structure{\"LIBS\"}};\n+    foreach (@libs) {\n+        createLibProject($_, $git_dir, $out_dir, $rel_dir, %build_structure);\n+    }\n+\n+    my @apps = @{$build_structure{\"APPS\"}};\n+    foreach (@apps) {\n+        createAppProject($_, $git_dir, $out_dir, $rel_dir, %build_structure);\n+    }\n+\n+    createGlueProject($git_dir, $out_dir, $rel_dir, %build_structure);\n+    return 0;\n+}\n+\n+sub createLibProject {\n+    my ($libname, $git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    print \"Generate $libname lib project\\n\";\n+    $rel_dir = \"../$rel_dir\";\n+\n+    my $sources = join(\" \\\\\\n\\t\", sort(map(\"$rel_dir/$_\", @{$build_structure{\"LIBS_${libname}_SOURCES\"}})));\n+    my $defines = join(\" \\\\\\n\\t\", sort(@{$build_structure{\"LIBS_${libname}_DEFINES\"}}));\n+    my $includes= join(\" \\\\\\n\\t\", sort(map(\"$rel_dir/$_\", @{$build_structure{\"LIBS_${libname}_INCLUDES\"}})));\n+    my $cflags  = join(\" \", sort(@{$build_structure{\"LIBS_${libname}_CFLAGS\"}}));\n+\n+    my $cflags_debug = $cflags;\n+    $cflags_debug =~ s/-MT/-MTd/;\n+    $cflags_debug =~ s/-O.//;\n+\n+    my $cflags_release = $cflags;\n+    $cflags_release =~ s/-MTd/-MT/;\n+\n+    my @tmp  = @{$build_structure{\"LIBS_${libname}_LFLAGS\"}};\n+    my @tmp2 = ();\n+    foreach (@tmp) {\n+        if (/^-LTCG/) {\n+        } elsif (/^-L/) {\n+            $_ =~ s/^-L/-LIBPATH:$rel_dir\\//;\n+        }\n+        push(@tmp2, $_);\n+    }\n+    my $lflags = join(\" \", sort(@tmp));\n+\n+    my $target = $libname;\n+    $target =~ s/\\//_/g;\n+    $defines =~ s/-D//g;\n+    $defines =~ s/\"/\\\\\\\\\"/g;\n+    $includes =~ s/-I//g;\n+    mkdir \"$target\" || die \"Could not create the directory $target for lib project!\\n\";\n+    open F, \">$target/$target.pro\" || die \"Could not open $target/$target.pro for writing!\\n\";\n+    print F << \"EOM\";\n+TEMPLATE = lib\n+TARGET = $target\n+DESTDIR = $rel_dir\n+\n+CONFIG -= qt\n+CONFIG += static\n+\n+QMAKE_CFLAGS =\n+QMAKE_CFLAGS_RELEASE = $cflags_release\n+QMAKE_CFLAGS_DEBUG = $cflags_debug\n+QMAKE_LIBFLAGS = $lflags\n+\n+DEFINES += \\\\\n+        $defines\n+\n+INCLUDEPATH += \\\\\n+        $includes\n+\n+SOURCES += \\\\\n+        $sources\n+EOM\n+    close F;\n+}\n+\n+sub createAppProject {\n+    my ($appname, $git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    print \"Generate $appname app project\\n\";\n+    $rel_dir = \"../$rel_dir\";\n+\n+    my $sources = join(\" \\\\\\n\\t\", sort(map(\"$rel_dir/$_\", @{$build_structure{\"APPS_${appname}_SOURCES\"}})));\n+    my $defines = join(\" \\\\\\n\\t\", sort(@{$build_structure{\"APPS_${appname}_DEFINES\"}}));\n+    my $includes= join(\" \\\\\\n\\t\", sort(map(\"$rel_dir/$_\", @{$build_structure{\"APPS_${appname}_INCLUDES\"}})));\n+    my $cflags  = join(\" \", sort(@{$build_structure{\"APPS_${appname}_CFLAGS\"}}));\n+\n+    my $cflags_debug = $cflags;\n+    $cflags_debug =~ s/-MT/-MTd/;\n+    $cflags_debug =~ s/-O.//;\n+\n+    my $cflags_release = $cflags;\n+    $cflags_release =~ s/-MTd/-MT/;\n+\n+    my $libs;\n+    foreach (sort(@{$build_structure{\"APPS_${appname}_LIBS\"}})) {\n+        $_ =~ s/\\//_/g;\n+        $libs .= \" $_\";\n+    }\n+    my @tmp  = @{$build_structure{\"APPS_${appname}_LFLAGS\"}};\n+    my @tmp2 = ();\n+    foreach (@tmp) {\n+        # next if ($_ eq \"-NODEFAULTLIB:MSVCRT.lib\");\n+        if (/^-LTCG/) {\n+        } elsif (/^-L/) {\n+            $_ =~ s/^-L/-LIBPATH:$rel_dir\\//;\n+        }\n+        push(@tmp2, $_);\n+    }\n+    my $lflags = join(\" \", sort(@tmp));\n+\n+    my $target = $appname;\n+    $target =~ s/\\.exe//;\n+    $target =~ s/\\//_/g;\n+    $defines =~ s/-D//g;\n+    $defines =~ s/\"/\\\\\\\\\"/g;\n+    $includes =~ s/-I//g;\n+    mkdir \"$target\" || die \"Could not create the directory $target for app project!\\n\";\n+    open F, \">$target/$target.pro\" || die \"Could not open $target/$target.pro for writing!\\n\";\n+    print F << \"EOM\";\n+TEMPLATE = app\n+TARGET = $target\n+DESTDIR = $rel_dir\n+\n+CONFIG -= qt embed_manifest_exe\n+CONFIG += console\n+\n+QMAKE_CFLAGS =\n+QMAKE_CFLAGS_RELEASE = $cflags_release\n+QMAKE_CFLAGS_DEBUG = $cflags_debug\n+QMAKE_LFLAGS = $lflags\n+LIBS   = $libs\n+\n+DEFINES += \\\\\n+        $defines\n+\n+INCLUDEPATH += \\\\\n+        $includes\n+\n+win32:QMAKE_LFLAGS += -LIBPATH:$rel_dir\n+else: QMAKE_LFLAGS += -L$rel_dir\n+\n+SOURCES += \\\\\n+        $sources\n+EOM\n+    close F;\n+}\n+\n+sub createGlueProject {\n+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    my $libs = join(\" \\\\ \\n\", map(\"\\t$_|$_.pro\", @{$build_structure{\"LIBS\"}}));\n+    my $apps = join(\" \\\\ \\n\", map(\"\\t$_|$_.pro\", @{$build_structure{\"APPS\"}}));\n+    $libs =~ s/\\.a//g;\n+    $libs =~ s/\\//_/g;\n+    $libs =~ s/\\|/\\//g;\n+    $apps =~ s/\\.exe//g;\n+    $apps =~ s/\\//_/g;\n+    $apps =~ s/\\|/\\//g;\n+\n+    my $filename = $out_dir;\n+    $filename =~ s/.*\\/([^\\/]+)$/$1/;\n+    $filename =~ s/\\/$//;\n+    print \"Generate glue project $filename.pro\\n\";\n+    open F, \">$filename.pro\" || die \"Could not open $filename.pro for writing!\\n\";\n+    print F << \"EOM\";\n+TEMPLATE = subdirs\n+CONFIG += ordered\n+SUBDIRS += \\\\\n+$libs \\\\\n+$apps\n+EOM\n+    close F;\n+}\n+\n+1;\ndiff --git a/contrib/buildsystems/Generators/Vcproj.pm b/contrib/buildsystems/Generators/Vcproj.pm\nnew file mode 100644\nindex 0000000..00ec0c1\n--- /dev/null\n+++ b/contrib/buildsystems/Generators/Vcproj.pm\n@@ -0,0 +1,639 @@\n+package Generators::Vcproj;\n+require Exporter;\n+\n+use strict;\n+use vars qw($VERSION);\n+\n+our $VERSION = '1.00';\n+our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);\n+@ISA = qw(Exporter);\n+\n+BEGIN {\n+    push @EXPORT_OK, qw(generate);\n+}\n+\n+my $guid_index = 0;\n+my @GUIDS = (\n+    \"{E07B9989-2BF7-4F21-8918-BE22BA467AC3}\",\n+    \"{278FFB51-0296-4A44-A81A-22B87B7C3592}\",\n+    \"{7346A2C4-F0FD-444F-9EBE-1AF23B2B5650}\",\n+    \"{67F421AC-EB34-4D49-820B-3196807B423F}\",\n+    \"{385DCFE1-CC8C-4211-A451-80FCFC31CA51}\",\n+    \"{97CC46C5-D2CC-4D26-B634-E75792B79916}\",\n+    \"{C7CE21FE-6EF8-4012-A5C7-A22BCEDFBA11}\",\n+    \"{51575134-3FDF-42D1-BABD-3FB12669C6C9}\",\n+    \"{0AE195E4-9823-4B87-8E6F-20C5614AF2FF}\",\n+    \"{4B918255-67CA-43BB-A46C-26704B666E6B}\",\n+    \"{18CCFEEF-C8EE-4CC1-A265-26F95C9F4649}\",\n+    \"{5D5D90FA-01B7-4973-AFE5-CA88C53AC197}\",\n+    \"{1F054320-036D-49E1-B384-FB5DF0BC8AC0}\",\n+    \"{7CED65EE-F2D9-4171-825B-C7D561FE5786}\",\n+    \"{8D341679-0F07-4664-9A56-3BA0DE88B9BC}\",\n+    \"{C189FEDC-2957-4BD7-9FA4-7622241EA145}\",\n+    \"{66844203-1B9F-4C53-9274-164FFF95B847}\",\n+    \"{E4FEA145-DECC-440D-AEEA-598CF381FD43}\",\n+    \"{73300A8E-C8AC-41B0-B555-4F596B681BA7}\",\n+    \"{873FDEB1-D01D-40BF-A1BF-8BBC58EC0F51}\",\n+    \"{7922C8BE-76C5-4AC6-8BF7-885C0F93B782}\",\n+    \"{E245D370-308B-4A49-BFC1-1E527827975F}\",\n+    \"{F6FA957B-66FC-4ED7-B260-E59BBE4FE813}\",\n+    \"{E6055070-0198-431A-BC49-8DB6CEE770AE}\",\n+    \"{54159234-C3EB-43DA-906B-CE5DA5C74654}\",\n+    \"{594CFC35-0B60-46F6-B8EF-9983ACC1187D}\",\n+    \"{D93FCAB7-1F01-48D2-B832-F761B83231A5}\",\n+    \"{DBA5E6AC-E7BE-42D3-8703-4E787141526E}\",\n+    \"{6171953F-DD26-44C7-A3BE-CC45F86FC11F}\",\n+    \"{9E19DDBE-F5E4-4A26-A2FE-0616E04879B8}\",\n+    \"{AE81A615-99E3-4885-9CE0-D9CAA193E867}\",\n+    \"{FBF4067E-1855-4F6C-8BCD-4D62E801A04D}\",\n+    \"{17007948-6593-4AEB-8106-F7884B4F2C19}\",\n+    \"{199D4C8D-8639-4DA6-82EF-08668C35DEE0}\",\n+    \"{E085E50E-C140-4CF3-BE4B-094B14F0DDD6}\",\n+    \"{00785268-A9CC-4E40-AC29-BAC0019159CE}\",\n+    \"{4C06F56A-DCDB-46A6-B67C-02339935CF12}\",\n+    \"{3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}\",\n+    \"{3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}\",\n+    \"{9392EB58-D7BA-410B-B1F0-B2FAA6BC89A7}\",\n+    \"{2ACAB2D5-E0CE-4027-BCA0-D78B2D7A6C66}\",\n+    \"{86E216C3-43CE-481A-BCB2-BE5E62850635}\",\n+    \"{FB631291-7923-4B91-9A57-7B18FDBB7A42}\",\n+    \"{0A176EC9-E934-45B8-B87F-16C7F4C80039}\",\n+    \"{DF55CA80-46E8-4C53-B65B-4990A23DD444}\",\n+    \"{3A0F9895-55D2-4710-BE5E-AD7498B5BF44}\",\n+    \"{294BDC5A-F448-48B6-8110-DD0A81820F8C}\",\n+    \"{4B9F66E9-FAC9-47AB-B1EF-C16756FBFD06}\",\n+    \"{72EA49C6-2806-48BD-B81B-D4905102E19C}\",\n+    \"{5728EB7E-8929-486C-8CD5-3238D060E768}\"\n+);\n+\n+sub generate {\n+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    my @libs = @{$build_structure{\"LIBS\"}};\n+    foreach (@libs) {\n+        createLibProject($_, $git_dir, $out_dir, $rel_dir, \\%build_structure);\n+    }\n+\n+    my @apps = @{$build_structure{\"APPS\"}};\n+    foreach (@apps) {\n+        createAppProject($_, $git_dir, $out_dir, $rel_dir, \\%build_structure);\n+    }\n+\n+    createGlueProject($git_dir, $out_dir, $rel_dir, %build_structure);\n+    return 0;\n+}\n+\n+sub createLibProject {\n+    my ($libname, $git_dir, $out_dir, $rel_dir, $build_structure) = @_;\n+    print \"Generate $libname vcproj lib project\\n\";\n+    $rel_dir = \"..\\\\$rel_dir\";\n+    $rel_dir =~ s/\\//\\\\/g;\n+\n+    my $target = $libname;\n+    $target =~ s/\\//_/g;\n+    $target =~ s/\\.a//;\n+\n+    my $uuid = $GUIDS[$guid_index];\n+    $$build_structure{\"LIBS_${target}_GUID\"} = $uuid;\n+    $guid_index += 1;\n+\n+    my @srcs = sort(map(\"$rel_dir\\\\$_\", @{$$build_structure{\"LIBS_${libname}_SOURCES\"}}));\n+    my @sources;\n+    foreach (@srcs) {\n+        $_ =~ s/\\//\\\\/g;\n+        push(@sources, $_);\n+    }\n+    my $defines = join(\",\", sort(@{$$build_structure{\"LIBS_${libname}_DEFINES\"}}));\n+    my $includes= join(\";\", sort(map(\"&quot;$rel_dir\\\\$_&quot;\", @{$$build_structure{\"LIBS_${libname}_INCLUDES\"}})));\n+    my $cflags  = join(\" \", sort(@{$$build_structure{\"LIBS_${libname}_CFLAGS\"}}));\n+    $cflags =~ s/\\\"/&quot;/g;\n+\n+    my $cflags_debug = $cflags;\n+    $cflags_debug =~ s/-MT/-MTd/;\n+    $cflags_debug =~ s/-O.//;\n+\n+    my $cflags_release = $cflags;\n+    $cflags_release =~ s/-MTd/-MT/;\n+\n+    my @tmp  = @{$$build_structure{\"LIBS_${libname}_LFLAGS\"}};\n+    my @tmp2 = ();\n+    foreach (@tmp) {\n+        if (/^-LTCG/) {\n+        } elsif (/^-L/) {\n+            $_ =~ s/^-L/-LIBPATH:$rel_dir\\//;\n+        }\n+        push(@tmp2, $_);\n+    }\n+    my $lflags = join(\" \", sort(@tmp));\n+\n+    $defines =~ s/-D//g;\n+    $defines =~ s/\\\"/\\\\&quot;/g;\n+    $defines =~ s/\\'//g;\n+    $includes =~ s/-I//g;\n+    mkdir \"$target\" || die \"Could not create the directory $target for lib project!\\n\";\n+    open F, \">$target/$target.vcproj\" || die \"Could not open $target/$target.pro for writing!\\n\";\n+    print F << \"EOM\";\n+<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n+<VisualStudioProject\n+\tProjectType=\"Visual C++\"\n+\tVersion=\"9,00\"\n+\tName=\"$target\"\n+\tProjectGUID=\"$uuid\">\n+\t<Platforms>\n+\t\t<Platform\n+\t\t\tName=\"Win32\"/>\n+\t</Platforms>\n+\t<ToolFiles>\n+\t</ToolFiles>\n+\t<Configurations>\n+\t\t<Configuration\n+\t\t\tName=\"Debug|Win32\"\n+\t\t\tOutputDirectory=\"$rel_dir\"\n+\t\t\tConfigurationType=\"4\"\n+\t\t\tCharacterSet=\"0\"\n+\t\t\tIntermediateDirectory=\"\\$(ProjectDir)\\$(ConfigurationName)\"\n+\t\t\t>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreBuildEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCustomBuildTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCMIDLTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCLCompilerTool\"\n+\t\t\t\tAdditionalOptions=\"$cflags_debug\"\n+\t\t\t\tOptimization=\"0\"\n+\t\t\t\tInlineFunctionExpansion=\"1\"\n+\t\t\t\tAdditionalIncludeDirectories=\"$includes\"\n+\t\t\t\tPreprocessorDefinitions=\"UNICODE,WIN32,_DEBUG,$defines\"\n+\t\t\t\tMinimalRebuild=\"true\"\n+\t\t\t\tRuntimeLibrary=\"1\"\n+\t\t\t\tUsePrecompiledHeader=\"0\"\n+\t\t\t\tWarningLevel=\"3\"\n+\t\t\t\tDebugInformationFormat=\"3\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreLinkEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCLibrarianTool\"\n+\t\t\t\tSuppressStartupBanner=\"true\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCALinkTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXDCMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCBscMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCFxCopTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPostBuildEventTool\"\n+\t\t\t/>\n+\t\t</Configuration>\n+\t\t<Configuration\n+\t\t\tName=\"Release|Win32\"\n+\t\t\tOutputDirectory=\"$rel_dir\"\n+\t\t\tConfigurationType=\"4\"\n+\t\t\tCharacterSet=\"0\"\n+\t\t\tWholeProgramOptimization=\"1\"\n+\t\t\tIntermediateDirectory=\"\\$(ProjectDir)\\$(ConfigurationName)\"\n+\t\t\t>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreBuildEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCustomBuildTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCMIDLTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCLCompilerTool\"\n+\t\t\t\tAdditionalOptions=\"$cflags_release\"\n+\t\t\t\tOptimization=\"2\"\n+\t\t\t\tInlineFunctionExpansion=\"1\"\n+\t\t\t\tEnableIntrinsicFunctions=\"true\"\n+\t\t\t\tAdditionalIncludeDirectories=\"$includes\"\n+\t\t\t\tPreprocessorDefinitions=\"UNICODE,WIN32,NDEBUG,$defines\"\n+\t\t\t\tRuntimeLibrary=\"0\"\n+\t\t\t\tEnableFunctionLevelLinking=\"true\"\n+\t\t\t\tUsePrecompiledHeader=\"0\"\n+\t\t\t\tWarningLevel=\"3\"\n+\t\t\t\tDebugInformationFormat=\"3\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreLinkEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCLibrarianTool\"\n+\t\t\t\tSuppressStartupBanner=\"true\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCALinkTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXDCMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCBscMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCFxCopTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPostBuildEventTool\"\n+\t\t\t/>\n+\t\t</Configuration>\n+\t</Configurations>\n+\t<Files>\n+\t\t<Filter\n+\t\t\tName=\"Source Files\"\n+\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\n+\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\n+EOM\n+    foreach(@sources) {\n+        print F << \"EOM\";\n+\t\t\t<File\n+\t\t\t\tRelativePath=\"$_\"/>\n+EOM\n+    }\n+    print F << \"EOM\";\n+\t\t</Filter>\n+\t</Files>\n+\t<Globals>\n+\t</Globals>\n+</VisualStudioProject>\n+EOM\n+    close F;\n+}\n+\n+sub createAppProject {\n+    my ($appname, $git_dir, $out_dir, $rel_dir, $build_structure) = @_;\n+    print \"Generate $appname vcproj app project\\n\";\n+    $rel_dir = \"..\\\\$rel_dir\";\n+    $rel_dir =~ s/\\//\\\\/g;\n+\n+    my $target = $appname;\n+    $target =~ s/\\//_/g;\n+    $target =~ s/\\.exe//;\n+\n+    my $uuid = $GUIDS[$guid_index];\n+    $$build_structure{\"APPS_${target}_GUID\"} = $uuid;\n+    $guid_index += 1;\n+\n+    my @srcs = sort(map(\"$rel_dir\\\\$_\", @{$$build_structure{\"APPS_${appname}_SOURCES\"}}));\n+    my @sources;\n+    foreach (@srcs) {\n+        $_ =~ s/\\//\\\\/g;\n+        push(@sources, $_);\n+    }\n+    my $defines = join(\",\", sort(@{$$build_structure{\"APPS_${appname}_DEFINES\"}}));\n+    my $includes= join(\";\", sort(map(\"&quot;$rel_dir\\\\$_&quot;\", @{$$build_structure{\"APPS_${appname}_INCLUDES\"}})));\n+    my $cflags  = join(\" \", sort(@{$$build_structure{\"APPS_${appname}_CFLAGS\"}}));\n+    $cflags =~ s/\\\"/&quot;/g;\n+\n+    my $cflags_debug = $cflags;\n+    $cflags_debug =~ s/-MT/-MTd/;\n+    $cflags_debug =~ s/-O.//;\n+\n+    my $cflags_release = $cflags;\n+    $cflags_release =~ s/-MTd/-MT/;\n+\n+    my $libs;\n+    foreach (sort(@{$$build_structure{\"APPS_${appname}_LIBS\"}})) {\n+        $_ =~ s/\\//_/g;\n+        $libs .= \" $_\";\n+    }\n+    my @tmp  = @{$$build_structure{\"APPS_${appname}_LFLAGS\"}};\n+    my @tmp2 = ();\n+    foreach (@tmp) {\n+        if (/^-LTCG/) {\n+        } elsif (/^-L/) {\n+            $_ =~ s/^-L/-LIBPATH:$rel_dir\\//;\n+        }\n+        push(@tmp2, $_);\n+    }\n+    my $lflags = join(\" \", sort(@tmp)) . \" -LIBPATH:$rel_dir\";\n+\n+    $defines =~ s/-D//g;\n+    $defines =~ s/\\\"/\\\\&quot;/g;\n+    $defines =~ s/\\'//g;\n+    $defines =~ s/\\\\\\\\/\\\\/g;\n+    $includes =~ s/-I//g;\n+    mkdir \"$target\" || die \"Could not create the directory $target for lib project!\\n\";\n+    open F, \">$target/$target.vcproj\" || die \"Could not open $target/$target.pro for writing!\\n\";\n+    print F << \"EOM\";\n+<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n+<VisualStudioProject\n+\tProjectType=\"Visual C++\"\n+\tVersion=\"9,00\"\n+\tName=\"$target\"\n+\tProjectGUID=\"$uuid\">\n+\t<Platforms>\n+\t\t<Platform\n+\t\t\tName=\"Win32\"/>\n+\t</Platforms>\n+\t<ToolFiles>\n+\t</ToolFiles>\n+\t<Configurations>\n+\t\t<Configuration\n+\t\t\tName=\"Debug|Win32\"\n+\t\t\tOutputDirectory=\"$rel_dir\"\n+\t\t\tConfigurationType=\"1\"\n+\t\t\tCharacterSet=\"0\"\n+\t\t\tIntermediateDirectory=\"\\$(ProjectDir)\\$(ConfigurationName)\"\n+\t\t\t>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreBuildEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCustomBuildTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCMIDLTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCLCompilerTool\"\n+\t\t\t\tAdditionalOptions=\"$cflags_debug\"\n+\t\t\t\tOptimization=\"0\"\n+\t\t\t\tInlineFunctionExpansion=\"1\"\n+\t\t\t\tAdditionalIncludeDirectories=\"$includes\"\n+\t\t\t\tPreprocessorDefinitions=\"UNICODE,WIN32,_DEBUG,$defines\"\n+\t\t\t\tMinimalRebuild=\"true\"\n+\t\t\t\tRuntimeLibrary=\"1\"\n+\t\t\t\tUsePrecompiledHeader=\"0\"\n+\t\t\t\tWarningLevel=\"3\"\n+\t\t\t\tDebugInformationFormat=\"3\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreLinkEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCLinkerTool\"\n+\t\t\t\tAdditionalDependencies=\"$libs\"\n+\t\t\t\tAdditionalOptions=\"$lflags\"\n+\t\t\t\tLinkIncremental=\"2\"\n+\t\t\t\tGenerateDebugInformation=\"true\"\n+\t\t\t\tSubSystem=\"1\"\n+\t\t\t\tTargetMachine=\"1\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCALinkTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXDCMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCBscMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCFxCopTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPostBuildEventTool\"\n+\t\t\t/>\n+\t\t</Configuration>\n+\t\t<Configuration\n+\t\t\tName=\"Release|Win32\"\n+\t\t\tOutputDirectory=\"$rel_dir\"\n+\t\t\tConfigurationType=\"1\"\n+\t\t\tCharacterSet=\"0\"\n+\t\t\tWholeProgramOptimization=\"1\"\n+\t\t\tIntermediateDirectory=\"\\$(ProjectDir)\\$(ConfigurationName)\"\n+\t\t\t>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreBuildEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCustomBuildTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCMIDLTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCLCompilerTool\"\n+\t\t\t\tAdditionalOptions=\"$cflags_release\"\n+\t\t\t\tOptimization=\"2\"\n+\t\t\t\tInlineFunctionExpansion=\"1\"\n+\t\t\t\tEnableIntrinsicFunctions=\"true\"\n+\t\t\t\tAdditionalIncludeDirectories=\"$includes\"\n+\t\t\t\tPreprocessorDefinitions=\"UNICODE,WIN32,NDEBUG,$defines\"\n+\t\t\t\tRuntimeLibrary=\"0\"\n+\t\t\t\tEnableFunctionLevelLinking=\"true\"\n+\t\t\t\tUsePrecompiledHeader=\"0\"\n+\t\t\t\tWarningLevel=\"3\"\n+\t\t\t\tDebugInformationFormat=\"3\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreLinkEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCLinkerTool\"\n+\t\t\t\tAdditionalDependencies=\"$libs\"\n+\t\t\t\tAdditionalOptions=\"$lflags\"\n+\t\t\t\tLinkIncremental=\"1\"\n+\t\t\t\tGenerateDebugInformation=\"true\"\n+\t\t\t\tSubSystem=\"1\"\n+\t\t\t\tTargetMachine=\"1\"\n+\t\t\t\tOptimizeReferences=\"2\"\n+\t\t\t\tEnableCOMDATFolding=\"2\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCALinkTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXDCMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCBscMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCFxCopTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPostBuildEventTool\"\n+\t\t\t/>\n+\t\t</Configuration>\n+\t</Configurations>\n+\t<Files>\n+\t\t<Filter\n+\t\t\tName=\"Source Files\"\n+\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\n+\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\n+EOM\n+    foreach(@sources) {\n+        print F << \"EOM\";\n+\t\t\t<File\n+\t\t\t\tRelativePath=\"$_\"/>\n+EOM\n+    }\n+    print F << \"EOM\";\n+\t\t</Filter>\n+\t</Files>\n+\t<Globals>\n+\t</Globals>\n+</VisualStudioProject>\n+EOM\n+    close F;\n+}\n+\n+sub createGlueProject {\n+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    print \"Generate solutions file\\n\";\n+    $rel_dir = \"..\\\\$rel_dir\";\n+    $rel_dir =~ s/\\//\\\\/g;\n+    my $SLN_HEAD = \"Microsoft Visual Studio Solution File, Format Version 10.00\\n\";\n+    my $SLN_PRE  = \"Project(\\\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\\\") = \";\n+    my $SLN_POST = \"\\nEndProject\\n\";\n+\n+    my @libs = @{$build_structure{\"LIBS\"}};\n+    my @tmp;\n+    foreach (@libs) {\n+        $_ =~ s/\\//_/g;\n+        $_ =~ s/\\.a//;\n+        push(@tmp, $_);\n+    }\n+    @libs = @tmp;\n+\n+    my @apps = @{$build_structure{\"APPS\"}};\n+    @tmp = ();\n+    foreach (@apps) {\n+        $_ =~ s/\\//_/g;\n+        $_ =~ s/\\.exe//;\n+        push(@tmp, $_);\n+    }\n+    @apps = @tmp;\n+\n+    open F, \">git.sln\" || die \"Could not open git.sln for writing!\\n\";\n+    print F \"$SLN_HEAD\";\n+    foreach (@libs) {\n+        my $libname = $_;\n+        my $uuid = $build_structure{\"LIBS_${libname}_GUID\"};\n+        print F \"$SLN_PRE\";\n+        print F \"\\\"${libname}\\\", \\\"${libname}\\\\${libname}.vcproj\\\", \\\"${uuid}\\\"\";\n+        print F \"$SLN_POST\";\n+    }\n+    foreach (@apps) {\n+        my $appname = $_;\n+        my $uuid = $build_structure{\"APPS_${appname}_GUID\"};\n+        print F \"$SLN_PRE\";\n+        print F \"\\\"${appname}\\\", \\\"${appname}\\\\${appname}.vcproj\\\", \\\"${uuid}\\\"\";\n+        print F \"$SLN_POST\";\n+    }\n+\n+    print F << \"EOM\";\n+Global\n+\tGlobalSection(SolutionConfiguration) = preSolution\n+\t\tConfigName.0 = Debug|Win32\n+\t\tConfigName.1 = Release|Win32\n+\tEndGlobalSection\n+\tGlobalSection(ProjectDependencies) = postSolution\n+EOM\n+    foreach (@{$build_structure{\"APPS\"}}) {\n+        my $appname = $_;\n+        my $appname_clean = $_;\n+        $appname_clean =~ s/\\//_/g;\n+        $appname_clean =~ s/\\.exe//;\n+\n+        my $uuid = $build_structure{\"APPS_${appname_clean}_GUID\"};\n+        my $dep_index = 0;\n+        foreach(@{$build_structure{\"APPS_${appname}_LIBS\"}}) {\n+            my $libname = $_;\n+            $libname =~ s/\\//_/g;\n+            $libname =~ s/\\.(a|lib)//;\n+            my $libuuid = $build_structure{\"LIBS_${libname}_GUID\"};\n+            if (defined $libuuid) {\n+                print F \"\\t\\t${uuid}.${dep_index} = ${libuuid}\\n\";\n+                $dep_index += 1;\n+            }\n+        }\n+    }\n+\n+    print F << \"EOM\";\n+\tEndGlobalSection\n+\tGlobalSection(ProjectConfiguration) = postSolution\n+EOM\n+    foreach (@libs) {\n+        my $libname = $_;\n+        my $uuid = $build_structure{\"LIBS_${libname}_GUID\"};\n+        print F \"\\t\\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Release|Win32.Build.0 = Release|Win32\\n\";\n+    }\n+    foreach (@apps) {\n+        my $appname = $_;\n+        my $uuid = $build_structure{\"APPS_${appname}_GUID\"};\n+        print F \"\\t\\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Release|Win32.Build.0 = Release|Win32\\n\";\n+    }\n+\n+    print F << \"EOM\";\n+\tEndGlobalSection\n+\tGlobalSection(ExtensibilityGlobals) = postSolution\n+\tEndGlobalSection\n+\tGlobalSection(ExtensibilityAddIns) = postSolution\n+\tEndGlobalSection\n+EndGlobal\n+EOM\n+    close F;\n+}\n+\n+1;\ndiff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl\nnew file mode 100644\nindex 0000000..20bd061\n--- /dev/null\n+++ b/contrib/buildsystems/engine.pl\n@@ -0,0 +1,353 @@\n+#!/usr/bin/perl -w\n+######################################################################\n+# Do not call this script directly!\n+#\n+# The generate script ensures that @INC is correct before the engine\n+# is executed.\n+#\n+# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>\n+######################################################################\n+use strict;\n+use File::Basename;\n+use File::Spec;\n+use Cwd;\n+use Generators;\n+\n+my (%build_structure, %compile_options, @makedry);\n+my $out_dir = getcwd();\n+my $git_dir = $out_dir;\n+$git_dir =~ s=\\\\=/=g;\n+$git_dir = dirname($git_dir) while (!-e \"$git_dir/git.c\" && \"$git_dir\" ne \"\");\n+die \"Couldn't find Git repo\" if (\"$git_dir\" eq \"\");\n+\n+my @gens = Generators::available();\n+my $gen = \"Vcproj\";\n+\n+sub showUsage\n+{\n+    my $genlist = join(', ', @gens);\n+    print << \"EOM\";\n+generate usage:\n+  -g <GENERATOR>  --gen <GENERATOR> Specify the buildsystem generator    (default: $gen)\n+                                    Available: $genlist\n+  -o <PATH>       --out <PATH>      Specify output directory generation  (default: .)\n+  -i <FILE>       --in <FILE>       Specify input file, instead of running GNU Make\n+  -h,-?           --help            This help\n+EOM\n+    exit 0;\n+}\n+\n+# Parse command-line options\n+while (@ARGV) {\n+    my $arg = shift @ARGV;\n+    if (\"$arg\" eq \"-h\" || \"$arg\" eq \"--help\" || \"$arg\" eq \"-?\") {\n+\tshowUsage();\n+\texit(0);\n+    } elsif(\"$arg\" eq \"--out\" || \"$arg\" eq \"-o\") {\n+\t$out_dir = shift @ARGV;\n+    } elsif(\"$arg\" eq \"--gen\" || \"$arg\" eq \"-g\") {\n+\t$gen = shift @ARGV;\n+    } elsif(\"$arg\" eq \"--in\" || \"$arg\" eq \"-i\") {\n+\tmy $infile = shift @ARGV;\n+        open(F, \"<$infile\") || die \"Couldn't open file $infile\";\n+        @makedry = <F>;\n+        close(F);\n+    }\n+}\n+\n+# NOT using File::Spec->rel2abs($path, $base) here, as\n+# it fails badly for me in the msysgit environment\n+$git_dir = File::Spec->rel2abs($git_dir);\n+$out_dir = File::Spec->rel2abs($out_dir);\n+my $rel_dir = makeOutRel2Git($git_dir, $out_dir);\n+\n+# Print some information so the user feels informed\n+print << \"EOM\";\n+-----\n+Generator: $gen\n+Git dir:   $git_dir\n+Out dir:   $out_dir\n+-----\n+Running GNU Make to figure out build structure...\n+EOM\n+\n+# Pipe a make --dry-run into a variable, if not already loaded from file\n+@makedry = `cd $git_dir && make -n MSVC=1 V=1 2>/dev/null` if !@makedry;\n+\n+# Parse the make output into usable info\n+parseMakeOutput();\n+\n+# Finally, ask the generator to start generating..\n+Generators::generate($gen, $git_dir, $out_dir, $rel_dir, %build_structure);\n+\n+# main flow ends here\n+# -------------------------------------------------------------------------------------------------\n+\n+\n+# 1) path: /foo/bar/baz        2) path: /foo/bar/baz   3) path: /foo/bar/baz\n+#    base: /foo/bar/baz/temp      base: /foo/bar          base: /tmp\n+#    rel:  ..                     rel:  baz               rel:  ../foo/bar/baz\n+sub makeOutRel2Git\n+{\n+    my ($path, $base) = @_;\n+    my $rel;\n+    if (\"$path\" eq \"$base\") {\n+        return \".\";\n+    } elsif ($base =~ /^$path/) {\n+        # case 1\n+        my $tmp = $base;\n+        $tmp =~ s/^$path//;\n+        foreach (split('/', $tmp)) {\n+            $rel .= \"../\" if (\"$_\" ne \"\");\n+        }\n+    } elsif ($path =~ /^$base/) {\n+        # case 2\n+        $rel = $path;\n+        $rel =~ s/^$base//;\n+        $rel = \"./$rel\";\n+    } else {\n+        my $tmp = $base;\n+        foreach (split('/', $tmp)) {\n+            $rel .= \"../\" if (\"$_\" ne \"\");\n+        }\n+        $rel .= $path;\n+    }\n+    $rel =~ s/\\/\\//\\//g; # simplify\n+    $rel =~ s/\\/$//;     # don't end with /\n+    return $rel;\n+}\n+\n+sub parseMakeOutput\n+{\n+    print \"Parsing GNU Make output to figure out build structure...\\n\";\n+    my $line = 0;\n+    while (my $text = shift @makedry) {\n+        my $ate_next;\n+        do {\n+            $ate_next = 0;\n+            $line++;\n+            chomp $text;\n+            chop $text if ($text =~ /\\r$/);\n+            if ($text =~ /\\\\$/) {\n+                $text =~ s/\\\\$//;\n+                $text .= shift @makedry;\n+                $ate_next = 1;\n+            }\n+        } while($ate_next);\n+\n+        if($text =~ / -c /) {\n+            # compilation\n+            handleCompileLine($text, $line);\n+\n+        } elsif ($text =~ / -o /) {\n+            # linking executable\n+            handleLinkLine($text, $line);\n+\n+        } elsif ($text =~ /\\.o / && $text =~ /\\.a /) {\n+            # libifying\n+            handleLibLine($text, $line);\n+#\n+#        } elsif ($text =~ /^cp /) {\n+#            # copy file around\n+#\n+#        } elsif ($text =~ /^rm -f /) {\n+#            # shell command\n+#\n+#        } elsif ($text =~ /^make[ \\[]/) {\n+#            # make output\n+#\n+#        } elsif ($text =~ /^echo /) {\n+#            # echo to file\n+#\n+#        } elsif ($text =~ /^if /) {\n+#            # shell conditional\n+#\n+#        } elsif ($text =~ /^tclsh /) {\n+#            # translation stuff\n+#\n+#        } elsif ($text =~ /^umask /) {\n+#            # handling boilerplates\n+#\n+#        } elsif ($text =~ /\\$\\(\\:\\)/) {\n+#            # ignore\n+#\n+#        } elsif ($text =~ /^FLAGS=/) {\n+#            # flags check for dependencies\n+#\n+#        } elsif ($text =~ /^'\\/usr\\/bin\\/perl' -MError -e/) {\n+#            # perl commands for copying files\n+#\n+#        } elsif ($text =~ /generate-cmdlist\\.sh/) {\n+#            # command for generating list of commands\n+#\n+#        } elsif ($text =~ /^test / && $text =~ /|| rm -f /) {\n+#            # commands removing executables, if they exist\n+#\n+#        } elsif ($text =~ /new locations or Tcl/) {\n+#            # command for detecting Tcl/Tk changes\n+#\n+#        } elsif ($text =~ /mkdir -p/) {\n+#            # command creating path\n+#\n+#        } elsif ($text =~ /: no custom templates yet/) {\n+#            # whatever\n+#\n+#        } else {\n+#            print \"Unhandled (line: $line): $text\\n\";\n+        }\n+    }\n+\n+#    use Data::Dumper;\n+#    print \"Parsed build structure:\\n\";\n+#    print Dumper(%build_structure);\n+}\n+\n+# variables for the compilation part of each step\n+my (@defines, @incpaths, @cflags, @sources);\n+\n+sub clearCompileStep\n+{\n+    @defines = ();\n+    @incpaths = ();\n+    @cflags = ();\n+    @sources = ();\n+}\n+\n+sub removeDuplicates\n+{\n+    my (%dupHash, $entry);\n+    %dupHash = map { $_, 1 } @defines;\n+    @defines = keys %dupHash;\n+\n+    %dupHash = map { $_, 1 } @incpaths;\n+    @incpaths = keys %dupHash;\n+\n+    %dupHash = map { $_, 1 } @cflags;\n+    @cflags = keys %dupHash;\n+}\n+\n+sub handleCompileLine\n+{\n+    my ($line, $lineno) = @_;\n+    my @parts = split(' ', $line);\n+    my $sourcefile;\n+    shift(@parts); # ignore cmd\n+    while (my $part = shift @parts) {\n+        if (\"$part\" eq \"-o\") {\n+            # ignore object file\n+            shift @parts;\n+        } elsif (\"$part\" eq \"-c\") {\n+            # ignore compile flag\n+        } elsif (\"$part\" eq \"-c\") {\n+        } elsif ($part =~ /^.?-I/) {\n+            push(@incpaths, $part);\n+        } elsif ($part =~ /^.?-D/) {\n+            push(@defines, $part);\n+        } elsif ($part =~ /^-/) {\n+            push(@cflags, $part);\n+        } elsif ($part =~ /\\.(c|cc|cpp)$/) {\n+            $sourcefile = $part;\n+        } else {\n+            die \"Unhandled compiler option @ line $lineno: $part\";\n+        }\n+    }\n+    @{$compile_options{\"${sourcefile}_CFLAGS\"}} = @cflags;\n+    @{$compile_options{\"${sourcefile}_DEFINES\"}} = @defines;\n+    @{$compile_options{\"${sourcefile}_INCPATHS\"}} = @incpaths;\n+    clearCompileStep();\n+}\n+\n+sub handleLibLine\n+{\n+    my ($line, $lineno) = @_;\n+    my (@objfiles, @lflags, $libout, $part);\n+    # kill cmd and rm 'prefix'\n+    $line =~ s/^rm -f .* && .* rcs //;\n+    my @parts = split(' ', $line);\n+    while ($part = shift @parts) {\n+        if ($part =~ /^-/) {\n+            push(@lflags, $part);\n+        } elsif ($part =~ /\\.(o|obj)$/) {\n+            push(@objfiles, $part);\n+        } elsif ($part =~ /\\.(a|lib)$/) {\n+            $libout = $part;\n+            $libout =~ s/\\.a$//;\n+        } else {\n+            die \"Unhandled lib option @ line $lineno: $part\";\n+        }\n+    }\n+#    print \"LibOut: '$libout'\\nLFlags: @lflags\\nOfiles: @objfiles\\n\";\n+#    exit(1);\n+    foreach (@objfiles) {\n+        my $sourcefile = $_;\n+        $sourcefile =~ s/\\.o/.c/;\n+        push(@sources, $sourcefile);\n+        push(@cflags, @{$compile_options{\"${sourcefile}_CFLAGS\"}});\n+        push(@defines, @{$compile_options{\"${sourcefile}_DEFINES\"}});\n+        push(@incpaths, @{$compile_options{\"${sourcefile}_INCPATHS\"}});\n+    }\n+    removeDuplicates();\n+\n+    push(@{$build_structure{\"LIBS\"}}, $libout);\n+    @{$build_structure{\"LIBS_${libout}\"}} = (\"_DEFINES\", \"_INCLUDES\", \"_CFLAGS\", \"_SOURCES\",\n+                                             \"_OBJECTS\");\n+    @{$build_structure{\"LIBS_${libout}_DEFINES\"}} = @defines;\n+    @{$build_structure{\"LIBS_${libout}_INCLUDES\"}} = @incpaths;\n+    @{$build_structure{\"LIBS_${libout}_CFLAGS\"}} = @cflags;\n+    @{$build_structure{\"LIBS_${libout}_LFLAGS\"}} = @lflags;\n+    @{$build_structure{\"LIBS_${libout}_SOURCES\"}} = @sources;\n+    @{$build_structure{\"LIBS_${libout}_OBJECTS\"}} = @objfiles;\n+    clearCompileStep();\n+}\n+\n+sub handleLinkLine\n+{\n+    my ($line, $lineno) = @_;\n+    my (@objfiles, @lflags, @libs, $appout, $part);\n+    my @parts = split(' ', $line);\n+    shift(@parts); # ignore cmd\n+    while ($part = shift @parts) {\n+        if ($part =~ /^-IGNORE/) {\n+            push(@lflags, $part);\n+        } elsif ($part =~ /^-[GRIMDO]/) {\n+            # eat compiler flags\n+        } elsif (\"$part\" eq \"-o\") {\n+            $appout = shift @parts;\n+        } elsif (\"$part\" eq \"-lz\") {\n+            push(@libs, \"zlib.lib\");\n+        } elsif ($part =~ /^-/) {\n+            push(@lflags, $part);\n+        } elsif ($part =~ /\\.(a|lib)$/) {\n+            $part =~ s/\\.a$/.lib/;\n+            push(@libs, $part);\n+        } elsif ($part =~ /\\.(o|obj)$/) {\n+            push(@objfiles, $part);\n+        } else {\n+            die \"Unhandled lib option @ line $lineno: $part\";\n+        }\n+    }\n+#    print \"AppOut: '$appout'\\nLFlags: @lflags\\nLibs  : @libs\\nOfiles: @objfiles\\n\";\n+#    exit(1);\n+    foreach (@objfiles) {\n+        my $sourcefile = $_;\n+        $sourcefile =~ s/\\.o/.c/;\n+        push(@sources, $sourcefile);\n+        push(@cflags, @{$compile_options{\"${sourcefile}_CFLAGS\"}});\n+        push(@defines, @{$compile_options{\"${sourcefile}_DEFINES\"}});\n+        push(@incpaths, @{$compile_options{\"${sourcefile}_INCPATHS\"}});\n+    }\n+    removeDuplicates();\n+\n+    removeDuplicates();\n+    push(@{$build_structure{\"APPS\"}}, $appout);\n+    @{$build_structure{\"APPS_${appout}\"}} = (\"_DEFINES\", \"_INCLUDES\", \"_CFLAGS\", \"_LFLAGS\",\n+                                             \"_SOURCES\", \"_OBJECTS\", \"_LIBS\");\n+    @{$build_structure{\"APPS_${appout}_DEFINES\"}} = @defines;\n+    @{$build_structure{\"APPS_${appout}_INCLUDES\"}} = @incpaths;\n+    @{$build_structure{\"APPS_${appout}_CFLAGS\"}} = @cflags;\n+    @{$build_structure{\"APPS_${appout}_LFLAGS\"}} = @lflags;\n+    @{$build_structure{\"APPS_${appout}_SOURCES\"}} = @sources;\n+    @{$build_structure{\"APPS_${appout}_OBJECTS\"}} = @objfiles;\n+    @{$build_structure{\"APPS_${appout}_LIBS\"}} = @libs;\n+    clearCompileStep();\n+}\ndiff --git a/contrib/buildsystems/generate b/contrib/buildsystems/generate\nnew file mode 100644\nindex 0000000..bc10f25\n--- /dev/null\n+++ b/contrib/buildsystems/generate\n@@ -0,0 +1,29 @@\n+#!/usr/bin/perl -w\n+######################################################################\n+# Generate buildsystem files\n+#\n+# This script generate buildsystem files based on the output of a\n+# GNU Make --dry-run, enabling Windows users to develop Git with their\n+# trusted IDE with native projects.\n+#\n+# Note:\n+# It is not meant as *the* way of building Git with MSVC, but merely a\n+# convenience. The correct way of building Git with MSVC is to use the\n+# GNU Make tool to build with the maintained Makefile in the root of\n+# the project. If you have the msysgit environment installed and\n+# available in your current console, together with the Visual Studio\n+# environment you wish to build for, all you have to do is run the\n+# command:\n+#     make MSVC=1\n+#\n+# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>\n+######################################################################\n+use strict;\n+use File::Basename;\n+use Cwd;\n+\n+my $git_dir = getcwd();\n+$git_dir =~ s=\\\\=/=g;\n+$git_dir = dirname($git_dir) while (!-e \"$git_dir/git.c\" && \"$git_dir\" ne \"\");\n+die \"Couldn't find Git repo\" if (\"$git_dir\" eq \"\");\n+exec join(\" \", (\"PERL5LIB=${git_dir}/contrib/buildsystems ${git_dir}/contrib/buildsystems/engine.pl\", @ARGV));\ndiff --git a/contrib/buildsystems/parse.pl b/contrib/buildsystems/parse.pl\nnew file mode 100644\nindex 0000000..c9656ec\n--- /dev/null\n+++ b/contrib/buildsystems/parse.pl\n@@ -0,0 +1,228 @@\n+#!/usr/bin/perl -w\n+######################################################################\n+# Do not call this script directly!\n+#\n+# The generate script ensures that @INC is correct before the engine\n+# is executed.\n+#\n+# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>\n+######################################################################\n+use strict;\n+use File::Basename;\n+use Cwd;\n+\n+my $file = $ARGV[0];\n+die \"No file provided!\" if !defined $file;\n+\n+my ($cflags, $target, $type, $line);\n+\n+open(F, \"<$file\") || die \"Couldn't open file $file\";\n+my @data = <F>;\n+close(F);\n+\n+while (my $text = shift @data) {\n+    my $ate_next;\n+    do {\n+        $ate_next = 0;\n+        $line++;\n+        chomp $text;\n+        chop $text if ($text =~ /\\r$/);\n+        if ($text =~ /\\\\$/) {\n+            $text =~ s/\\\\$//;\n+            $text .= shift @data;\n+            $ate_next = 1;\n+        }\n+    } while($ate_next);\n+\n+    if($text =~ / -c /) {\n+        # compilation\n+        handleCompileLine($text, $line);\n+\n+    } elsif ($text =~ / -o /) {\n+        # linking executable\n+        handleLinkLine($text, $line);\n+\n+    } elsif ($text =~ /\\.o / && $text =~ /\\.a /) {\n+        # libifying\n+        handleLibLine($text, $line);\n+\n+#    } elsif ($text =~ /^cp /) {\n+#        # copy file around\n+#\n+#    } elsif ($text =~ /^rm -f /) {\n+#        # shell command\n+#\n+#    } elsif ($text =~ /^make[ \\[]/) {\n+#        # make output\n+#\n+#    } elsif ($text =~ /^echo /) {\n+#        # echo to file\n+#\n+#    } elsif ($text =~ /^if /) {\n+#        # shell conditional\n+#\n+#    } elsif ($text =~ /^tclsh /) {\n+#        # translation stuff\n+#\n+#    } elsif ($text =~ /^umask /) {\n+#        # handling boilerplates\n+#\n+#    } elsif ($text =~ /\\$\\(\\:\\)/) {\n+#        # ignore\n+#\n+#    } elsif ($text =~ /^FLAGS=/) {\n+#        # flags check for dependencies\n+#\n+#    } elsif ($text =~ /^'\\/usr\\/bin\\/perl' -MError -e/) {\n+#        # perl commands for copying files\n+#\n+#    } elsif ($text =~ /generate-cmdlist\\.sh/) {\n+#        # command for generating list of commands\n+#\n+#    } elsif ($text =~ /^test / && $text =~ /|| rm -f /) {\n+#        # commands removing executables, if they exist\n+#\n+#    } elsif ($text =~ /new locations or Tcl/) {\n+#        # command for detecting Tcl/Tk changes\n+#\n+#    } elsif ($text =~ /mkdir -p/) {\n+#        # command creating path\n+#\n+#    } elsif ($text =~ /: no custom templates yet/) {\n+#        # whatever\n+\n+    } else {\n+#        print \"Unhandled (line: $line): $text\\n\";\n+    }\n+}\n+close(F);\n+\n+# use Data::Dumper;\n+# print \"Parsed build structure:\\n\";\n+# print Dumper(%build_structure);\n+\n+# -------------------------------------------------------------------\n+# Functions under here\n+# -------------------------------------------------------------------\n+my (%build_structure, @defines, @incpaths, @cflags, @sources);\n+\n+sub clearCompileStep\n+{\n+    @defines = ();\n+    @incpaths = ();\n+    @cflags = ();\n+    @sources = ();\n+}\n+\n+sub removeDuplicates\n+{\n+    my (%dupHash, $entry);\n+    %dupHash = map { $_, 1 } @defines;\n+    @defines = keys %dupHash;\n+\n+    %dupHash = map { $_, 1 } @incpaths;\n+    @incpaths = keys %dupHash;\n+\n+    %dupHash = map { $_, 1 } @cflags;\n+    @cflags = keys %dupHash;\n+\n+    %dupHash = map { $_, 1 } @sources;\n+    @sources = keys %dupHash;\n+}\n+\n+sub handleCompileLine\n+{\n+    my ($line, $lineno) = @_;\n+    my @parts = split(' ', $line);\n+    shift(@parts); # ignore cmd\n+    while (my $part = shift @parts) {\n+        if (\"$part\" eq \"-o\") {\n+            # ignore object file\n+            shift @parts;\n+        } elsif (\"$part\" eq \"-c\") {\n+            # ignore compile flag\n+        } elsif (\"$part\" eq \"-c\") {\n+        } elsif ($part =~ /^.?-I/) {\n+            push(@incpaths, $part);\n+        } elsif ($part =~ /^.?-D/) {\n+            push(@defines, $part);\n+        } elsif ($part =~ /^-/) {\n+            push(@cflags, $part);\n+        } elsif ($part =~ /\\.(c|cc|cpp)$/) {\n+            push(@sources, $part);\n+        } else {\n+            die \"Unhandled compiler option @ line $lineno: $part\";\n+        }\n+    }\n+    #print \"Sources: @sources\\nCFlags: @cflags\\nDefine: @defines\\nIncpat: @incpaths\\n\";\n+    #exit(1);\n+}\n+\n+sub handleLibLine\n+{\n+    my ($line, $lineno) = @_;\n+    my (@objfiles, @lflags, $libout, $part);\n+    # kill cmd and rm 'prefix'\n+    $line =~ s/^rm -f .* && .* rcs //;\n+    my @parts = split(' ', $line);\n+    while ($part = shift @parts) {\n+        if ($part =~ /^-/) {\n+            push(@lflags, $part);\n+        } elsif ($part =~ /\\.(o|obj)$/) {\n+            push(@objfiles, $part);\n+        } elsif ($part =~ /\\.(a|lib)$/) {\n+            $libout = $part;\n+        } else {\n+            die \"Unhandled lib option @ line $lineno: $part\";\n+        }\n+    }\n+    #print \"LibOut: '$libout'\\nLFlags: @lflags\\nOfiles: @objfiles\\n\";\n+    #exit(1);\n+    removeDuplicates();\n+    push(@{$build_structure{\"LIBS\"}}, $libout);\n+    @{$build_structure{\"LIBS_${libout}\"}} = (\"_DEFINES\", \"_INCLUDES\", \"_CFLAGS\", \"_SOURCES\",\n+                                             \"_OBJECTS\");\n+    @{$build_structure{\"LIBS_${libout}_DEFINES\"}} = @defines;\n+    @{$build_structure{\"LIBS_${libout}_INCLUDES\"}} = @incpaths;\n+    @{$build_structure{\"LIBS_${libout}_CFLAGS\"}} = @cflags;\n+    @{$build_structure{\"LIBS_${libout}_SOURCES\"}} = @sources;\n+    @{$build_structure{\"LIBS_${libout}_OBJECTS\"}} = @objfiles;\n+    clearCompileStep();\n+}\n+\n+sub handleLinkLine\n+{\n+    my ($line, $lineno) = @_;\n+    my (@objfiles, @lflags, @libs, $appout, $part);\n+    my @parts = split(' ', $line);\n+    shift(@parts); # ignore cmd\n+    while ($part = shift @parts) {\n+        if ($part =~ /^-[GRIDO]/) {\n+            # eat compiler flags\n+        } elsif (\"$part\" eq \"-o\") {\n+            $appout = shift @parts;\n+        } elsif ($part =~ /^-/) {\n+            push(@lflags, $part);\n+        } elsif ($part =~ /\\.(a|lib)$/) {\n+            push(@libs, $part);\n+        } elsif ($part =~ /\\.(o|obj)$/) {\n+            push(@objfiles, $part);\n+        } else {\n+            die \"Unhandled lib option @ line $lineno: $part\";\n+        }\n+    }\n+    #print \"AppOut: '$appout'\\nLFlags: @lflags\\nLibs  : @libs\\nOfiles: @objfiles\\n\";\n+    #exit(1);\n+    removeDuplicates();\n+    push(@{$build_structure{\"APPS\"}}, $appout);\n+    @{$build_structure{\"APPS_${appout}\"}} = (\"_DEFINES\", \"_INCLUDES\", \"_CFLAGS\", \"_LFLAGS\",\n+                                             \"_SOURCES\", \"_OBJECTS\", \"_LIBS\");\n+    @{$build_structure{\"APPS_${appout}_DEFINES\"}} = @defines;\n+    @{$build_structure{\"APPS_${appout}_INCLUDES\"}} = @incpaths;\n+    @{$build_structure{\"APPS_${appout}_CFLAGS\"}} = @cflags;\n+    @{$build_structure{\"APPS_${appout}_LFLAGS\"}} = @lflags;\n+    @{$build_structure{\"APPS_${appout}_SOURCES\"}} = @sources;\n+    @{$build_structure{\"APPS_${appout}_OBJECTS\"}} = @objfiles;\n+    @{$build_structure{\"APPS_${appout}_LIBS\"}} = @libs;\n+    clearCompileStep();\n+}\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123325","messageId":"894136433cc5b03a4b89a1f9c0e4f8a2704222fa.1253088099.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"aa80ad559c731ca73179956e34b2743d903fbbec.1253088099.git.mstormo@gmail.com","subject":"[RFC 15/15] Tag GIT_VERSION when Git is built with MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T08:20:31Z","receivedAt":"2009-09-16T08:20:31Z","isPatch":false,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nThis may help us debug issues on Windows, as we now can build Git\nnatively on Windows with both MinGW and MSVC.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n I'm just throwing this one out there. If people think manipulating\n the version here, to ease debugging, I don't mind if this patch is\n squashed into patch 12.\n If people don't like it, just skip this path.\n \n Makefile |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex aa918eb..2c20922 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -878,6 +878,7 @@ ifneq (,$(findstring CYGWIN,$(uname_S)))\n \tUNRELIABLE_FSTAT = UnfortunatelyYes\n endif\n ifdef MSVC\n+\tGIT_VERSION := $(GIT_VERSION).MSVC\n \tpathsep = ;\n \tNO_PREAD = YesPlease\n \tNO_OPENSSL = YesPlease\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123328","messageId":"40aa078e0909160242s4110ca8fj1e44e1e228676704@mail.gmail.com","threadId":"20965","inReplyTo":"26c067500d8adf17a2d75e2956e4d4a6cef27fc1.1253088099.git.mstormo@gmail.com","subject":"Re: [msysGit] [PATCH 02/15] Add define guards to compat/win32.h","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-09-16T09:42:10Z","receivedAt":"2009-09-16T09:42:10Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Wed, Sep 16, 2009 at 10:20 AM, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n> --- a/compat/win32.h\n> +++ b/compat/win32.h\n> @@ -1,3 +1,6 @@\n> +#ifndef WIN32_H\n> +#define WIN32_H\n> +\n>  /* common Win32 functions for MinGW and Cygwin */\n>  #include <windows.h>\n>\n> @@ -32,3 +35,5 @@ static inline int get_file_attr(const char *fname, WIN32_FILE_ATTRIBUTE_DATA *fd\n>                return ENOENT;\n>        }\n>  }\n> +\n> +#endif\n\nAren't these usually called \"include guards\" instead of \"define guards\"?\n\n-- \nErik \"kusma\" Faye-Lund\nkusmabite@gmail.com\n(+47) 986 59 656\n"},{"id":"123331","messageId":"4AB0B98A.6090006@gmail.com","threadId":"20965","inReplyTo":"40aa078e0909160242s4110ca8fj1e44e1e228676704@mail.gmail.com","subject":"Re: [msysGit] [PATCH 02/15] Add define guards to compat/win32.h","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-16T10:10:18Z","receivedAt":"2009-09-16T10:10:18Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Erik Faye-Lund said the following on 16.09.2009 11:42:\n> On Wed, Sep 16, 2009 at 10:20 AM, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n>> --- a/compat/win32.h\n>> +++ b/compat/win32.h\n>> @@ -1,3 +1,6 @@\n>> +#ifndef WIN32_H\n>> +#define WIN32_H\n> \n> Aren't these usually called \"include guards\" instead of \"define guards\"?\n\nYup, of course they are. *thump*\n\n--\n.marius\n"},{"id":"123355","messageId":"4AB10F01.9010703@viscovery.net","threadId":"20965","inReplyTo":"929c5a34cd2621af24bcda7e47ff2e76b51c2e09.1253088099.git.mstormo@gmail.com","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-09-16T16:14:57Z","receivedAt":"2009-09-16T16:14:57Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"\nMarius Storm-Olsen schrieb:\n> From: Marius Storm-Olsen <marius.storm-olsen@nokia.com>\n> \n> MinGW set the _CRT_fmode to set both the default fmode and\n> _O_BINARY on stdin/stdout/stderr. Rather use the main()\n> define in mingw.h to set this for both MinGW and MSVC.\n> \n> This will ensure that a MinGW and MSVC build will handle\n> input and output identically.\n\nThis one breaks t5302-pack-index.sh (test 15, \"[index v1] 2) create a\nstealth corruption in a delta base reference\") in my MinGW build. I have\nyet to find out what exactly goes wrong and how it could be fixed.\n\n-- Hannes\n"},{"id":"123368","messageId":"e2480c70909161300o3db4b416k8f33ccce2f987c55@mail.gmail.com","threadId":"20965","inReplyTo":"4AB10F01.9010703@viscovery.net","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Alexey Borzenkov","fromEmail":"snaury@gmail.com","sentAt":"2009-09-16T20:00:38Z","receivedAt":"2009-09-16T20:00:38Z","isPatch":true,"sender":{"key":"snaury@gmail.com","avatar":"https://gravatar.com/avatar/dd9f652303405e256f31e18690cea19ffcf21b83b04f746957334f62e399d95d?d=mp&s=160"},"body":"On Wed, Sep 16, 2009 at 8:14 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>> MinGW set the _CRT_fmode to set both the default fmode and\n>> _O_BINARY on stdin/stdout/stderr. Rather use the main()\n>> define in mingw.h to set this for both MinGW and MSVC.\n>>\n>> This will ensure that a MinGW and MSVC build will handle\n>> input and output identically.\n> This one breaks t5302-pack-index.sh (test 15, \"[index v1] 2) create a\n> stealth corruption in a delta base reference\") in my MinGW build. I have\n> yet to find out what exactly goes wrong and how it could be fixed.\n\nLooks like calling _setmode in main is too late for something. :-/\n\nI tried defining int _fmode in mingw.c (which sets msvcrt's _fmode\nearly, without calling _setmode), and it didn't work either (i.e. the\nbug was still happening). So the culprit must be in _setmode. I also\ntried logging what index_obj_offset and index_obj_nr are showing, and\nhere are results:\n\n/* with _CRT_fmode = _O_BINARY */\nindex_obj_offset: 844032\nindex_obj_nr: 205\n\n/* without _CRT_fmode = _O_BINARY */\nindex_obj_offset: 844235\nindex_obj_nr: 298\n\nI then tried to see what git show-index actually returns there, and\nhere are several top lines of the results:\n\n/* with _CRT_fmode = _O_BINARY */\n850186 0106e17481932f5c223fafadc1d26abc6adf40d6\n203652 01179d82b18c252824e20e190543e0e84950d820\n15576 0246ff570c396c37ff08c0f5f9d88c84fc21a297\n851536 035e7e54cee9eb197af435b6b6dcced489c233f6\n376062 03a6f56dbbb556425ef8c43c31519b32eb5629a4\n39452 0471b3b8ab8da19f3968dc238e9555f4e48ce858\n8230 0483297992ed4cd5ab3b5790912b1f03598ea660\n72292 0508b858e01f0367552fb14722388ba48dbd36f7\n\n/* without _CRT_fmode = _O_BINARY */\n844235 01a8d3f6d063d48baf40ee656804aa58486a34b2\n851754 035e7e54cee9eb197af435b6b6dcced489c233f6\n851844 04ff7bd225fbb4842697af96c147a4ddecb6a657\n848233 088ddcb945af72c47348b65a63992c71b6b9dbe8\n849676 088e69e7ab273e35b4f63ecb1b915a3997f13dff\n14825 09bd72201f82a0da14a52230e2ccd0e43529e779\n9848 0a5916ad398380ba103d98bad6fa4f2b20b74e75\n695905 0ae5469e687083bbf954262873ee8c0c7d017e75\n\nAs you can see the hashes are completely different! Unfortunately I\nalso can't pinpoint where this actually happens... :-/\n\n*several minutes later*\n\nSearching which executables set _fmode and which don't I found the\nculprit. test-genrandom.c didn't include git-compat-util.h, so mingw.h\nwas never included. This caused different random data to be generated,\nand as it seems more importantly, of different sizes. Can be fixed\nwith this patch:\n\ndiff --git a/test-genrandom.c b/test-genrandom.c\nindex 8ad276d..b3c28d9 100644\n--- a/test-genrandom.c\n+++ b/test-genrandom.c\n@@ -4,8 +4,7 @@\n  * Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2.\n  */\n\n-#include <stdio.h>\n-#include <stdlib.h>\n+#include \"git-compat-util.h\"\n\n int main(int argc, char *argv[])\n {\n\nOr maybe there's a hidden bug in git that gets uncovered with slightly\ndifferent random data, I don't know. I'm glad I could finally solve\nthis mindbending issue. :)\n"},{"id":"123414","messageId":"4AB1E118.70504@viscovery.net","threadId":"20965","inReplyTo":"e2480c70909161300o3db4b416k8f33ccce2f987c55@mail.gmail.com","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-09-17T07:11:20Z","receivedAt":"2009-09-17T07:11:20Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Alexey Borzenkov schrieb:\n> Searching which executables set _fmode and which don't I found the\n> culprit. test-genrandom.c didn't include git-compat-util.h, so mingw.h\n> was never included. This caused different random data to be generated,\n> and as it seems more importantly, of different sizes. Can be fixed\n> with this patch:\n> \n> diff --git a/test-genrandom.c b/test-genrandom.c\n> index 8ad276d..b3c28d9 100644\n> --- a/test-genrandom.c\n> +++ b/test-genrandom.c\n> @@ -4,8 +4,7 @@\n>   * Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2.\n>   */\n> \n> -#include <stdio.h>\n> -#include <stdlib.h>\n> +#include \"git-compat-util.h\"\n> \n>  int main(int argc, char *argv[])\n>  {\n\nThanks for digging this out. With this change, the t5302 passes again.\n\nI verified that the SHA1s that are generated with this fix are identical\nto those that are generated on Linux. (And without this fix they are\ndifferent.)\n\nJust for the records: The reason why including git-compat-util.h was not\nnecessary before 04/15 is that test-genrandom is linked against libgit.a.\nThis way the startup code had picked up the definition of _CRT_fmode from\nmingw.c that is initialized to _O_BINARY. After the original 04/15 this\nsymbol was not present anymore in libgit.a, and the default (text mode)\nwas used. And with this fix, main() is overridden to explicitly set the\nmode of stdout to _O_BINARY.\n\n-- Hannes\n"},{"id":"123418","messageId":"7vfxamjamq.fsf@alter.siamese.dyndns.org","threadId":"20965","inReplyTo":"4AB1E118.70504@viscovery.net","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-17T07:25:33Z","receivedAt":"2009-09-17T07:25:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\nJohannes Sixt <j.sixt@viscovery.net> writes:\n\n> Just for the records: The reason why including git-compat-util.h was not\n> necessary before 04/15 is that test-genrandom is linked against libgit.a.\n> This way the startup code had picked up the definition of _CRT_fmode from\n> mingw.c that is initialized to _O_BINARY. After the original 04/15 this\n> symbol was not present anymore in libgit.a, and the default (text mode)\n> was used. And with this fix, main() is overridden to explicitly set the\n> mode of stdout to _O_BINARY.\n\nBeautiful.  I think it is worth mentioning some of the above in the commit\nlog message.\n\nThanks.\n"},{"id":"123419","messageId":"4AB1E4C5.80102@gmail.com","threadId":"20965","inReplyTo":"4AB1E118.70504@viscovery.net","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-17T07:27:01Z","receivedAt":"2009-09-17T07:27:01Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Johannes Sixt said the following on 17.09.2009 09:11:\n> Alexey Borzenkov schrieb:\n>> Searching which executables set _fmode and which don't I found the\n>> culprit. test-genrandom.c didn't include git-compat-util.h, so mingw.h\n>> was never included. This caused different random data to be generated,\n>> and as it seems more importantly, of different sizes. Can be fixed\n>> with this patch:\n>>\n>> diff --git a/test-genrandom.c b/test-genrandom.c\n>> index 8ad276d..b3c28d9 100644\n>> --- a/test-genrandom.c\n>> +++ b/test-genrandom.c\n>> @@ -4,8 +4,7 @@\n>>   * Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2.\n>>   */\n>>\n>> -#include <stdio.h>\n>> -#include <stdlib.h>\n>> +#include \"git-compat-util.h\"\n>>\n>>  int main(int argc, char *argv[])\n>>  {\n> \n> Thanks for digging this out. With this change, the t5302 passes again.\n\nYup, are you ok with squashing this hunk into the patch then?\n\n--\n.marius\n"},{"id":"123421","messageId":"4AB1E6E4.1040100@viscovery.net","threadId":"20965","inReplyTo":"4AB1E4C5.80102@gmail.com","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-09-17T07:36:04Z","receivedAt":"2009-09-17T07:36:04Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Marius Storm-Olsen schrieb:\n> Yup, are you ok with squashing this hunk into the patch then?\n\nOf course; with some extra words in the commit message.\n\n-- Hannes\n"},{"id":"123423","messageId":"4AB1EB02.2090308@gmail.com","threadId":"20965","inReplyTo":"4AB1E6E4.1040100@viscovery.net","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-17T07:53:38Z","receivedAt":"2009-09-17T07:53:38Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Johannes Sixt said the following on 17.09.2009 09:36:\n> Marius Storm-Olsen schrieb:\n>> Yup, are you ok with squashing this hunk into the patch then?\n> \n> Of course; with some extra words in the commit message.\n\nGreat. Hold tight, I'll resend an updated version.\n\nBTW, I ran all the tests (make /k test) before and after the\nwhole series, with msysgit 'devel' branch + plain git.git 'next',\nand it turns out that 2 more tests pass after this series :)\n\nBefore:\nfixed   4\nsuccess 4017\nfailed  380\nbroken  9\ntotal   4524\n\nAfter:\nfixed   4\nsuccess 4019\nfailed  378\nbroken  9\ntotal   4524\n\nBoth complete logs attached in 7zip format.\n\n--\n.marius\n"},{"id":"123424","messageId":"1eeb32498237638df6d954dc65ab5372dd0f04c9.1253174364.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"929c5a34cd2621af24bcda7e47ff2e76b51c2e09.1253088099.git.mstormo@gmail.com","subject":"[PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-17T08:02:51Z","receivedAt":"2009-09-17T08:02:51Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nMinGW set the _CRT_fmode to set both the default fmode and\n_O_BINARY on stdin/stdout/stderr. Rather use the main()\ndefine in mingw.h to set this for both MinGW and MSVC.\n\nThis will ensure that a MinGW and MSVC build will handle\ninput and output identically.\n\nAlexey Borzenkov:\nInclude git-compat-util.h from the test-genrandom.c so\nthat the application also will use the main() define,\nand thus the stdout mode is set correctly and generated\ndata stays the same.\n\nJohannes Sixt:\nBefore, since the test-genrandom application would link\nagainst libgit.a, the MinGW process initialization code\nwould pick up the definition of _CRT_fmode from mingw.c\nthat is initialized to _O_BINARY. After this patch,\nhowever, the _CRT_fmode symbol is no longer present in\nlibgit.a, so MinGWs process initialization code will not\nset the correct std(in|out|err) mode. So, the include is\nneeded to override main() and explicitly set the mode.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/mingw.c   |    2 --\n compat/mingw.h   |    5 +++++\n test-genrandom.c |    1 +\n 3 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 5478b74..5a8fae8 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3,8 +3,6 @@\n #include <conio.h>\n #include \"../strbuf.h\"\n \n-unsigned int _CRT_fmode = _O_BINARY;\n-\n static int err_win_to_posix(DWORD winerr)\n {\n \tint error = ENOSYS;\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex c43917c..bcd23b0 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -227,12 +227,17 @@ void free_environ(char **env);\n \n /*\n  * A replacement of main() that ensures that argv[0] has a path\n+ * and that default fmode and std(in|out|err) are in binary mode\n  */\n \n #define main(c,v) dummy_decl_mingw_main(); \\\n static int mingw_main(); \\\n int main(int argc, const char **argv) \\\n { \\\n+\t_fmode = _O_BINARY; \\\n+\t_setmode(_fileno(stdin), _O_BINARY); \\\n+\t_setmode(_fileno(stdout), _O_BINARY); \\\n+\t_setmode(_fileno(stderr), _O_BINARY); \\\n \targv[0] = xstrdup(_pgmptr); \\\n \treturn mingw_main(argc, argv); \\\n } \\\ndiff --git a/test-genrandom.c b/test-genrandom.c\nindex 8ad276d..5849599 100644\n--- a/test-genrandom.c\n+++ b/test-genrandom.c\n@@ -6,6 +6,7 @@\n \n #include <stdio.h>\n #include <stdlib.h>\n+#include \"git-compat-util.h\"\n \n int main(int argc, char *argv[])\n {\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123425","messageId":"4AB1EF0E.5010600@viscovery.net","threadId":"20965","inReplyTo":"4AB1EB02.2090308@gmail.com","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-09-17T08:10:54Z","receivedAt":"2009-09-17T08:10:54Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Marius Storm-Olsen schrieb:\n> BTW, I ran all the tests (make /k test) before and after the\n> whole series, with msysgit 'devel' branch + plain git.git 'next',\n> and it turns out that 2 more tests pass after this series :)\n\nSorry to disappoint you: these 2 tests only passed by chance. For a\nwork-around see e95a73ef in mingw.git (it papers over an undetected\nracily-clean index).\n\n-- Hannes\n"},{"id":"123426","messageId":"4AB1EFFC.1070009@gmail.com","threadId":"20965","inReplyTo":"4AB1EF0E.5010600@viscovery.net","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-17T08:14:52Z","receivedAt":"2009-09-17T08:14:52Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Johannes Sixt said the following on 17.09.2009 10:10:\n> Marius Storm-Olsen schrieb:\n>> BTW, I ran all the tests (make /k test) before and after the\n>> whole series, with msysgit 'devel' branch + plain git.git 'next',\n>> and it turns out that 2 more tests pass after this series :)\n> \n> Sorry to disappoint you: these 2 tests only passed by chance. For a\n> work-around see e95a73ef in mingw.git (it papers over an undetected\n> racily-clean index).\n\nAh, gotcha. Oh well, at least no regressions then, which is also a \ngood thing :)\n\n--\n.marius\n"},{"id":"123427","messageId":"e2480c70909170139x9580bb4pcc1ad8e1b93aef17@mail.gmail.com","threadId":"20965","inReplyTo":"4AB1EF0E.5010600@viscovery.net","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Alexey Borzenkov","fromEmail":"snaury@gmail.com","sentAt":"2009-09-17T08:39:22Z","receivedAt":"2009-09-17T08:39:22Z","isPatch":true,"sender":{"key":"snaury@gmail.com","avatar":"https://gravatar.com/avatar/dd9f652303405e256f31e18690cea19ffcf21b83b04f746957334f62e399d95d?d=mp&s=160"},"body":"On Thu, Sep 17, 2009 at 12:10 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Marius Storm-Olsen schrieb:\n>> BTW, I ran all the tests (make /k test) before and after the\n>> whole series, with msysgit 'devel' branch + plain git.git 'next',\n>> and it turns out that 2 more tests pass after this series :)\n> Sorry to disappoint you: these 2 tests only passed by chance. For a\n> work-around see e95a73ef in mingw.git (it papers over an undetected\n> racily-clean index).\n\nMaybe we should just implement nsec for mingw? The code is already almost there:\n\nConverter filetime_to_timespec is available in cygwin.c\nDefinition of struct timespec and struct stat that uses it can be\nborrowed from cygwin's cygwin/stat.h and cygwin/types.h, we could call\nit struct mingw_timespec and struct mingw_stat. Then #define timespec\nmingw_timespec and #define stat mingw_stat, as well as #define\nst_atime (st_atim.tv_sec) and similarly others, just like\ncygwin/stat.h does.\nSince we already reimplement stat/lstat/fstat it should be relatively\nsimple and we don't care about usage of mingw's stat.\nDo you want me to cook up a patch?\n"},{"id":"123428","messageId":"4AB1F71B.6050004@gmail.com","threadId":"20965","inReplyTo":"e2480c70909170139x9580bb4pcc1ad8e1b93aef17@mail.gmail.com","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-17T08:45:15Z","receivedAt":"2009-09-17T08:45:15Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Alexey Borzenkov said the following on 17.09.2009 10:39:\n> On Thu, Sep 17, 2009 at 12:10 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>> Marius Storm-Olsen schrieb:\n>>> BTW, I ran all the tests (make /k test) before and after the\n>>> whole series, with msysgit 'devel' branch + plain git.git 'next',\n>>> and it turns out that 2 more tests pass after this series :)\n>> Sorry to disappoint you: these 2 tests only passed by chance. For a\n>> work-around see e95a73ef in mingw.git (it papers over an undetected\n>> racily-clean index).\n> \n> Maybe we should just implement nsec for mingw? The code is already almost there:\n> \n> Converter filetime_to_timespec is available in cygwin.c\n> Definition of struct timespec and struct stat that uses it can be\n> borrowed from cygwin's cygwin/stat.h and cygwin/types.h, we could call\n> it struct mingw_timespec and struct mingw_stat. Then #define timespec\n> mingw_timespec and #define stat mingw_stat, as well as #define\n> st_atime (st_atim.tv_sec) and similarly others, just like\n> cygwin/stat.h does.\n> Since we already reimplement stat/lstat/fstat it should be relatively\n> simple and we don't care about usage of mingw's stat.\n> Do you want me to cook up a patch?\n\nwe already override the stat() implementation with our own :)\n\ncompat/mingw.h (~174):\n\n/* Use mingw_lstat() instead of lstat()/stat() and\n  * mingw_fstat() instead of fstat() on Windows.\n  */\n#define off_t off64_t\n#define stat _stati64\n#define lseek _lseeki64\nint mingw_lstat(const char *file_name, struct stat *buf);\nint mingw_fstat(int fd, struct stat *buf);\n#define fstat mingw_fstat\n#define lstat mingw_lstat\n#define _stati64(x,y) mingw_lstat(x,y)\n\nint mingw_utime(const char *file_name, const struct utimbuf *times);\n#define utime mingw_utime\n\nSee compat/mingw.c for implementation..\n\n--\n.marius\n"},{"id":"123429","messageId":"e2480c70909170157g4890c408g2086942e7b68301c@mail.gmail.com","threadId":"20965","inReplyTo":"4AB1F71B.6050004@gmail.com","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Alexey Borzenkov","fromEmail":"snaury@gmail.com","sentAt":"2009-09-17T08:57:43Z","receivedAt":"2009-09-17T08:57:43Z","isPatch":true,"sender":{"key":"snaury@gmail.com","avatar":"https://gravatar.com/avatar/dd9f652303405e256f31e18690cea19ffcf21b83b04f746957334f62e399d95d?d=mp&s=160"},"body":"On Thu, Sep 17, 2009 at 12:45 PM, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n> we already override the stat() implementation with our own :)\n\nYes, that's why implementing nsec whould be easy. See compat/cygwin.c\n(filetime_to_timespec) and git-compat-util.h (#ifdef NO_NSEC).\nCurrently mingw doesn't support tv_nsec.\n"},{"id":"123430","messageId":"4AB1FB79.5070903@viscovery.net","threadId":"20965","inReplyTo":"e2480c70909170139x9580bb4pcc1ad8e1b93aef17@mail.gmail.com","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-09-17T09:03:53Z","receivedAt":"2009-09-17T09:03:53Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Alexey Borzenkov schrieb:\n> On Thu, Sep 17, 2009 at 12:10 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>> Marius Storm-Olsen schrieb:\n>>> BTW, I ran all the tests (make /k test) before and after the\n>>> whole series, with msysgit 'devel' branch + plain git.git 'next',\n>>> and it turns out that 2 more tests pass after this series :)\n>> Sorry to disappoint you: these 2 tests only passed by chance. For a\n>> work-around see e95a73ef in mingw.git (it papers over an undetected\n>> racily-clean index).\n> \n> Maybe we should just implement nsec for mingw? The code is already almost there:\n\nFirst thing to do is to understand what is going on: There are other\narchitectures that do not have nsec and that do *not* have the problem;\nwhy do we have a problem on Windows? If you cannot answer this question,\nan nsec solution would still just be \"it happens to work\", and not \"it\nworks by design\".\n\nI think I had analyzed this particular case, and I understood it, but did\nnot make notes why I found it satisfactory to just paper over the issue,\nand today I don't remember anymore. :-/\n\n> Since we already reimplement stat/lstat/fstat it should be relatively\n> simple and we don't care about usage of mingw's stat.\n\nDon't forget utime().\n\n> Do you want me to cook up a patch?\n\nI consider an answer to the question \"why do we need nsec?\" more important.\n\nBTW: t4130-apply-criss-cross-rename.sh fails quite often as well. This\ntime it is because we fill in st_ino = 0 instead of some useful value. The\ntest moves files around that happen to have identical sizes. After the\noperation, the dirty working tree could be noticed because st_ino differs\nfrom the index. But since we always set it to 0, it is not noticed.\n(That's my theory.)\n\nIf you make a patch, can you think about this issue as well?\n\n-- Hannes\n"},{"id":"123432","messageId":"4AB20140.7060901@gmail.com","threadId":"20965","inReplyTo":"4AB1FB79.5070903@viscovery.net","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-17T09:28:32Z","receivedAt":"2009-09-17T09:28:32Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Johannes Sixt said the following on 17.09.2009 11:03:\n> Alexey Borzenkov schrieb:\n>> Do you want me to cook up a patch?\n> \n> I consider an answer to the question \"why do we need nsec?\" more important.\n> \n> BTW: t4130-apply-criss-cross-rename.sh fails quite often as well. This\n> time it is because we fill in st_ino = 0 instead of some useful value. The\n> test moves files around that happen to have identical sizes. After the\n> operation, the dirty working tree could be noticed because st_ino differs\n> from the index. But since we always set it to 0, it is not noticed.\n> (That's my theory.)\n> \n> If you make a patch, can you think about this issue as well?\n\nCygwin version also sets st_ino = 0, so I'm not sure this is the cause \nof failure; unless this test also fails there? Does anyone know?\n\n--\n.marius\n"},{"id":"123436","messageId":"4AB212FA.9080102@viscovery.net","threadId":"20965","inReplyTo":"1eeb32498237638df6d954dc65ab5372dd0f04c9.1253174364.git.mstormo@gmail.com","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-09-17T10:44:10Z","receivedAt":"2009-09-17T10:44:10Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Marius Storm-Olsen schrieb:\n> diff --git a/test-genrandom.c b/test-genrandom.c\n> index 8ad276d..5849599 100644\n> --- a/test-genrandom.c\n> +++ b/test-genrandom.c\n> @@ -6,6 +6,7 @@\n>  \n>  #include <stdio.h>\n>  #include <stdlib.h>\n> +#include \"git-compat-util.h\"\n>  \n>  int main(int argc, char *argv[])\n>  {\n\nWe usually #include *only* git-compat-util.h; you can remove stdio.h and\nstdlib.h, as Alexey proposed.\n\n-- Hannes\n"},{"id":"123437","messageId":"6e9b7c953e20a984bb519f3fe374cef03ca144a7.1253185334.git.mstormo@gmail.com","threadId":"20965","inReplyTo":"4AB212FA.9080102@viscovery.netm","subject":"[PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-17T11:04:29Z","receivedAt":"2009-09-17T11:04:29Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"MinGW set the _CRT_fmode to set both the default fmode and\n_O_BINARY on stdin/stdout/stderr. Rather use the main()\ndefine in mingw.h to set this for both MinGW and MSVC.\n\nThis will ensure that a MinGW and MSVC build will handle\ninput and output identically.\n\nAlexey Borzenkov:\nInclude git-compat-util.h from the test-genrandom.c so\nthat the application also will use the main() define,\nand thus the stdout mode is set correctly and generated\ndata stays the same.\n\nJohannes Sixt:\nBefore, since the test-genrandom application would link\nagainst libgit.a, the MinGW process initialization code\nwould pick up the definition of _CRT_fmode from mingw.c\nthat is initialized to _O_BINARY. After this patch,\nhowever, the _CRT_fmode symbol is no longer present in\nlibgit.a, so MinGWs process initialization code will not\nset the correct std(in|out|err) mode. So, the include is\nneeded to override main() and explicitly set the mode.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n Gaaaaah! Sorry for not reading Alexey's patch properly.\n Multitasking is not working to my advantage these days..\n\n compat/mingw.c   |    2 --\n compat/mingw.h   |    5 +++++\n test-genrandom.c |    3 +--\n 3 files changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 5478b74..5a8fae8 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3,8 +3,6 @@\n #include <conio.h>\n #include \"../strbuf.h\"\n \n-unsigned int _CRT_fmode = _O_BINARY;\n-\n static int err_win_to_posix(DWORD winerr)\n {\n \tint error = ENOSYS;\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex c43917c..bcd23b0 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -227,12 +227,17 @@ void free_environ(char **env);\n \n /*\n  * A replacement of main() that ensures that argv[0] has a path\n+ * and that default fmode and std(in|out|err) are in binary mode\n  */\n \n #define main(c,v) dummy_decl_mingw_main(); \\\n static int mingw_main(); \\\n int main(int argc, const char **argv) \\\n { \\\n+\t_fmode = _O_BINARY; \\\n+\t_setmode(_fileno(stdin), _O_BINARY); \\\n+\t_setmode(_fileno(stdout), _O_BINARY); \\\n+\t_setmode(_fileno(stderr), _O_BINARY); \\\n \targv[0] = xstrdup(_pgmptr); \\\n \treturn mingw_main(argc, argv); \\\n } \\\ndiff --git a/test-genrandom.c b/test-genrandom.c\nindex 8ad276d..b3c28d9 100644\n--- a/test-genrandom.c\n+++ b/test-genrandom.c\n@@ -4,8 +4,7 @@\n  * Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2.\n  */\n \n-#include <stdio.h>\n-#include <stdlib.h>\n+#include \"git-compat-util.h\"\n \n int main(int argc, char *argv[])\n {\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123444","messageId":"e2480c70909170602l6afc9842v7be2b91fde9ad498@mail.gmail.com","threadId":"20965","inReplyTo":"4AB1FB79.5070903@viscovery.net","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Alexey Borzenkov","fromEmail":"snaury@gmail.com","sentAt":"2009-09-17T13:02:25Z","receivedAt":"2009-09-17T13:02:25Z","isPatch":true,"sender":{"key":"snaury@gmail.com","avatar":"https://gravatar.com/avatar/dd9f652303405e256f31e18690cea19ffcf21b83b04f746957334f62e399d95d?d=mp&s=160"},"body":"This is slightly more than a repost, forgot to reply to all, then\nfound more info.\n\nOn Thu, Sep 17, 2009 at 1:03 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> First thing to do is to understand what is going on: There are other\n> architectures that do not have nsec and that do *not* have the problem;\n> why do we have a problem on Windows? If you cannot answer this question,\n> an nsec solution would still just be \"it happens to work\", and not \"it\n> works by design\".\n\nAh, yes, I didn't realize that nsec checking isn't even enabled by\ndefault. So implementing it wouldn't help. As for st_ino it doesn't\nmatter in this case, as it wouldn't change anyway.\n\nIt's interesting that putting git diff or git status before calling\ngit stash shows that the changes are actually there (and then they can\nbe picked up). It seems that something manages to spend enough time so\nthat cache_entry's mtime and index.timestamp start to differ. For\nexample, here I modified check-racy to show more info for this\nparticular case:\n\ndiff --git a/Makefile b/Makefile\nindex e0f9a63..00f425c 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -364,6 +364,7 @@ PROGRAMS += git-unpack-file$X\n PROGRAMS += git-update-server-info$X\n PROGRAMS += git-upload-pack$X\n PROGRAMS += git-var$X\n+PROGRAMS += git-check-racy$X\n\n # List built-in command $C whose implementation cmd_$C() is not in\n # builtin-$C.o but is linked in as part of some other command.\ndiff --git a/check-racy.c b/check-racy.c\nindex 00d92a1..72b2878 100644\n--- a/check-racy.c\n+++ b/check-racy.c\n@@ -16,6 +16,12 @@ int main(int ac, char **av)\n                       continue;\n               }\n\n+               if (!strcmp(ce->name, \"file\")) {\n+                       printf(\"for file: index.timestamp.sec: %d\\n\",\nthe_index.timestamp.sec);\n+                       printf(\"for file:    ce->ce_mtime.sec: %d\\n\",\nce->ce_mtime.sec);\n+                       printf(\"for file:         st.st_mtime: %d\\n\",\n(int)st.st_mtime);\n+               }\n+\n               if (ce_match_stat(ce, &st, 0))\n                       dirty++;\n               else if (ce_match_stat(ce, &st, CE_MATCH_RACY_IS_DIRTY))\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 03e589f..6eb73fe 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -74,8 +74,14 @@ create_stash () {\n               cp -p ${GIT_INDEX_FILE-\"$GIT_DIR/index\"} \"$TMP-index\" &&\n               GIT_INDEX_FILE=\"$TMP-index\" &&\n               export GIT_INDEX_FILE &&\n+               echo \">>> before git read-tree:\" >&2 &&\n+               git check-racy >&2 &&\n               git read-tree -m $i_tree &&\n+               echo \">>> before git add:\" >&2 &&\n+               git check-racy >&2 &&\n               git add -u &&\n+               echo \">>> before git write-tree\" >&2 &&\n+               git check-racy >&2 &&\n               git write-tree &&\n               rm -f \"$TMP-index\"\n       ) ) ||\n\nNow where I run it and it doesn't fail:\n\nHEAD is now at dfc6a3a other-file\n>>> before git read-tree:\nfor file: index.timestamp.sec: 1253191568\nfor file:    ce->ce_mtime.sec: 1253191568\nfor file:         st.st_mtime: 1253191568\ndirty 1, clean 1, racy 0\n>>> before git add:\nfor file: index.timestamp.sec: 1253191570\nfor file:    ce->ce_mtime.sec: 1253191568\nfor file:         st.st_mtime: 1253191568\ndirty 1, clean 1, racy 0\n>>> before git write-tree\nfor file: index.timestamp.sec: 1253191571\nfor file:    ce->ce_mtime.sec: 1253191568\nfor file:         st.st_mtime: 1253191568\ndirty 0, clean 2, racy 0\nSaved working directory and index state WIP on master: dfc6a3a other-file\nHEAD is now at dfc6a3a other-file\n(To restore them type \"git stash apply\")\n>>> before git read-tree:\nfor file: index.timestamp.sec: 1253191572\nfor file:    ce->ce_mtime.sec: 1253191571\nfor file:         st.st_mtime: 1253191572\ndirty 1, clean 1, racy 0\n>>> before git add:\nfor file: index.timestamp.sec: 1253191574\nfor file:    ce->ce_mtime.sec: 1253191571\nfor file:         st.st_mtime: 1253191572\ndirty 1, clean 1, racy 0\n>>> before git write-tree\nfor file: index.timestamp.sec: 1253191574\nfor file:    ce->ce_mtime.sec: 1253191572\nfor file:         st.st_mtime: 1253191572\ndirty 0, clean 2, racy 0\nSaved working directory and index state WIP on master: dfc6a3a other-file\n\nBut, when this test fails, the results are:\n\nHEAD is now at dfc6a3a other-file\n>>> before git read-tree:\nfor file: index.timestamp.sec: 1253191677\nfor file:    ce->ce_mtime.sec: 1253191676\nfor file:         st.st_mtime: 1253191676\ndirty 0, clean 2, racy 0\n>>> before git add:\nfor file: index.timestamp.sec: 1253191679\nfor file:    ce->ce_mtime.sec: 1253191676\nfor file:         st.st_mtime: 1253191676\ndirty 0, clean 2, racy 0\n>>> before git write-tree\nfor file: index.timestamp.sec: 1253191679\nfor file:    ce->ce_mtime.sec: 1253191676\nfor file:         st.st_mtime: 1253191676\ndirty 0, clean 2, racy 0\nSaved working directory and index state WIP on master: dfc6a3a other-file\nHEAD is now at dfc6a3a other-file\n(To restore them type \"git stash apply\")\n>>> before git read-tree:\nfor file: index.timestamp.sec: 1253191681\nfor file:    ce->ce_mtime.sec: 1253191680\nfor file:         st.st_mtime: 1253191680\ndirty 0, clean 2, racy 0\n>>> before git add:\nfor file: index.timestamp.sec: 1253191683\nfor file:    ce->ce_mtime.sec: 1253191680\nfor file:         st.st_mtime: 1253191680\ndirty 0, clean 2, racy 0\n>>> before git write-tree\nfor file: index.timestamp.sec: 1253191683\nfor file:    ce->ce_mtime.sec: 1253191680\nfor file:         st.st_mtime: 1253191680\ndirty 0, clean 2, racy 0\nSaved working directory and index state WIP on master: dfc6a3a other-file\n\nAs you can see, even for \"8\" (first git stash in that test) it failed:\nit seemed as if working tree is clean, index was not updated, changes\nwere not stashed. But it just so happens that it didn't matter.\n\nAlso, as you can see, in both cases index timestamp is slightly bigger\nthan cache_entry's timestamp. That's why git doesn't see file as racy.\nNow I'm wondering WHAT manages to modify index timestamp. :-/\n\nUpdate:\n\nAh, I just added more git check-racy calls and found one extremely\ninteresting case:\n\nHEAD is now at dfc6a3a other-file\n>>> start of create_stash:\nfor file: index.timestamp.sec: 1253192315\nfor file:    ce->ce_mtime.sec: 1253192315\nfor file:         st.st_mtime: 1253192315\ndirty 1, clean 1, racy 0\n>>> after update-index -q --refresh:\nfor file: index.timestamp.sec: 1253192315\nfor file:    ce->ce_mtime.sec: 1253192315\nfor file:         st.st_mtime: 1253192315\ndirty 1, clean 1, racy 0\n>>> after checking for changes:\nfor file: index.timestamp.sec: 1253192315\nfor file:    ce->ce_mtime.sec: 1253192315\nfor file:         st.st_mtime: 1253192315\ndirty 1, clean 1, racy 0\n>>> after finding i_tree and i_commit:\nfor file: index.timestamp.sec: 1253192315\nfor file:    ce->ce_mtime.sec: 1253192315\nfor file:         st.st_mtime: 1253192315\ndirty 1, clean 1, racy 0\n>>> before git read-tree:\nfor file: index.timestamp.sec: 1253192316\nfor file:    ce->ce_mtime.sec: 1253192315\nfor file:         st.st_mtime: 1253192315\ndirty 0, clean 2, racy 0\n>>> before git add:\nfor file: index.timestamp.sec: 1253192318\nfor file:    ce->ce_mtime.sec: 1253192315\nfor file:         st.st_mtime: 1253192315\ndirty 0, clean 2, racy 0\n>>> before git write-tree\nfor file: index.timestamp.sec: 1253192318\nfor file:    ce->ce_mtime.sec: 1253192315\nfor file:         st.st_mtime: 1253192315\ndirty 0, clean 2, racy 0\nSaved working directory and index state WIP on master: dfc6a3a other-file\n\n\"after finding i_tree and i_commit\" is immediately before calculating\nw_tree. As you can see, \"before git read-tree\" is off by a second. I\nthink it's just a bug in msys, cp -p doesn't preserve mtime exactly.\n:-/\n"},{"id":"123450","messageId":"4AB239FC.9050302@viscovery.net","threadId":"20965","inReplyTo":"e2480c70909170602l6afc9842v7be2b91fde9ad498@mail.gmail.com","subject":"Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-09-17T13:30:36Z","receivedAt":"2009-09-17T13:30:36Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"[for the archives: this is about intermittent failures of t3903-stash.sh\nwith MinGW git]\n\nAlexey Borzenkov schrieb:\n> \"after finding i_tree and i_commit\" is immediately before calculating\n> w_tree. As you can see, \"before git read-tree\" is off by a second. I\n> think it's just a bug in msys, cp -p doesn't preserve mtime exactly.\n> :-/\n\nAh, now I recall everything: git-stash.sh does \"cp -p\", and from the times\nwhere git-commit was still a shell script I know that this does not always\npreserve the timestamp correctly. Since this is a bug attributable to MSYS\n(and not MinGW git), I was satisfied by simply inserting 'sleep 1' in the\ntest case to avoid the racily-clean situation. (Although today, I would\nmodify the content to have a different size.)\n\n-- Hannes\n"},{"id":"123462","messageId":"200909172218.15678.j6t@kdbg.org","threadId":"20965","inReplyTo":"894136433cc5b03a4b89a1f9c0e4f8a2704222fa.1253088099.git.mstormo@gmail.com","subject":"Re: [RFC 15/15] Tag GIT_VERSION when Git is built with MSVC","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2009-09-17T20:18:15Z","receivedAt":"2009-09-17T20:18:15Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"\nOn Mittwoch, 16. September 2009, Marius Storm-Olsen wrote:\n> This may help us debug issues on Windows, as we now can build Git\n> natively on Windows with both MinGW and MSVC.\n>\n> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n> ---\n>  I'm just throwing this one out there. If people think manipulating\n>  the version here, to ease debugging, I don't mind if this patch is\n>  squashed into patch 12.\n>  If people don't like it, just skip this path.\n>\n>  Makefile |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index aa918eb..2c20922 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -878,6 +878,7 @@ ifneq (,$(findstring CYGWIN,$(uname_S)))\n>  \tUNRELIABLE_FSTAT = UnfortunatelyYes\n>  endif\n>  ifdef MSVC\n> +\tGIT_VERSION := $(GIT_VERSION).MSVC\n>  \tpathsep = ;\n>  \tNO_PREAD = YesPlease\n>  \tNO_OPENSSL = YesPlease\n\nI like it, but I would not squash it into patch 12.\n\n-- Hannes\n"},{"id":"123463","messageId":"200909172228.28174.j6t@kdbg.org","threadId":"20965","inReplyTo":"aa80ad559c731ca73179956e34b2743d903fbbec.1253088099.git.mstormo@gmail.com","subject":"Re: [PATCH 14/15] Add scripts to generate projects for other buildsystems (MSVC vcproj, QMake)","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2009-09-17T20:28:28Z","receivedAt":"2009-09-17T20:28:28Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Mittwoch, 16. September 2009, Marius Storm-Olsen wrote:\n> --- a/.gitignore\n> +++ b/.gitignore\n> @@ -179,3 +179,14 @@ configure\n>  tags\n>  TAGS\n>  cscope*\n> +*.obj\n> +*.lib\n> +*.sln\n> +*.suo\n> +*.ncb\n> +*.vcproj\n> +*.user\n> +*.idb\n> +*.pdb\n> +Debug/\n> +Release/\n\nIf I understand correctly, then 'make MSVC=1' still produce *.o files, not \n*.obj. But if the VC++ project is used, I expect that the *.obj, *.idb, and \n*.pdb end up in Debug/ or Release/ directories. Then why do you need entries \nfor *.obj, *.idb, and *.pdb?\n\n-- Hannes\n"},{"id":"123481","messageId":"4AB32C33.2030302@gmail.com","threadId":"20965","inReplyTo":"200909172218.15678.j6t@kdbg.org","subject":"Re: [RFC 15/15] Tag GIT_VERSION when Git is built with MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-18T06:44:03Z","receivedAt":"2009-09-18T06:44:03Z","isPatch":false,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Johannes Sixt said the following on 17.09.2009 22:18:\n> On Mittwoch, 16. September 2009, Marius Storm-Olsen wrote:\n>> This may help us debug issues on Windows, as we now can build Git\n>> natively on Windows with both MinGW and MSVC.\n>>\n>> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n>> ---\n>>  I'm just throwing this one out there. If people think manipulating\n>>  the version here, to ease debugging, I don't mind if this patch is\n>>  squashed into patch 12.\n>>  If people don't like it, just skip this path.\n>>\n>>  Makefile |    1 +\n>>  1 files changed, 1 insertions(+), 0 deletions(-)\n>>\n>> diff --git a/Makefile b/Makefile\n>> index aa918eb..2c20922 100644\n>> --- a/Makefile\n>> +++ b/Makefile\n>> @@ -878,6 +878,7 @@ ifneq (,$(findstring CYGWIN,$(uname_S)))\n>>  \tUNRELIABLE_FSTAT = UnfortunatelyYes\n>>  endif\n>>  ifdef MSVC\n>> +\tGIT_VERSION := $(GIT_VERSION).MSVC\n>>  \tpathsep = ;\n>>  \tNO_PREAD = YesPlease\n>>  \tNO_OPENSSL = YesPlease\n> \n> I like it, but I would not squash it into patch 12.\n\nOk good, we'll just keep it as is then.\nThanks.\n\n--\n.marius\n"},{"id":"123482","messageId":"4AB32FE2.1060604@gmail.com","threadId":"20965","inReplyTo":"200909172228.28174.j6t@kdbg.org","subject":"Re: [PATCH 14/15] Add scripts to generate projects for other buildsystems (MSVC vcproj, QMake)","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-18T06:59:46Z","receivedAt":"2009-09-18T06:59:46Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Johannes Sixt said the following on 17.09.2009 22:28:\n> On Mittwoch, 16. September 2009, Marius Storm-Olsen wrote:\n>> --- a/.gitignore\n>> +++ b/.gitignore\n>> @@ -179,3 +179,14 @@ configure\n>>  tags\n>>  TAGS\n>>  cscope*\n>> +*.obj\n>> +*.lib\n>> +*.sln\n>> +*.suo\n>> +*.ncb\n>> +*.vcproj\n>> +*.user\n>> +*.idb\n>> +*.pdb\n>> +Debug/\n>> +Release/\n> \n> If I understand correctly, then 'make MSVC=1' still produce *.o files, not \n> *.obj. But if the VC++ project is used, I expect that the *.obj, *.idb, and \n> *.pdb end up in Debug/ or Release/ directories. Then why do you need entries \n> for *.obj, *.idb, and *.pdb?\n\nWhen using only the vcproj generator, you are correct. However, if you \nuse the qmake generator, and create vcprojs from those, the *.idb and \n*.pdb files are located in the project directory itself, and not under \nDebug/. I'm not too worried about this case though, so for me, the \nthree entries *.obj, *.idb and *.pdb can go.\n\nJunio, you want me to push a new patch?\n\n--\n.marius\n"},{"id":"123485","messageId":"4AB342F8.7080504@viscovery.net","threadId":"20965","inReplyTo":"4AB32FE2.1060604@gmail.com","subject":"Re: [PATCH 14/15] Add scripts to generate projects for other buildsystems (MSVC vcproj, QMake)","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-09-18T08:21:12Z","receivedAt":"2009-09-18T08:21:12Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Marius Storm-Olsen schrieb:\n> Johannes Sixt said the following on 17.09.2009 22:28:\n>> why do\n>> you need entries for *.obj, *.idb, and *.pdb?\n> \n> When using only the vcproj generator, you are correct. However, if you\n> use the qmake generator, and create vcprojs from those, the *.idb and\n> *.pdb files are located in the project directory itself, and not under\n> Debug/. I'm not too worried about this case though, so for me, the three\n> entries *.obj, *.idb and *.pdb can go.\n\nFair enough.\n\n> Junio, you want me to push a new patch?\n\nThat's not necessary. I just wanted to make sure that you added the\nentries deliberately.\n\nWith these questions answered, and the most recent change to 04/15 that\nadjust test-genrandom.c, the MinGW aspect of this series is\n\nAcked-by: Johannes Sixt <j6t@kdbg.org>\n\nThank you very much for your work and persistency!\n\n-- Hannes\n"},{"id":"123669","messageId":"05f2bea5-0f74-4c89-9a84-d908a80bea20@h30g2000vbr.googlegroups.com","threadId":"20965","inReplyTo":"213f3c7799721c3f42ffa689498175f0495048eb.1253088099.git.mstormo@gmail.com","subject":"Re: Avoid declaration after statement","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2009-09-23T09:44:02Z","receivedAt":"2009-09-23T09:44:02Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"\n> From: Frank Li <lznuaa@gmail.com>\n>\n> MSVC does not understand this C99 style\n>\n> Signed-off-by: Frank Li <lznuaa@gmail.com>\n> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n\nIndeed, even in recent Visual Studio versions the C compiler only\nunderstands C90, not C99. Would it make sense to just force MSVC to\ncompile *.c files with the C++ compiler to fix this, rather than\npatching files (which might be necessary for future files, too)? See\nthe \"/TP\" command line option to \"CL\".\n\n--\nSebastian\n"},{"id":"123670","messageId":"a416a9d0-90f3-40b7-bd39-ea67ceb2e0b9@j19g2000vbp.googlegroups.com","threadId":"20965","inReplyTo":"7afd55f9b2f0f7859f757c715034cc3520e07f0e.1253088099.git.mstormo@gmail.com","subject":"Re: Add MinGW header files to build git with MSVC","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2009-09-23T10:03:35Z","receivedAt":"2009-09-23T10:03:35Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"> From: Frank Li <lznuaa@gmail.com>\n>\n> Added the header files dirent.h, unistd.h and utime.h\n> Add alloca.h, which simply includes malloc.h, which defines alloca\n>\n> Signed-off-by: Frank Li <lznuaa@gmail.com>\n> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n\n[...]\n\n>  create mode 100644 compat/vcbuild/include/sys/utime.h\n\nHave you considered simply including MSVC's sys/utime.h here? From a\nfirst glance, it seems as if it contains all required symbols.\n\n--\nSebastian\n"},{"id":"123672","messageId":"4ABA0698.7020604@gmail.com","threadId":"20965","inReplyTo":"a416a9d0-90f3-40b7-bd39-ea67ceb2e0b9@j19g2000vbp.googlegroups.com","subject":"Re: Add MinGW header files to build git with MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-23T11:29:28Z","receivedAt":"2009-09-23T11:29:28Z","isPatch":false,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nSebastian Schuberth said the following on 23.09.2009 12:03:\n>> From: Frank Li <lznuaa@gmail.com>\n>>\n>> Added the header files dirent.h, unistd.h and utime.h\n>> Add alloca.h, which simply includes malloc.h, which defines alloca\n>>\n>> Signed-off-by: Frank Li <lznuaa@gmail.com>\n>> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n> \n> [...]\n> \n>>  create mode 100644 compat/vcbuild/include/sys/utime.h\n> \n> Have you considered simply including MSVC's sys/utime.h here? From a\n> first glance, it seems as if it contains all required symbols.\n\nThis was a patch which originated from Frank Li's original series. \nWhile we might have been able to simply use the MSVC one, I'm sure \nFrank had a reason for overriding it with the small content which you \nsee in this patch. We'll have to ask Frank about that. We can always \nremove it now, if the MSVC version works ok and doesn't introduce any \ncompiler errors/warnings.\n\nWhile I appreciate your comments, they are a tad late, as the whole \nseries is already in master.. :)\n  See http://repo.or.cz/w/git.git?a=shortlog;h=refs/heads/master\n\nSo, give it a try, to see if removing the include override\n     compat/vcbuild/include/utime.h\ndoesn't introduce a regression, and send a patch for it.\n\n--\n.marius\n"},{"id":"123674","messageId":"72888219-5bab-4964-9faf-0d40b4770e2c@o35g2000vbi.googlegroups.com","threadId":"20965","inReplyTo":"aa80ad559c731ca73179956e34b2743d903fbbec.1253088099.git.mstormo@gmail.com","subject":"Re: Add scripts to generate projects for other buildsystems (MSVC vcproj, QMake)","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2009-09-23T15:04:53Z","receivedAt":"2009-09-23T15:04:53Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On Sep 16, 10:20 am, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n\n> These scripts generate projects for the MSVC IDE (.vcproj files) or\n> QMake (.pro files), based on the output of a 'make -n MSVC=1 V=1' run.\n>\n> This enables us to simply do the necesarry changes in the Makefile, and you\n> can update the other buildsystems by regenerating the files. Keeping the\n> other buildsystems up-to-date with main development.\n\nI know I'm a little late with my comments as this patch set has\nalready been merged to master. However, for future reference I'd like\nto point out that something similar could be archived by using e.g.\nCMake, and only maintaining the CMake project file. I'm not suggesting\nto actually switch to CMake at this time, but I wanted to point out\nthat a guy called Pau Garcia i Quiles already seems to have created a\npreliminary CMakeLists.txt file for Git [1], and also tried to build\nGit for Windows using his CMake-generated MSVC project files.\n\n[1] \"CMake-ifying git\", http://www.elpauer.org/?p=324\n\n--\nSebastian\n"},{"id":"123690","messageId":"alpine.DEB.1.00.0909232236490.4985@pacific.mpi-cbg.de","threadId":"20965","inReplyTo":"72888219-5bab-4964-9faf-0d40b4770e2c@o35g2000vbi.googlegroups.com","subject":"Re: Add scripts to generate projects for other buildsystems (MSVC vcproj, QMake)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-09-23T20:37:34Z","receivedAt":"2009-09-23T20:37:34Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 23 Sep 2009, Sebastian Schuberth wrote:\n\n> On Sep 16, 10:20 am, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n> \n> > These scripts generate projects for the MSVC IDE (.vcproj files) or\n> > QMake (.pro files), based on the output of a 'make -n MSVC=1 V=1' run.\n> >\n> > This enables us to simply do the necesarry changes in the Makefile, and you\n> > can update the other buildsystems by regenerating the files. Keeping the\n> > other buildsystems up-to-date with main development.\n> \n> I know I'm a little late with my comments as this patch set has\n> already been merged to master. However, for future reference I'd like\n> to point out that something similar could be archived by using e.g.\n> CMake, and only maintaining the CMake project file. I'm not suggesting\n> to actually switch to CMake at this time, but I wanted to point out\n> that a guy called Pau Garcia i Quiles already seems to have created a\n> preliminary CMakeLists.txt file for Git [1], and also tried to build\n> Git for Windows using his CMake-generated MSVC project files.\n> \n> [1] \"CMake-ifying git\", http://www.elpauer.org/?p=324\n\nWe actually discussed this, and I challenged Pau to provide a recipe (a la \n/src/openssl/release.sh) that builds, installs and commits CMake.\n\nThere was no response after that challenge.\n\nCiao,\nDscho\n"},{"id":"123713","messageId":"4ABB0C16.4030103@gmail.com","threadId":"20965","inReplyTo":"alpine.DEB.1.00.0909232236490.4985@pacific.mpi-cbg.de","subject":"Re: Add scripts to generate projects for other buildsystems (MSVC vcproj, QMake)","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-24T06:05:10Z","receivedAt":"2009-09-24T06:05:10Z","isPatch":false,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Johannes Schindelin said the following on 23.09.2009 22:37:\n> Hi,\n> \n> On Wed, 23 Sep 2009, Sebastian Schuberth wrote:\n> \n>> On Sep 16, 10:20 am, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n>>\n>>> These scripts generate projects for the MSVC IDE (.vcproj files) or\n>>> QMake (.pro files), based on the output of a 'make -n MSVC=1 V=1' run.\n>>>\n>>> This enables us to simply do the necesarry changes in the Makefile, and you\n>>> can update the other buildsystems by regenerating the files. Keeping the\n>>> other buildsystems up-to-date with main development.\n>> I know I'm a little late with my comments as this patch set has\n>> already been merged to master. However, for future reference I'd like\n>> to point out that something similar could be archived by using e.g.\n>> CMake, and only maintaining the CMake project file. I'm not suggesting\n>> to actually switch to CMake at this time, but I wanted to point out\n>> that a guy called Pau Garcia i Quiles already seems to have created a\n>> preliminary CMakeLists.txt file for Git [1], and also tried to build\n>> Git for Windows using his CMake-generated MSVC project files.\n>>\n>> [1] \"CMake-ifying git\", http://www.elpauer.org/?p=324\n> \n> We actually discussed this, and I challenged Pau to provide a recipe (a la \n> /src/openssl/release.sh) that builds, installs and commits CMake.\n> \n> There was no response after that challenge.\n\nAlso, the buildsystem scripts I added to contrib/buildsystem is made \nin such a way that creating a CMake generator would be very little \noverhead. And since it's very unlikely that any other buildsystem will \nreplace the default Makefile anytime soon, I think that is the way to \ngo, to generate files for all the other buildsystems based on the \noutput of the Makefile. Not optimal, sure, but follows main development.\n\nNote that the contrib/buildsystem scripts could need a major overhaul \nby a Perl guru, as they are currently tuned only for Windows \nconsumption (and Msys Perl being the only Perl distribution tested).\nBut they work as intended for the use-case in mind.\n\n--\n.marius\n"},{"id":"123750","messageId":"1976ea660909241718k1d9e27f8pfa0e2e1cb628edb6@mail.gmail.com","threadId":"20965","inReplyTo":"4ABA0698.7020604@gmail.com","subject":"Re: [msysGit] Re: Add MinGW header files to build git with MSVC","fromName":"Frank Li","fromEmail":"lznuaa@gmail.com","sentAt":"2009-09-25T00:18:02Z","receivedAt":"2009-09-25T00:18:02Z","isPatch":false,"sender":{"key":"lznuaa@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40642?v=4"},"body":">\n> This was a patch which originated from Frank Li's original series. While we\n> might have been able to simply use the MSVC one, I'm sure Frank had a reason\n> for overriding it with the small content which you see in this patch. We'll\n> have to ask Frank about that. We can always remove it now, if the MSVC\n> version works ok and doesn't introduce any compiler errors/warnings.\n>\n\nAt beginning, I don't want to copy all msys header files to\nvcbuilc\\include and copy only necessary header file and data\nstructure.\nMany structures have been defined at MSVC standard file.  So I use\nsimple utimer.h and unistd.h and dirent.h.\n\nBest regards\nFrank Li\n"},{"id":"123773","messageId":"40aa078e0909250634w5f633946kb60ace76c7dce657@mail.gmail.com","threadId":"20965","inReplyTo":"05f2bea5-0f74-4c89-9a84-d908a80bea20@h30g2000vbr.googlegroups.com","subject":"Re: Avoid declaration after statement","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-09-25T13:34:50Z","receivedAt":"2009-09-25T13:34:50Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"\nOn Wed, Sep 23, 2009 at 11:44 AM, Sebastian Schuberth\n<sschuberth@gmail.com> wrote:\n>\n>> From: Frank Li <lznuaa@gmail.com>\n>>\n>> MSVC does not understand this C99 style\n>>\n>> Signed-off-by: Frank Li <lznuaa@gmail.com>\n>> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n>\n> Indeed, even in recent Visual Studio versions the C compiler only\n> understands C90, not C99. Would it make sense to just force MSVC to\n> compile *.c files with the C++ compiler to fix this, rather than\n> patching files (which might be necessary for future files, too)?\n\nI don't think so. There's many other compilers out there that doesn't\nsupport C99 features, and most of the git source code does not depend\non them. IMO, it is better to fix these  issues for all those\ncompilers once and for all, instead of having to find ways of working\naround them whenever someone changes compiler.\n\nBesides, C++ isn't a strict superset of C. There might be warnings or\nerrors introduced by compiling the code as C++. Implicit conversions\nfrom void* springs to mind. Quick tests reveals that MSVC doesn't seem\nto warn or error about them, but there might be some other differences\nwhere we do get into issues.\n\n-- \nErik \"kusma\" Faye-Lund\nkusmabite@gmail.com\n(+47) 986 59 656\n"}]}