git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Jeff Hostetler via GitGitGadget <gitgitgadget@gmail.com>,
	Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Jeff Hostetler <jeffhost@microsoft.com>
Subject: Re: [PATCH 13/17] msvc: support building Git using MS Visual C++
Date: Wed, 19 Jun 2019 17:11:20 +0200 (CEST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1906191500241.44@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <CAPig+cTgmvwg_LV5zonQAR3c0et2p1Nm4YuAfAkYDF=2jY9YeQ@mail.gmail.com>

Hi Eric,

On Wed, 19 Jun 2019, Eric Sunshine wrote:

> On Tue, Jun 18, 2019 at 8:24 AM Jeff Hostetler via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> > With this patch, Git can be built using the Microsoft toolchain, via:
> >
> >         make MSVC=1 [DEBUG=1]
> >
> > Third party libraries are built from source using the open source
> > "vcpkg" tool set. See https://github.com/Microsoft/vcpkg
> > [...]
> > Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> > diff --git a/Makefile b/Makefile
> > @@ -1240,7 +1240,7 @@ endif
> > -BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
> > +BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
>
> This seems like a distinct bug fix which should live in its own patch.

And so it did! And so it will do again, starting from the next iteration.
Thanks.

> > diff --git a/compat/mingw.c b/compat/mingw.c
> > @@ -2388,6 +2388,12 @@ static void maybe_redirect_std_handles(void)
> > +#ifdef _MSC_VER
> > +#ifdef _DEBUG
> > +#include <crtdbg.h>
> > +#endif
> > +#endif
> > @@ -2405,6 +2411,12 @@ int wmain(int argc, const wchar_t **wargv)
> > +#ifdef _MSC_VER
> > +#ifdef USE_MSVC_CRTDBG
> > +       _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
> > +#endif
> > +#endif
>
> Shouldn't these changes be squashed into 16/17 (with the commit
> message of 16/17 adjusted accordingly), rather than being included in
> this patch?

Not really. This has little to do with assertions, and much more with
memory usage debugging support in Visual Studio.

I guess that this (together with the other `USE_MSVC_CRTDBG`) should go
into its own, separate commit.

> > diff --git a/compat/vcbuild/README b/compat/vcbuild/README
> > @@ -1,3 +1,54 @@
> > +Alternatively, run `make MSVC=1 vcxproj` and then load the generated
> > +git.sln in Visual Studio. The initial build will install the vcpkg
> > +system and build the dependencies automatically. This will take a while.
>
> Is this bit implemented yet, or will it be introduced by a subsequent
> patch series mentioned in the cover letter? If the latter, perhaps
> this README snippet belongs to that future patch series.

It is actually implemented in a future patch series (I hinted at it in the
cover letter).

> > +Note that this will automatically add and commit the generated
> > +.sln and .vcxproj files to the repo.  You may want to drop this
> > +commit before submitting a Pull Request....
>
> Yuck. An automatic commit as part of the build process has high
> surprise-factor, and it seems like it's creating extra work (and
> possibility for error) if the user needs to remember to drop it before
> submitting.

The thing to keep in mind is that the *primary* reason for this Makefile
target is to publish a version of the source code that works in Visual
Studio out of the box. Read: without getting a (pretty heavy) Git for
Windows SDK on top.

The idea is to avoid having to download several hundred megabytes of
Git for Windows SDK, and instead run the tests in the Git Bash of a
regular Git for Windows.

Of course, this only works when certain "build products" (such as shell
scripts that have been copy-edited to their final form, or certain
generated files that the test suite wants to see) are included.

If you do not include them, tough luck, you cannot run the tests.

Of course, I *do* want contributors to run the tests, even if they choose
the convenience of a full-fledged IDE, and I don't want to punish them for
it by forcing them to pick all of the bits and pieces for themselves.

To achieve that, I force-add those generated files and commit the whole
bunch, and publish the result as `vs/master` at
https://github.com/git-for-windows/git. Actually, it is a trusty Azure
Pipeline that does that.

> > +Or maybe we should put the .sln/.vcxproj files in the .gitignore file
> > +and not do this.  I'm not sure.
>
> Seems like a better choice.

Unless you struggled for yourself to find all the missing files you need
in order to run the test suite. Or to cobble together a working Git from
the build output of Visual Studio (which only contains the compiled C
code, after all, and as you and me know fully well, Git insists on support
files such as templates, too, and yes, they have to be "generated" and are
of course excluded via `.gitignore`).

Once you went through those struggles, you don't want to do it again. I
went a step further, and I don't want anybody but me to have to go through
that again, either.

That is why I think that your statement might have been made under the
false impression that this is an easy decision.

In any case, this is indeed a discussion for the next patch series, not
this one.

> > diff --git a/compat/vcbuild/find_vs_env.bat b/compat/vcbuild/find_vs_env.bat
> > @@ -0,0 +1,169 @@
> > +:not_2015
> > +   REM TODO....
> > +   echo TODO support older versions of VS. >&2
> > +   EXIT /B 1
>
> As this is a user-facing error message, perhaps it could be worded
> differently. Maybe:
>
>     ERROR: unsupported VS version (older than VS2015)
>
> or something.

Good idea! I made it so.

Thanks!
Dscho

  reply	other threads:[~2019-06-19 15:11 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18 12:23 [PATCH 00/17] Fix MSVC support, at long last Johannes Schindelin via GitGitGadget
2019-06-18 12:23 ` [PATCH 01/17] Mark .bat files as requiring CR/LF endings Johannes Schindelin via GitGitGadget
2019-06-18 12:23 ` [PATCH 03/17] cache-tree.c: avoid reusing the DEBUG constant Jeff Hostetler via GitGitGadget
2019-06-18 23:14   ` Eric Sunshine
2019-06-19 11:19     ` Johannes Schindelin
2019-06-19 15:21     ` Junio C Hamano
2019-06-19  0:08   ` Carlo Arenas
2019-06-19 11:17     ` Johannes Schindelin
2019-06-19 17:15       ` Carlo Arenas
2019-06-19 21:03         ` Johannes Schindelin
2019-06-18 12:23 ` [PATCH 02/17] t0001 (mingw): do not expect a specific order of stdout/stderr Johannes Schindelin via GitGitGadget
2019-06-18 23:12   ` Eric Sunshine
2019-06-19  6:19     ` Johannes Sixt
2019-06-19  6:40       ` Eric Sunshine
2019-06-19 11:26         ` Johannes Schindelin
2019-06-19 11:30           ` Johannes Schindelin
2019-06-19 17:24             ` Johannes Sixt
2019-06-19 20:58               ` Johannes Schindelin
2019-06-18 12:23 ` [PATCH 04/17] obstack: fix compiler warning Johannes Schindelin via GitGitGadget
2019-06-18 12:23 ` [PATCH 06/17] msvc: fix dependencies of compat/msvc.c Johannes Schindelin via GitGitGadget
2019-06-18 12:23 ` [PATCH 05/17] mingw: replace mingw_startup() hack Johannes Schindelin via GitGitGadget
2019-06-18 12:24 ` [PATCH 07/17] msvc: include sigset_t definition Philip Oakley via GitGitGadget
2019-06-18 12:24 ` [PATCH 09/17] msvc: mark a variable as non-const Jeff Hostetler via GitGitGadget
2019-06-18 12:24 ` [PATCH 08/17] msvc: define O_ACCMODE Philip Oakley via GitGitGadget
2019-06-18 12:24 ` [PATCH 10/17] msvc: do not re-declare the timespec struct Jeff Hostetler via GitGitGadget
2019-06-18 12:24 ` [PATCH 12/17] msvc: fix detect_msys_tty() Jeff Hostetler via GitGitGadget
2019-06-18 12:24 ` [PATCH 11/17] msvc: define ftello() Jeff Hostetler via GitGitGadget
2019-06-18 12:24 ` [PATCH 13/17] msvc: support building Git using MS Visual C++ Jeff Hostetler via GitGitGadget
2019-06-19  0:51   ` Carlo Arenas
2019-06-19 12:50     ` Johannes Schindelin
2019-06-19  8:35   ` Eric Sunshine
2019-06-19 15:11     ` Johannes Schindelin [this message]
2019-06-18 12:24 ` [PATCH 14/17] msvc: add pragmas for common warnings Philip Oakley via GitGitGadget
2019-06-18 12:24 ` [PATCH 15/17] msvc: do not pretend to support all signals Jeff Hostetler via GitGitGadget
2019-06-19  4:10   ` Eric Sunshine
2019-06-19 16:49     ` Johannes Schindelin
2019-06-18 12:24 ` [PATCH 16/17] msvc: avoid debug assertion windows in Debug Mode Johannes Schindelin via GitGitGadget
2019-06-18 12:24 ` [PATCH 17/17] msvc: ignore .dll and incremental compile output Jeff Hostetler via GitGitGadget
2019-06-19 21:05 ` [PATCH v2 00/20] Fix MSVC support, at long last Johannes Schindelin via GitGitGadget
2019-06-19 21:05   ` [PATCH v2 01/20] mingw: fix a typo in the msysGit-specific section Johannes Schindelin via GitGitGadget
2019-06-19 21:05   ` [PATCH v2 02/20] Mark .bat files as requiring CR/LF endings Johannes Schindelin via GitGitGadget
2019-06-19 21:05   ` [PATCH v2 03/20] t0001 (mingw): do not expect a specific order of stdout/stderr Johannes Schindelin via GitGitGadget
2019-06-19 21:05   ` [PATCH v2 04/20] cache-tree/blame: avoid reusing the DEBUG constant Jeff Hostetler via GitGitGadget
2019-06-19 21:05   ` [PATCH v2 05/20] obstack: fix compiler warning Johannes Schindelin via GitGitGadget
2019-06-19 21:05   ` [PATCH v2 06/20] mingw: replace mingw_startup() hack Johannes Schindelin via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 07/20] msvc: fix dependencies of compat/msvc.c Johannes Schindelin via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 08/20] msvc: include sigset_t definition Philip Oakley via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 10/20] msvc: mark a variable as non-const Jeff Hostetler via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 09/20] msvc: define O_ACCMODE Philip Oakley via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 11/20] msvc: do not re-declare the timespec struct Jeff Hostetler via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 12/20] msvc: define ftello() Jeff Hostetler via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 13/20] msvc: fix detect_msys_tty() Jeff Hostetler via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 14/20] msvc: update Makefile to allow for spaces in the compiler path Jeff Hostetler via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 15/20] msvc: support building Git using MS Visual C++ Jeff Hostetler via GitGitGadget
2019-06-21 20:17     ` Johannes Schindelin
2019-06-21 20:45       ` Junio C Hamano
2019-06-19 21:06   ` [PATCH v2 16/20] msvc: add a compile-time flag to allow detailed heap debugging Jeff Hostetler via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 18/20] msvc: do not pretend to support all signals Jeff Hostetler via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 17/20] msvc: add pragmas for common warnings Philip Oakley via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 19/20] msvc: avoid debug assertion windows in Debug Mode Johannes Schindelin via GitGitGadget
2019-06-19 21:06   ` [PATCH v2 20/20] msvc: ignore .dll and incremental compile output Jeff Hostetler via GitGitGadget
2019-06-25 14:49   ` [PATCH v3 00/20] Fix MSVC support, at long last Johannes Schindelin via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 01/20] mingw: fix a typo in the msysGit-specific section Johannes Schindelin via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 02/20] Mark .bat files as requiring CR/LF endings Johannes Schindelin via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 03/20] t0001 (mingw): do not expect a specific order of stdout/stderr Johannes Schindelin via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 04/20] cache-tree/blame: avoid reusing the DEBUG constant Jeff Hostetler via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 05/20] obstack: fix compiler warning Johannes Schindelin via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 06/20] mingw: replace mingw_startup() hack Johannes Schindelin via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 07/20] msvc: fix dependencies of compat/msvc.c Johannes Schindelin via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 08/20] msvc: include sigset_t definition Philip Oakley via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 10/20] msvc: mark a variable as non-const Jeff Hostetler via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 09/20] msvc: define O_ACCMODE Philip Oakley via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 11/20] msvc: do not re-declare the timespec struct Jeff Hostetler via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 12/20] msvc: define ftello() Jeff Hostetler via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 13/20] msvc: fix detect_msys_tty() Jeff Hostetler via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 14/20] msvc: update Makefile to allow for spaces in the compiler path Jeff Hostetler via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 15/20] msvc: support building Git using MS Visual C++ Jeff Hostetler via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 16/20] msvc: add a compile-time flag to allow detailed heap debugging Jeff Hostetler via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 17/20] msvc: add pragmas for common warnings Philip Oakley via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 18/20] msvc: do not pretend to support all signals Jeff Hostetler via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 19/20] msvc: avoid debug assertion windows in Debug Mode Johannes Schindelin via GitGitGadget
2019-06-25 14:49     ` [PATCH v3 20/20] msvc: ignore .dll and incremental compile output Jeff Hostetler via GitGitGadget
2019-06-25 17:50     ` [PATCH v3 00/20] Fix MSVC support, at long last Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nycvar.QRO.7.76.6.1906191500241.44@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).