Skip to content

Rebase to v2.42.0-rc0#4545

Merged
dscho merged 838 commits intogit-for-windows:mainfrom
dscho:rebase-to-v2.42.0-rc0
Aug 8, 2023
Merged

Rebase to v2.42.0-rc0#4545
dscho merged 838 commits intogit-for-windows:mainfrom
dscho:rebase-to-v2.42.0-rc0

Conversation

@dscho
Copy link
Member

@dscho dscho commented Aug 7, 2023

Range-diff relative to main
  • 1: 3218429 = 1: 3d95e3e windows: ignore empty PATH elements

  • 2: 0c7c5eb = 2: 62de294 is_Cygwin: avoid execing anything

  • 3: ac681d3 = 3: e99af41 Move is_ functions to the beginning

  • 4: 832b054 = 4: 89a1aec Move the _which function (almost) to the top

  • 5: dafd42e = 5: 7ad3e27 Work around Tcl's default PATH lookup

  • 6: 1a0b8d1 = 6: 70ac65c gitk(Windows): avoid inadvertently calling executables in the worktree

  • 7: 481fa54 = 7: b4a839f t9350: point out that refs are not updated correctly

  • 8: 76ecf13 = 8: e70a5da transport-helper: add trailing --

  • 9: 0297838 = 9: 0a1b3a8 remote-helper: check helper status after import/export

  • 11: fd3f06f ! 10: 92bd060 Always auto-gc after calling a fast-import transport

    @@ Commit message
     
      ## transport-helper.c ##
     @@
    - #include "wrapper.h"
    + #include "protocol.h"
      
      static int debug;
     +/* TODO: put somewhere sensible, e.g. git_transport_options? */
  • 13: 8e56bf9 = 11: 88c9bdd mingw: include the Python parts in the build

  • 10: 4227c43 = 12: a0191be mingw: demonstrate a problem with certain absolute paths

  • 17: b868a1d ! 13: 43f5b9b clean: do not traverse mount points

    @@ path.c: char *strip_path_suffix(const char *path, const char *suffix)
      	int sl, ndot;
     
      ## path.h ##
    -@@ path.h: int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);
    - int normalize_path_copy(char *dst, const char *src);
    +@@ path.h: int normalize_path_copy(char *dst, const char *src);
    + int strbuf_normalize_path(struct strbuf *src);
      int longest_ancestor_length(const char *path, struct string_list *prefixes);
      char *strip_path_suffix(const char *path, const char *suffix);
     +int is_mount_point_via_stat(struct strbuf *path);
  • 14: eaad655 = 14: 0ce8af7 win32/pthread: avoid name clashes with winpthread

  • 12: b656946 = 15: 74a0fad mingw: allow absolute paths without drive prefix

  • 19: 94ea259 = 16: 4060c3c clean: remove mount points when possible

  • 15: 7eed53f = 17: 2eb112d git-compat-util: avoid redeclaring _DEFAULT_SOURCE

  • 16: be79eca = 18: 3beb79f Import the source code of mimalloc v2.0.9

  • 18: e93a0a2 = 19: 2656392 mimalloc: adjust for building inside Git

  • 20: 3d9c032 = 20: c183d40 mimalloc: offer a build-time option to enable it

  • 21: 6fad51a = 21: 2b31de6 mimalloc: use "weak" random seed when statically linked

  • 23: 8303ce8 = 22: 4ef785f mingw: use mimalloc

  • 22: 13cc6f7 = 23: 4c4e0b4 mingw: demonstrate a git add issue with NTFS junctions

  • 33: f52a9b6 = 24: e05049b strbuf_realpath(): use platform-dependent API if available

  • 25: 8aeb44e = 25: 9b77868 mingw: make sure errno is set correctly when socket operations fail

  • 26: 0479e9a = 26: 7c7d702 mingw: do resolve symlinks in getcwd()

  • 27: b097962 = 27: fb8bbc4 mingw: fix fatal error working on mapped network drives on Windows

  • 28: d6c0b75 = 28: e1e35c0 clink.pl: fix MSVC compile script to handle libcurl-d.lib

  • 37: e7eb190 = 29: d06774b mingw: implement a platform-specific strbuf_realpath()

  • 29: 6cb054d = 30: 55c9240 vcxproj: unclash project directories with build outputs

  • 30: f335719 = 31: c678d64 mingw: ensure valid CTYPE

  • 31: 33cde5c = 32: 99b0a85 t5505/t5516: allow running without .git/branches/ in the templates

  • 32: dfad8ef = 33: 843040d mingw: allow git.exe to be used instead of the "Git wrapper"

  • 34: e6d4ea6 = 34: a7b1de1 t5505/t5516: fix white-space around redirectors

  • 35: 3b52ab5 = 35: 6711b42 mingw: ignore HOMEDRIVE/HOMEPATH if it points to Windows' system directory

  • 36: 0d6d69d ! 36: a5d8598 http: use new "best effort" strategy for Secure Channel revoke checking

    @@ http.c: static char *cached_accept_language;
      /*
       * With the backend being set to `schannel`, setting sslCAinfo would override
       * the Certificate Store in cURL v7.60.0 and later, which is not what we want
    -@@ http.c: static int http_options(const char *var, const char *value, void *cb)
    +@@ http.c: static int http_options(const char *var, const char *value,
      	}
      
      	if (!strcmp("http.schannelcheckrevoke", var)) {
  • 38: b1cae9b = 37: b32fa6e t3701: verify that we can add lots of files interactively

  • 39: 1e322a8 = 38: d7e06fd git add -i: handle CR/LF line endings in the interactive input

  • 40: 6847061 = 39: eab68c5 commit: accept "scissors" with CR/LF line endings

  • 41: d6aef2b = 40: da5622b t0014: fix indentation

  • 42: e2a3930 = 41: 93df74f git-gui: accommodate for intent-to-add files

  • 43: 5e37720 = 42: e2b47f0 clink.pl: fix libexpatd.lib link error when using MSVC

  • 44: 9c9bd31 = 43: a9111f4 Makefile: clean up .ilk files when MSVC=1

  • 45: 43b873e = 44: e6a7739 vcbuild: add support for compiling Windows resource files

  • 46: a0fb5e4 = 45: d5aee68 config.mak.uname: add git.rc to MSVC builds

  • 47: ba55fbb = 46: 75fd623 clink.pl: ignore no-stack-protector arg on MSVC=1 builds

  • 48: 3fde2de = 47: 22f407c clink.pl: move default linker options for MSVC=1 builds

  • 49: cfaef3a = 48: 888481a buildsystems: remove duplicate clause

  • 50: a386226 = 49: b613177 vcxproj: handle resource files, too

  • 51: 01669b9 = 50: 15dc181 vcxproj: ignore -fno-stack-protector and -fno-common

  • 52: 1153390 = 51: b15815e vcxproj: handle GUI programs, too

  • 53: 2bbd07e = 52: 60d9ea6 win32: add a helper to run git.exe without a foreground window

  • 54: ec49106 = 53: c3e2e24 vcpkg_install: detect lack of Git

  • 60: 64f69a8 = 54: c0db73d git maintenance: avoid console window in scheduled tasks on Windows

  • 55: e1d4f3b = 55: da3e8ed vcpkg_install: add comment regarding slow network connections

  • 62: 360dae5 = 56: 12c26ed cmake: install headless-git.

  • 56: bf545bf = 57: 8a151d5 vcxproj: support building Windows/ARM64 binaries

  • 57: 430bc2f = 58: c13c6a2 vcbuild: install ARM64 dependencies when building ARM64 binaries

  • 58: d8ac1d4 = 59: 1875c6a vcbuild: add an option to install individual 'features'

  • 59: 622464f = 60: 3ebe9c0 cmake: allow building for Windows/ARM64

  • 61: b7d1efb = 61: fb3d09f ci(vs-build) also build Windows/ARM64 artifacts

  • 63: ca84007 = 62: 65e3a79 Add schannel to curl installation

  • 65: d618230 = 63: 214130a cmake(): allow setting HOST_CPU for cross-compilation

  • 66: 5e88bd4 = 64: f4a5e96 ci(vs-build): download the vcpkg artifacts using a dedicated Action

  • 67: 8ec1bc2 = 65: 2eafd83 mingw: allow for longer paths in parse_interpreter()

  • 73: 5adb31c = 66: 0eb696b CMake: default Visual Studio generator has changed

  • 75: 68a129c = 67: 8346cdf .gitignore: add Visual Studio CMakeSetting.json file

  • 64: 3d45e35 = 68: 8c2366d subtree: update contrib/subtree test target

  • 77: 17dfba0 = 69: 7fa2677 CMakeLists: add default "x64-windows" arch for Visual Studio

  • 68: 8d3ac38 = 70: b732cf5 compat/vcbuild: document preferred way to build in Visual Studio

  • 69: d6480d9 ! 71: a63d19e http: optionally send SSL client certificate

    @@ http.c: static int http_schannel_check_revoke_mode =
      size_t fread_buffer(char *ptr, size_t eltsize, size_t nmemb, void *buffer_)
      {
      	size_t size = eltsize * nmemb;
    -@@ http.c: static int http_options(const char *var, const char *value, void *cb)
    +@@ http.c: static int http_options(const char *var, const char *value,
      		return 0;
      	}
      
    @@ http.c: static int http_options(const char *var, const char *value, void *cb)
     +	}
     +
      	if (!strcmp("http.minsessions", var)) {
    - 		min_curl_sessions = git_config_int(var, value);
    + 		min_curl_sessions = git_config_int(var, value, ctx->kvi);
      		if (min_curl_sessions > 1)
     @@ http.c: static CURL *get_curl_handle(void)
      	}
  • 70: 11a4e6d = 72: 6241512 ci: run contrib/subtree tests in CI builds

  • 79: cef4cd1 = 73: e94b1ab CMake: show Win32 and Generator_platform build-option values

  • 80: e791129 ! 74: 0f7910d init: do parse all core.* settings early

    @@ Commit message
     
         Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
     
    - ## builtin/init-db.c ##
    -@@ builtin/init-db.c: int init_db(const char *git_dir, const char *real_git_dir,
    - 	startup_info->have_repository = 1;
    - 
    - 	/* Ensure `core.hidedotfiles` is processed */
    --	git_config(platform_core_config, NULL);
    -+	git_config(git_default_core_config, NULL);
    - 
    - 	safe_create_dir(git_dir, 0);
    - 
    -
      ## config.c ##
     @@ config.c: int git_config_color(char *dest, const char *var, const char *value)
      	return 0;
      }
      
    --static int git_default_core_config(const char *var, const char *value, void *cb)
    -+int git_default_core_config(const char *var, const char *value, void *cb)
    +-static int git_default_core_config(const char *var, const char *value,
    +-				   const struct config_context *ctx, void *cb)
    ++int git_default_core_config(const char *var, const char *value,
    ++			    const struct config_context *ctx, void *cb)
      {
      	/* This needs a better name */
      	if (!strcmp(var, "core.filemode")) {
     
      ## config.h ##
    -@@ config.h: struct config_options {
    - typedef int (*config_fn_t)(const char *, const char *, void *);
    +@@ config.h: typedef int (*config_fn_t)(const char *, const char *,
      
    - int git_default_config(const char *, const char *, void *);
    -+int git_default_core_config(const char *var, const char *value, void *cb);
    + int git_default_config(const char *, const char *,
    + 		       const struct config_context *, void *);
    ++int git_default_core_config(const char *var, const char *value,
    ++			    const struct config_context *ctx, void *cb);
      
      /**
       * Read a specific file in git-config format.
    +
    + ## setup.c ##
    +@@ setup.c: int init_db(const char *git_dir, const char *real_git_dir,
    + 	startup_info->have_repository = 1;
    + 
    + 	/* Ensure `core.hidedotfiles` is processed */
    +-	git_config(platform_core_config, NULL);
    ++	git_config(git_default_core_config, NULL);
    + 
    + 	safe_create_dir(git_dir, 0);
    + 
  • 81: d891c36 ! 75: ac44652 Enable the built-in FSMonitor as an experimental feature

    @@ repo-settings.c
      static void repo_cfg_bool(struct repository *r, const char *key, int *dest,
      			  int def)
     @@ repo-settings.c: void prepare_repo_settings(struct repository *r)
    - 	repo_cfg_bool(r, "feature.experimental", &experimental, 0);
    - 
    - 	/* Defaults modified by feature.* */
    --	if (experimental)
    -+	if (experimental) {
    + 	if (experimental) {
      		r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING;
    + 		r->settings.pack_use_bitmap_boundary_traversal = 1;
     +
     +		/*
     +		 * Force enable the builtin FSMonitor (unless the repo
    @@ repo-settings.c: void prepare_repo_settings(struct repository *r)
     +		    repo_config_get_maybe_bool(r, "core.fsmonitor", &value) > 0 &&
     +		    repo_config_get_bool(r, "core.useBuiltinFSMonitor", &value))
     +			fsm_settings__set_ipc(r);
    -+	}
    + 	}
      	if (manyfiles) {
      		r->settings.index_version = 4;
    - 		r->settings.index_skip_hash = 1;
  • 71: 8fe74bb = 76: 3f11df8 hash-object: demonstrate a >4GB/LLP64 problem

  • 72: 7482bcc ! 77: 2ec98da hash_object_file_literally(): use size_t

    @@ Metadata
     Author: Philip Oakley <philipoakley@iee.email>
     
      ## Commit message ##
    -    hash_object_file_literally(): use size_t
    +    write_object_file_literally(): use size_t
     
         The previous commit adds a test that demonstrates a problem in the
         `hash-object --literally` command, manifesting in an unnecessary file
    @@ object-file.c: int write_object_file_flags(const void *buf, unsigned long len,
      				unsigned flags)
      {
     
    - ## object-store.h ##
    -@@ object-store.h: static inline int write_object_file(const void *buf, unsigned long len,
    + ## object-store-ll.h ##
    +@@ object-store-ll.h: static inline int write_object_file(const void *buf, unsigned long len,
      	return write_object_file_flags(buf, len, type, oid, 0);
      }
      
  • 74: 68d558e ! 78: b7859f0 object-file.c: use size_t for header lengths

    @@ object-file.c: int write_object_file_literally(const void *buf, size_t len,
      	/* type string, SP, %lu of the length plus NUL must fit this */
      	hdrlen = strlen(type) + MAX_HEADER_LEN;
     
    - ## object-store.h ##
    -@@ object-store.h: void *repo_read_object_file(struct repository *r,
    + ## object-store-ll.h ##
    +@@ object-store-ll.h: void *repo_read_object_file(struct repository *r,
      int oid_object_info(struct repository *r, const struct object_id *, unsigned long *);
      
      void hash_object_file(const struct git_hash_algo *algo, const void *buf,
  • 76: 1043e03 = 79: 0b43185 hash algorithms: use size_t for section lengths

  • 78: 586c9ce = 80: 92f000f hash-object --stdin: verify that it works with >4GB/LLP64

  • 82: 1583c03 = 81: 1d34b04 hash-object: add another >4GB/LLP64 test case

  • 85: 3412906 = 82: 944a345 hash-object: add a >4GB/LLP64 test case using filtered input

  • 83: 6d0a4e9 = 83: 12289ad setup: properly use "%(prefix)/" when in WSL

  • 86: e66d4a0 = 84: 3cd95cb compat/mingw.c: do not warn when failing to get owner

  • 87: 10f4a27 = 85: 9504c22 mingw: $env:TERM="xterm-256color" for newer OSes

  • 88: 50997b6 = 86: a697dc9 winansi: check result and Buffer before using Name

  • 90: b97e431 = 87: 8347ab4 vcxproj: allow building with NO_PERL again

  • 91: 72c91bf = 88: e03809a vcxproj: require C11

  • 92: af0bb2a = 89: b4fe10c vcxproj: ignore the -pedantic option

  • 93: a34de7f = 90: 8ccf06c vcxproj: include reftable when committing .vcxproj files

  • 94: aef7c7e = 91: 3fba16c vcxproj: handle libreftable_test, too

  • 95: 3434300 = 92: 5f48709 vcxproj: avoid escaping double quotes in the defines

  • 96: 8d24a7b = 93: 02e72b2 ci: adjust Azure Pipeline for runs_on_pool

  • 97: 22bb090 = 94: cc4b066 ci: stop linking the prove cache

  • 98: f35a879 = 95: 05f4dea ci: reinstate Azure Pipelines support

  • 99: d0394d3 = 96: 58f7c09 azure-pipeline: drop the GETTEXT_POISON job

  • 100: a1e5b0a = 97: bc6baa6 azure-pipeline: stop hard-coding apt-get calls

  • 101: 3177073 = 98: b759823 azure-pipeline: drop the code to write to/read from a file share

  • 102: 7b82b75 = 99: 63a69d7 azure-pipeline: use partial clone/parallel checkout to initialize minimal-sdk

  • 103: 6592777 = 100: 1cbd5c0 bswap.h: add support for built-in bswap functions

  • 104: aa517c7 = 101: 4b8b842 azure-pipeline: downcase the job name of the Linux32 job

  • 106: a72fc0e = 102: 1345396 MinGW: link as terminal server aware

  • 105: 4b035aa = 103: 22f5064 config.mak.uname: add support for clangarm64

  • 107: d65a723 = 104: 38a6881 azure-pipeline: run static-analysis on jammy

  • 108: dcc374c = 105: 9e771d6 Fix Windows version resources

  • 112: ed69bf5 = 106: f2a4e90 http: optionally load libcurl lazily

  • 113: 9e9b5b8 = 107: 824dd36 http: support lazy-loading libcurl also on Windows

  • 114: 6033251 = 108: bf5078d http: when loading libcurl lazily, allow for multiple SSL backends

  • 109: 66cb5e4 = 109: bda5cb0 ci: create clangarm64-build.yml

  • 110: 06c5198 = 110: 92caf5a status: fix for old-style submodules with commondir

  • 111: c3a6e89 = 111: f3e515a windows: skip linking git-<command> for built-ins

  • 115: 346ad83 = 112: 1bab01b windows: fix Repository>Explore Working Copy

  • 116: 13a5c50 = 113: 84a61ab mingw: do load libcurl dynamically by default

  • 24: cf04b0c ! 114: dd0d06d Config option to disable side-band-64k for transport

    @@ Metadata
     Author: Thomas Braun <thomas.braun@byte-physics.de>
     
      ## Commit message ##
    -    Config option to disable side-band-64k for transport
    +    transport: optionally disable side-band-64k
     
    -    Since commit 0c499ea60f the send-pack builtin uses the side-band-64k
    +    Since commit 0c499ea60fda (send-pack: demultiplex a sideband stream with
    +    status data, 2010-02-05) the send-pack builtin uses the side-band-64k
         capability if advertised by the server.
     
         Unfortunately this breaks pushing over the dump git protocol if used
         over a network connection.
     
         The detailed reasons for this breakage are (by courtesy of Jeff Preshing,
    -    quoted from ttps://groups.google.com/d/msg/msysgit/at8D7J-h7mw/eaLujILGUWoJ):
    -    ----------------------------------------------------------------------------
    -    MinGW wraps Windows sockets in CRT file descriptors in order to mimic the
    -    functionality of POSIX sockets. This causes msvcrt.dll to treat sockets as
    -    Installable File System (IFS) handles, calling ReadFile, WriteFile,
    -    DuplicateHandle and CloseHandle on them. This approach works well in simple
    -    cases on recent versions of Windows, but does not support all usage patterns.
    -    In particular, using this approach, any attempt to read & write concurrently
    -    on the same socket (from one or more processes) will deadlock in a scenario
    -    where the read waits for a response from the server which is only invoked after
    -    the write. This is what send_pack currently attempts to do in the use_sideband
    -    codepath.
    -    ----------------------------------------------------------------------------
    +    quoted from https://groups.google.com/d/msg/msysgit/at8D7J-h7mw/eaLujILGUWoJ):
     
    -    The new config option "sendpack.sideband" allows to override the side-band-64k
    -    capability of the server, and thus makes the dump git protocol work.
    +            MinGW wraps Windows sockets in CRT file descriptors in order to
    +            mimic the functionality of POSIX sockets. This causes msvcrt.dll
    +            to treat sockets as Installable File System (IFS) handles,
    +            calling ReadFile, WriteFile, DuplicateHandle and CloseHandle on
    +            them. This approach works well in simple cases on recent
    +            versions of Windows, but does not support all usage patterns. In
    +            particular, using this approach, any attempt to read & write
    +            concurrently on the same socket (from one or more processes)
    +            will deadlock in a scenario where the read waits for a response
    +            from the server which is only invoked after the write. This is
    +            what send_pack currently attempts to do in the use_sideband
    +            codepath.
    +
    +    The new config option `sendpack.sideband` allows to override the
    +    side-band-64k capability of the server, and thus makes the dumb git
    +    protocol work.
     
         Other transportation methods like ssh and http/https still benefit from
    -    the sideband channel, therefore the default value of "sendpack.sideband"
    +    the sideband channel, therefore the default value of `sendpack.sideband`
         is still true.
     
    -    [jes: split out the documentation into Documentation/config/]
    -
         Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
    -    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
         Signed-off-by: Oliver Schneider <oliver@assarbad.net>
    +    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
     
      ## Documentation/config.txt ##
     @@ Documentation/config.txt: include::config/safe.txt[]
    @@ Documentation/config/sendpack.txt (new)
     +	with the dump git protocol. Defaults to true.
     
      ## send-pack.c ##
    -@@ send-pack.c: int option_parse_push_signed(const struct option *opt,
    - 	die("bad %s argument: %s", opt->long_name, arg);
    - }
    - 
    -+static int config_use_sideband = 1;
    -+
    -+static int send_pack_config(const char *var, const char *value, void *unused)
    -+{
    -+	if (!strcmp("sendpack.sideband", var))
    -+		config_use_sideband = git_config_bool(var, value);
    -+
    -+	return 0;
    -+}
    -+
    - static void feed_object(const struct object_id *oid, FILE *fh, int negative)
    - {
    - 	if (negative &&
    +@@ send-pack.c: int send_pack(struct send_pack_args *args,
    + 	int need_pack_data = 0;
    + 	int allow_deleting_refs = 0;
    + 	int status_report = 0;
    +-	int use_sideband = 0;
    ++	int use_sideband = 1;
    + 	int quiet_supported = 0;
    + 	int agent_supported = 0;
    + 	int advertise_sid = 0;
     @@ send-pack.c: int send_pack(struct send_pack_args *args,
      		return 0;
      	}
      
    -+	git_config(send_pack_config, NULL);
    -+
    ++	git_config_get_bool("sendpack.sideband", &use_sideband);
      	git_config_get_bool("push.negotiate", &push_negotiate);
      	if (push_negotiate)
      		get_commons_through_negotiation(args->url, remote_refs, &commons);
    @@ send-pack.c: int send_pack(struct send_pack_args *args,
      	if (server_supports("ofs-delta"))
      		args->use_ofs_delta = 1;
     -	if (server_supports("side-band-64k"))
    -+	if (config_use_sideband && server_supports("side-band-64k"))
    - 		use_sideband = 1;
    +-		use_sideband = 1;
    ++	use_sideband = use_sideband && server_supports("side-band-64k");
      	if (server_supports("quiet"))
      		quiet_supported = 1;
    + 	if (server_supports("agent"))
  • 232: 9246c37 = 115: 94a7f08 Add a GitHub workflow to verify that Git/Scalar work in Nano Server

  • 236: d3ad54f = 116: bd73d26 mingw: suggest windows.appendAtomically in more cases

  • 84: 38c82cb ! 117: dbb4179 Add config option windows.appendAtomically

    @@ compat/mingw.c: ssize_t mingw_write(int fd, const void *buf, size_t len)
      			errno = EPIPE;
     -		else
     +		else {
    -+			wchar_t path[MAX_LONG_PATH];
    ++			wchar_t path[MAX_PATH];
     +			DWORD ret = GetFinalPathNameByHandleW(h, path,
     +							ARRAY_SIZE(path), 0);
     +			UINT drive_type = ret > 0 && ret < ARRAY_SIZE(path) ?
  • 89: 8fb2552 = 118: d1eab7d mingw: change core.fsyncObjectFiles = 1 by default

  • -: ------------ > 119: 79ef783 t0040: declare non-tab indentation to be okay in this script

  • 117: 6abb067 = 120: b45320c Win32: make FILETIME conversion functions public

  • 118: 33319f0 = 121: 18bcdf7 Win32: dirent.c: Move opendir down

  • 119: 5e72cad = 122: 6a95034 mingw: make the dirent implementation pluggable

  • 120: e173591 = 123: b64fcaa Win32: make the lstat implementation pluggable

  • 121: 4cfa9b8 ! 124: 3bcdde3 add infrastructure for read-only file system level caches

    @@ Metadata
     Author: Karsten Blees <blees@dcon.de>
     
      ## Commit message ##
    -    add infrastructure for read-only file system level caches
    +    mingw: add infrastructure for read-only file system level caches
     
         Add a macro to mark code sections that only read from the file system,
         along with a config option and documentation.
    @@ compat/mingw.c: enum hide_dotfiles_type {
      static char *unset_environment_variables;
     +int core_fscache;
      
    - int mingw_core_config(const char *var, const char *value, void *cb)
    - {
    -@@ compat/mingw.c: int mingw_core_config(const char *var, const char *value, void *cb)
    + int mingw_core_config(const char *var, const char *value,
    + 		      const struct config_context *ctx, void *cb)
    +@@ compat/mingw.c: int mingw_core_config(const char *var, const char *value,
      		return 0;
      	}
      
    @@ compat/mingw.h: typedef _sigset_t sigset_t;
      
     +extern int core_fscache;
     +
    - int mingw_core_config(const char *var, const char *value, void *cb);
    - #define platform_core_config mingw_core_config
    - 
    + struct config_context;
    + int mingw_core_config(const char *var, const char *value,
    + 		      const struct config_context *ctx, void *cb);
     
      ## git-compat-util.h ##
     @@ git-compat-util.h: static inline int is_missing_file_error(int errno_)
  • 122: ad89986 = 125: d1476d7 mingw: add a cache below mingw's lstat and dirent implementations

  • 123: fb19c95 = 126: 25f72a2 fscache: load directories only once

  • 124: e01940c = 127: 92e8793 fscache: add key for GIT_TRACE_FSCACHE

  • 125: c2ff35a = 128: e804fb7 fscache: remember not-found directories

  • 126: 9c516ac = 129: 7e8f6f0 fscache: add a test for the dir-not-found optimization

  • 127: 540ff68 = 130: af4d985 add: use preload-index and fscache for performance

  • 128: ecd8e03 = 131: 06651f8 dir.c: make add_excludes aware of fscache during status

  • 129: ef82e9c = 132: 87feebf fscache: make fscache_enabled() public

  • 130: e7fe305 = 133: 9600ef6 dir.c: regression fix for add_excludes with fscache

  • 131: 58ceae9 = 134: 52dec14 fetch-pack.c: enable fscache for stats under .git/objects

  • 132: 9742f2e = 135: 47cb0fd checkout.c: enable fscache for checkout again

  • 133: a7b9bdf = 136: a0cd43d Enable the filesystem cache (fscache) in refresh_index().

  • 134: 4747fff = 137: 4c7a6d4 fscache: use FindFirstFileExW to avoid retrieving the short name

  • 135: 2bc187c = 138: 614e36d status: disable and free fscache at the end of the status command

  • 136: 66130be = 139: 9b50c71 fscache: add GIT_TEST_FSCACHE support

  • 137: 921bf49 = 140: 1360e6f fscache: add fscache hit statistics

  • 138: bd86d90 = 141: 36db88a mem_pool: add GIT_TRACE_MEMPOOL support

  • 139: 2b642bc = 142: c4b3ecb fscache: fscache takes an initial size

  • 140: f88a017 = 143: 0f48dac fscache: update fscache to be thread specific instead of global

  • 141: a8f72e7 = 144: 875ca70 fscache: teach fscache to use mempool

  • 142: eb98af7 = 145: 95073da fscache: make fscache_enable() thread safe

  • 147: 19ee912 = 146: b470a68 git-gui: provide question helper for retry fallback on Windows

  • 143: 8acebd2 = 147: 73ef302 fscache: teach fscache to use NtQueryDirectoryFile

  • 148: 610d325 = 148: b3cf8f6 git gui: set GIT_ASKPASS=git-gui--askpass if not set yet

  • 154: 89ea963 = 149: 7e600c8 gitk: Unicode file name support

  • 144: de7e613 = 150: 4b67dff unpack-trees: enable fscache for sparse-checkout

  • 149: cdcfab4 = 151: c525e3e git-gui--askyesno: fix funny text wrapping

  • 155: 90040dd = 152: 7832aef gitk: Use an external icon file on Windows

  • 145: e08f73d = 153: 8e953ec fscache: remember the reparse tag for each entry

  • 150: 97370c2 = 154: d187a6f git-gui--askyesno: allow overriding the window title

  • 156: 2fa7b96 = 155: d471425 gitk: fix arrow keys in input fields with Tcl/Tk >= 8.6

  • 146: 2131601 = 156: 1e810d8 fscache: implement an FSCache-aware is_mount_point()

  • 151: 8108a00 = 157: 30237b6 respect core.hooksPath, falling back to .git/hooks

  • 152: 5da6606 = 158: c200e4b git-gui--askyesno (mingw): use Git for Windows' icon, if available

  • 157: e949d2c = 159: b2c9b21 gitk: make the "list references" default window width wider

  • 153: 3a858c5 = 160: 759e95e clean: make use of FSCache

  • 158: bd1ba69 = 161: f7c1884 pack-objects (mingw): demonstrate a segmentation fault with large deltas

  • 159: bded55f ! 162: 08c4fd4 mingw: support long paths

    @@ compat/mingw.c: static enum hide_dotfiles_type hide_dotfiles = HIDE_DOTFILES_DOT
     +	return enabled < 0 ? fallback : enabled;
     +}
     +
    - int mingw_core_config(const char *var, const char *value, void *cb)
    + int mingw_core_config(const char *var, const char *value,
    + 		      const struct config_context *ctx, void *cb)
      {
    - 	if (!strcmp(var, "core.hidedotfiles")) {
     @@ compat/mingw.c: static wchar_t *normalize_ntpath(wchar_t *wbuf)
      int mingw_unlink(const char *pathname)
      {
    @@ compat/mingw.c: FILE *mingw_freopen (const char *filename, const char *otype, FI
      
      	if (xutftowcs(wotype, otype, ARRAY_SIZE(wotype)) < 0)
     @@ compat/mingw.c: ssize_t mingw_write(int fd, const void *buf, size_t len)
    + 		if (GetFileType(h) == FILE_TYPE_PIPE)
    + 			errno = EPIPE;
    + 		else {
    +-			wchar_t path[MAX_PATH];
    ++			wchar_t path[MAX_LONG_PATH];
    + 			DWORD ret = GetFinalPathNameByHandleW(h, path,
    + 							ARRAY_SIZE(path), 0);
    + 			UINT drive_type = ret > 0 && ret < ARRAY_SIZE(path) ?
    +@@ compat/mingw.c: ssize_t mingw_write(int fd, const void *buf, size_t len)
      
      int mingw_access(const char *filename, int mode)
      {
    @@ compat/mingw.c: int wmain(int argc, const wchar_t **wargv)
     
      ## compat/mingw.h ##
     @@ compat/mingw.h: typedef _sigset_t sigset_t;
    + #endif
      
      extern int core_fscache;
    - 
    -+struct repository;
     +int are_long_paths_enabled(void);
    -+
    - int mingw_core_config(const char *var, const char *value, void *cb);
    - #define platform_core_config mingw_core_config
      
    + struct config_context;
    + int mingw_core_config(const char *var, const char *value,
     @@ compat/mingw.h: int is_path_owned_by_current_sid(const char *path, struct strbuf *report);
      int is_valid_win32_path(const char *path, int allow_literal_nul);
      #define is_valid_path(path) is_valid_win32_path(path, 0)
  • 160: ec98415 = 163: bcbf473 Win32: fix 'lstat("dir/")' with long paths

  • 161: 0cb907c = 164: 7ae1ec9 mingw: Support git_terminal_prompt with more terminals

  • 164: 9e413fb = 165: babad07 compat/terminal.c: only use the Windows console if bash 'read -r' fails

  • 165: 3c46c8b = 166: fc8627e mingw (git_terminal_prompt): do fall back to CONIN$/CONOUT$ method

  • 166: d6af24c = 167: 97c27f9 Unbreak interactive GPG prompt upon signing

  • 167: f8a0dd4 = 168: a4e4749 strbuf_readlink: don't call readlink twice if hint is the exact link size

  • 168: a0a8305 = 169: 2728918 strbuf_readlink: support link targets that exceed PATH_MAX

  • 169: bd6352a = 170: 7585463 lockfile.c: use is_dir_sep() instead of hardcoded '/' checks

  • 170: 969e46b = 171: a7bc1ec Win32: don't call GetFileAttributes twice in mingw_lstat()

  • 171: b81be67 = 172: 6a5d1a3 Win32: implement stat() with symlink support

  • 162: e6b3d61 = 173: 011a83f compat/fsmonitor/fsm-*-win32: support long paths

  • 163: 832f6df = 174: 57dac81 clean: suggest using core.longPaths if paths are too long to remove

  • 172: e41e46a = 175: 9018987 Win32: remove separate do_lstat() function

  • 173: a29a390 = 176: 2a44262 Win32: let mingw_lstat() error early upon problems with reparse points

  • 174: 5246160 = 177: 2fbc029 mingw: teach fscache and dirent about symlinks

  • 175: 5258a7b = 178: bb27f57 Win32: lstat(): return adequate stat.st_size for symlinks

  • 176: 162158c = 179: b0f5b27 Win32: factor out retry logic

  • 177: 2ec9c1b = 180: 311b6d9 Win32: change default of 'core.symlinks' to false

  • 178: 621f575 = 181: 8ce84d5 Win32: add symlink-specific error codes

  • 179: aaa64cc = 182: 59333b4 Win32: mingw_unlink: support symlinks to directories

  • 180: 3dfdb23 = 183: f40af76 Win32: mingw_rename: support renaming symlinks

  • 181: 0b76ed8 = 184: d1bac0d Win32: mingw_chdir: change to symlink-resolved directory

  • 182: 692cffc ! 185: 0c39b5f Win32: implement readlink()

    @@ compat/mingw.c
     +#include <winioctl.h>
      #include "../strbuf.h"
      #include "../run-command.h"
    - #include "../cache.h"
    + #include "../abspath.h"
     @@ compat/mingw.c: int link(const char *oldpath, const char *newpath)
      	return 0;
      }
  • 183: f977470 = 186: f760d2d mingw: lstat: compute correct size for symlinks

  • 184: 054fd07 = 187: 95cef50 Win32: implement basic symlink() functionality (file symlinks only)

  • 185: 48c81fd ! 188: 2a27a24 Win32: symlink: add support for symlinks to directories

    @@ Commit message
         Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
     
      ## compat/mingw.c ##
    -@@ compat/mingw.c: int mingw_core_config(const char *var, const char *value, void *cb)
    +@@ compat/mingw.c: int mingw_core_config(const char *var, const char *value,
      	return 0;
      }
      
  • 186: cb7acac ! 189: d203393 mingw: try to create symlinks without elevated permissions

    @@ Commit message
         Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
     
      ## compat/mingw.c ##
    -@@ compat/mingw.c: int mingw_core_config(const char *var, const char *value, void *cb)
    +@@ compat/mingw.c: int mingw_core_config(const char *var, const char *value,
      	return 0;
      }
      
  • 187: ecb5c65 = 190: e284941 mingw: emulate stat() a little more faithfully

  • 188: 46e6fb9 = 191: 61e517b mingw: special-case index entries for symlinks with buggy size

  • 189: b5e62b7 = 192: 158ea61 mingw: introduce code to detect whether we're inside a Windows container

  • 190: 144d3ff = 193: 176286b mingw: when running in a Windows container, try to rename() harder

  • 193: 09eb3e4 = 194: 6ae5ec0 Win32: symlink: move phantom symlink creation to a separate function

  • 191: d2e1e58 = 195: d4dc14b mingw: move the file_attr_to_st_mode() function definition

  • 194: a5102ee ! 196: 2edd352 Introduce helper to create symlinks that knows about index_state

    @@ builtin/difftool.c: static int run_dir_diff(const char *extcmd, int symlinks, co
      						goto finish;
      					}
     
    - ## builtin/init-db.c ##
    -@@ builtin/init-db.c: static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
    - 			if (strbuf_readlink(&lnk, template_path->buf,
    - 					    st_template.st_size) < 0)
    - 				die_errno(_("cannot readlink '%s'"), template_path->buf);
    --			if (symlink(lnk.buf, path->buf))
    -+			if (create_symlink(NULL, lnk.buf, path->buf))
    - 				die_errno(_("cannot symlink '%s' '%s'"),
    - 					  lnk.buf, path->buf);
    - 			strbuf_release(&lnk);
    -@@ builtin/init-db.c: static int create_default_files(const char *template_path,
    - 		path = git_path_buf(&buf, "tXXXXXX");
    - 		if (!close(xmkstemp(path)) &&
    - 		    !unlink(path) &&
    --		    !symlink("testing", path) &&
    -+		    !create_symlink(NULL, "testing", path) &&
    - 		    !lstat(path, &st1) &&
    - 		    S_ISLNK(st1.st_mode))
    - 			unlink(path); /* good */
    -
      ## compat/mingw.c ##
     @@ compat/mingw.c: int link(const char *oldpath, const char *newpath)
      	return 0;
    @@ refs/files-backend.c: static int create_ref_symlink(struct ref_lock *lock, const
      	free(ref_path);
      
      	if (ret)
    +
    + ## setup.c ##
    +@@ setup.c: static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
    + 			if (strbuf_readlink(&lnk, template_path->buf,
    + 					    st_template.st_size) < 0)
    + 				die_errno(_("cannot readlink '%s'"), template_path->buf);
    +-			if (symlink(lnk.buf, path->buf))
    ++			if (create_symlink(NULL, lnk.buf, path->buf))
    + 				die_errno(_("cannot symlink '%s' '%s'"),
    + 					  lnk.buf, path->buf);
    + 			strbuf_release(&lnk);
    +@@ setup.c: static int create_default_files(const char *template_path,
    + 		path = git_path_buf(&buf, "tXXXXXX");
    + 		if (!close(xmkstemp(path)) &&
    + 		    !unlink(path) &&
    +-		    !symlink("testing", path) &&
    ++		    !create_symlink(NULL, "testing", path) &&
    + 		    !lstat(path, &st1) &&
    + 		    S_ISLNK(st1.st_mode))
    + 			unlink(path); /* good */
  • 192: bb65c4d = 197: 02a37cf mingw: Windows Docker volumes are not symbolic links

  • 195: cb86163 = 198: ee48021 mingw: allow to specify the symlink type in .gitattributes

  • 235: 04a3d4e = 199: bcba099 mingw: work around rename() failing on a read-only file

  • 196: 3ebb19b = 200: 8f802be Win32: symlink: add test for symlink attribute

  • 197: 4f8aef2 = 201: 313781c mingw: explicitly specify with which cmd to prefix the cmdline

  • 198: c34949e = 202: d158dfb mingw: when path_lookup() failed, try BusyBox

  • 199: f03869e = 203: 4165b73 test-lib: avoid unnecessary Perl invocation

  • 200: 41772f8 = 204: 6b17655 test-tool: learn to act as a drop-in replacement for iconv

  • 201: ce1cc22 = 205: 3077c7b tests(mingw): if iconv is unavailable, use test-helper --iconv

  • 202: 899e94a = 206: 87e9276 gitattributes: mark .png files as binary

  • 203: 4da2f6f ! 207: 469ccca tests: move test PNGs into t/lib-diff/

    @@ t/t6407-merge-binary.sh: TEST_PASSES_SANITIZE_LEAK=true
      	test_tick &&
     
      ## t/t9200-git-cvsexportcommit.sh ##
    -@@ t/t9200-git-cvsexportcommit.sh: test_expect_success \
    -     'mkdir A B C D E F &&
    -      echo hello1 >A/newfile1.txt &&
    -      echo hello2 >B/newfile2.txt &&
    --     cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&
    --     cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&
    -+     cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png C/newfile3.png &&
    -+     cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png D/newfile4.png &&
    -      git add A/newfile1.txt &&
    -      git add B/newfile2.txt &&
    -      git add C/newfile3.png &&
    -@@ t/t9200-git-cvsexportcommit.sh: test_expect_success \
    -      rm -f B/newfile2.txt &&
    -      rm -f C/newfile3.png &&
    -      echo Hello5  >E/newfile5.txt &&
    --     cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&
    --     cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&
    -+     cp "$TEST_DIRECTORY"/lib-diff/test-binary-2.png D/newfile4.png &&
    -+     cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png F/newfile6.png &&
    -      git add E/newfile5.txt &&
    -      git add F/newfile6.png &&
    -      git commit -a -m "Test: Remove, add and update" &&
    -@@ t/t9200-git-cvsexportcommit.sh: test_expect_success \
    -      'mkdir "G g" &&
    -       echo ok then >"G g/with spaces.txt" &&
    -       git add "G g/with spaces.txt" && \
    --      cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \
    -+      cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png "G g/with spaces.png" && \
    -       git add "G g/with spaces.png" &&
    -       git commit -a -m "With spaces" &&
    -       id=$(git rev-list --max-count=1 HEAD) &&
    -@@ t/t9200-git-cvsexportcommit.sh: test_expect_success \
    - test_expect_success \
    -      'Update file with spaces in file name' \
    -      'echo Ok then >>"G g/with spaces.txt" &&
    --      cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \
    -+      cat "$TEST_DIRECTORY"/lib-diff/test-binary-1.png \
    -+	>>"G g/with spaces.png" && \
    -       git add "G g/with spaces.png" &&
    -       git commit -a -m "Update with spaces" &&
    -       id=$(git rev-list --max-count=1 HEAD) &&
    -@@ t/t9200-git-cvsexportcommit.sh: test_expect_success !MINGW \
    -      'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
    -       echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
    -       git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
    --      cp "$TEST_DIRECTORY"/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
    -+      cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
    -       git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
    -       git commit -a -m "Går det så går det" && \
    -       id=$(git rev-list --max-count=1 HEAD) &&
    +@@ t/t9200-git-cvsexportcommit.sh: test_expect_success 'New file' '
    + 	mkdir A B C D E F &&
    + 	echo hello1 >A/newfile1.txt &&
    + 	echo hello2 >B/newfile2.txt &&
    +-	cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&
    +-	cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&
    ++	cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png C/newfile3.png &&
    ++	cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png D/newfile4.png &&
    + 	git add A/newfile1.txt &&
    + 	git add B/newfile2.txt &&
    + 	git add C/newfile3.png &&
    +@@ t/t9200-git-cvsexportcommit.sh: test_expect_success 'Remove two files, add two and update two' '
    + 	rm -f B/newfile2.txt &&
    + 	rm -f C/newfile3.png &&
    + 	echo Hello5  >E/newfile5.txt &&
    +-	cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&
    +-	cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&
    ++	cp "$TEST_DIRECTORY"/lib-diff/test-binary-2.png D/newfile4.png &&
    ++	cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png F/newfile6.png &&
    + 	git add E/newfile5.txt &&
    + 	git add F/newfile6.png &&
    + 	git commit -a -m "Test: Remove, add and update" &&
    +@@ t/t9200-git-cvsexportcommit.sh: test_expect_success 'New file with spaces in file name' '
    + 	mkdir "G g" &&
    + 	echo ok then >"G g/with spaces.txt" &&
    + 	git add "G g/with spaces.txt" && \
    +-	cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \
    ++	cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png "G g/with spaces.png" && \
    + 	git add "G g/with spaces.png" &&
    + 	git commit -a -m "With spaces" &&
    + 	id=$(git rev-list --max-count=1 HEAD) &&
    +@@ t/t9200-git-cvsexportcommit.sh: test_expect_success 'New file with spaces in file name' '
    + 
    + test_expect_success 'Update file with spaces in file name' '
    + 	echo Ok then >>"G g/with spaces.txt" &&
    +-	cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \
    ++	cat "$TEST_DIRECTORY"/lib-diff/test-binary-1.png >>"G g/with spaces.png" && \
    + 	git add "G g/with spaces.png" &&
    + 	git commit -a -m "Update with spaces" &&
    + 	id=$(git rev-list --max-count=1 HEAD) &&
    +@@ t/t9200-git-cvsexportcommit.sh: test_expect_success !MINGW 'File with non-ascii file name' '
    + 	mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
    + 	echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
    + 	git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
    +-	cp "$TEST_DIRECTORY"/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
    ++	cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
    + 	git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
    + 	git commit -a -m "Går det så går det" && \
    + 	id=$(git rev-list --max-count=1 HEAD) &&
  • 204: 931a85f = 208: e150d47 tests: only override sort & find if there are usable ones in /usr/bin/

  • 205: 9568100 = 209: 70c6aa5 tests: use the correct path separator with BusyBox

  • 206: cd48f43 = 210: 75584cd mingw: only use Bash-ism builtin pwd -W when available

  • 207: 016cb81 = 211: bca0eb4 tests (mingw): remove Bash-specific pwd option

  • 208: 74a967b = 212: cc7289d test-lib: add BUSYBOX prerequisite

  • 209: 8fd5fd1 = 213: 1f4c1ab t5003: use binary file from t/lib-diff/

  • 210: fbf6f7f = 214: 4ea7bbb t5532: workaround for BusyBox on Windows

  • 211: 2078b22 = 215: 0d7af1d t5605: special-case hardlink test for BusyBox-w32

  • 212: cbbd081 = 216: 8d74ee4 t5813: allow for $PWD to be a Windows path

  • 213: 6ee054b = 217: 285a784 t9200: skip tests when $PWD contains a colon

  • 216: 84bdaf4 = 218: ec8a47c mingw: add a Makefile target to copy test artifacts

  • 233: 330483e = 219: e50c0e2 mingw: optionally enable wsl compability file mode bits

  • 219: 24182c5 = 220: 8eba75c Describe Git for Windows' architecture [no ci]

  • 220: e8ddb66 = 221: 72c7c7c Modify the Code of Conduct for Git for Windows

  • 221: aceaa50 = 222: 479c16e CONTRIBUTING.md: add guide for first-time contributors

  • 225: 902f955 = 223: cc50f8e README.md: Add a Windows-specific preamble

  • 226: d74fda9 = 224: 47c2e5d Add an issue template

  • 214: 6f70a0c ! 225: 34b952e mingw: kill child processes in a gentler way

    @@ Commit message
     
      ## compat/mingw.c ##
     @@
    - #include "../cache.h"
    + #include "../run-command.h"
      #include "../abspath.h"
      #include "../alloc.h"
     +#include "win32/exit-process.h"
  • 215: caf7d5a = 226: f7d1040 mingw: do not call xutftowcs_path in mingw_mktemp

  • 227: f8d56e2 = 227: 0f8d6e4 Modify the GitHub Pull Request template (to reflect Git for Windows)

  • 217: f1aa6eb = 228: e6c2e96 mingw: really handle SIGINT

  • 218: 874cf26 ! 229: 5d98fb4 Partially un-revert "editor: save and reset terminal after calling EDITOR"

    @@ Commit message
     
      ## editor.c ##
     @@
    + #include "strvec.h"
      #include "run-command.h"
      #include "sigchain.h"
    - #include "wrapper.h"
     +#include "compat/terminal.h"
      
      #ifndef DEFAULT_EDITOR
  • 222: 9abd55a = 230: 216fd49 reset: reinstate support for the deprecated --stdin option

  • 223: 746ca76 ! 231: ffbf3d5 fsmonitor: reintroduce core.useBuiltinFSMonitor

    @@ Commit message
     
      ## Documentation/config/advice.txt ##
     @@ Documentation/config/advice.txt: advice.*::
    - 		checkout.
    - 	diverging::
    - 		Advice shown when a fast-forward is not possible.
    + 		Advice shown when a user tries to create a worktree from an
    + 		invalid reference, to instruct how to create a new orphan
    + 		branch instead.
    ++
     +	useCoreFSMonitorConfig::
     +		Advice shown if the deprecated 'core.useBuiltinFSMonitor' config
     +		setting is in use.
    @@ advice.c: static struct {
      	[ADVICE_UPDATE_SPARSE_PATH]			= { "updateSparsePath", 1 },
     +	[ADVICE_USE_CORE_FSMONITOR_CONFIG]		= { "useCoreFSMonitorConfig", 1 },
      	[ADVICE_WAITING_FOR_EDITOR]			= { "waitingForEditor", 1 },
    + 	[ADVICE_WORKTREE_ADD_ORPHAN]			= { "worktreeAddOrphan", 1 },
      };
    - 
     
      ## advice.h ##
     @@ advice.h: struct string_list;
    @@ advice.h: struct string_list;
     +	ADVICE_USE_CORE_FSMONITOR_CONFIG,
      	ADVICE_WAITING_FOR_EDITOR,
      	ADVICE_SKIPPED_CHERRY_PICKS,
    - };
    + 	ADVICE_WORKTREE_ADD_ORPHAN,
     
      ## fsmonitor-settings.c ##
     @@
  • 224: f5ff040 = 232: cc2818c Add a GitHub workflow to monitor component updates

  • 228: 06bae2d = 233: 6460b6e .github: Add configuration for the Sentiment Bot

  • 229: d605866 = 234: f8d7fd8 Document how $HOME is set on Windows

  • 230: 20a9e18 = 235: 806af71 SECURITY.md: document Git for Windows' policies

  • 231: db30130 (upstream: db30130) < -: ------------ http: handle both "h2" and "h2h3" in curl info lines

  • 234: 4a1821d < -: ------------ git-for-windows: prepare for 2.41.0(3) release

Below, I offer a detailed analysis of the non-trivial differences.

Whitespace issues introduced upstream

An upstream change triggered a check-whitespace issue in a preliminary version of this here PR, which is responsible for this very new patch that I intend on upstreaming today:

  • -: ------------ > 119: 79ef783 t0040: declare non-tab indentation to be okay in this script

The sideband toggle is now implemented more efficiently

As tested in many versions of the shears/* branches, I've decided to avoid using a callback anymore (which would require non-trivial adaptations what with upstream's signature change of git_config()'s callback function). I also touched up the commit message so that we have a better chance upstreaming this option than last time (although it probably needs a lot more context, probably gleaning the explanations from #2375):

  • 24: cf04b0c ! 114: dd0d06d Config option to disable side-band-64k for transport
diff
@@ Metadata
 Author: Thomas Braun <thomas.braun@byte-physics.de>

  ## Commit message ##
-    Config option to disable side-band-64k for transport
+    transport: optionally disable side-band-64k

-    Since commit 0c499ea60f the send-pack builtin uses the side-band-64k
+    Since commit 0c499ea60fda (send-pack: demultiplex a sideband stream with
+    status data, 2010-02-05) the send-pack builtin uses the side-band-64k
     capability if advertised by the server.

     Unfortunately this breaks pushing over the dump git protocol if used
     over a network connection.

     The detailed reasons for this breakage are (by courtesy of Jeff Preshing,
-    quoted from ttps://groups.google.com/d/msg/msysgit/at8D7J-h7mw/eaLujILGUWoJ):
-    ----------------------------------------------------------------------------
-    MinGW wraps Windows sockets in CRT file descriptors in order to mimic the
-    functionality of POSIX sockets. This causes msvcrt.dll to treat sockets as
-    Installable File System (IFS) handles, calling ReadFile, WriteFile,
-    DuplicateHandle and CloseHandle on them. This approach works well in simple
-    cases on recent versions of Windows, but does not support all usage patterns.
-    In particular, using this approach, any attempt to read & write concurrently
-    on the same socket (from one or more processes) will deadlock in a scenario
-    where the read waits for a response from the server which is only invoked after
-    the write. This is what send_pack currently attempts to do in the use_sideband
-    codepath.
-    ----------------------------------------------------------------------------
+    quoted from https://groups.google.com/d/msg/msysgit/at8D7J-h7mw/eaLujILGUWoJ):

-    The new config option "sendpack.sideband" allows to override the side-band-64k
-    capability of the server, and thus makes the dump git protocol work.
+            MinGW wraps Windows sockets in CRT file descriptors in order to
+            mimic the functionality of POSIX sockets. This causes msvcrt.dll
+            to treat sockets as Installable File System (IFS) handles,
+            calling ReadFile, WriteFile, DuplicateHandle and CloseHandle on
+            them. This approach works well in simple cases on recent
+            versions of Windows, but does not support all usage patterns. In
+            particular, using this approach, any attempt to read & write
+            concurrently on the same socket (from one or more processes)
+            will deadlock in a scenario where the read waits for a response
+            from the server which is only invoked after the write. This is
+            what send_pack currently attempts to do in the use_sideband
+            codepath.
+
+    The new config option `sendpack.sideband` allows to override the
+    side-band-64k capability of the server, and thus makes the dumb git
+    protocol work.

     Other transportation methods like ssh and http/https still benefit from
-    the sideband channel, therefore the default value of "sendpack.sideband"
+    the sideband channel, therefore the default value of `sendpack.sideband`
     is still true.

-    [jes: split out the documentation into Documentation/config/]
-
     Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
-    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
     Signed-off-by: Oliver Schneider <oliver@assarbad.net>
+    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

  ## Documentation/config.txt ##
 @@ Documentation/config.txt: include::config/safe.txt[]
@@ Documentation/config/sendpack.txt (new)
 +   with the dump git protocol. Defaults to true.

  ## send-pack.c ##
-@@ send-pack.c: int option_parse_push_signed(const struct option *opt,
-    die("bad %s argument: %s", opt->long_name, arg);
- }
-
-+static int config_use_sideband = 1;
-+
-+static int send_pack_config(const char *var, const char *value, void *unused)
-+{
-+   if (!strcmp("sendpack.sideband", var))
-+           config_use_sideband = git_config_bool(var, value);
-+
-+   return 0;
-+}
-+
- static void feed_object(const struct object_id *oid, FILE *fh, int negative)
- {
-    if (negative &&
+@@ send-pack.c: int send_pack(struct send_pack_args *args,
+    int need_pack_data = 0;
+    int allow_deleting_refs = 0;
+    int status_report = 0;
+-   int use_sideband = 0;
++   int use_sideband = 1;
+    int quiet_supported = 0;
+    int agent_supported = 0;
+    int advertise_sid = 0;
 @@ send-pack.c: int send_pack(struct send_pack_args *args,
             return 0;
     }

-+   git_config(send_pack_config, NULL);
-+
++   git_config_get_bool("sendpack.sideband", &use_sideband);
     git_config_get_bool("push.negotiate", &push_negotiate);
     if (push_negotiate)
             get_commons_through_negotiation(args->url, remote_refs, &commons);
@@ send-pack.c: int send_pack(struct send_pack_args *args,
     if (server_supports("ofs-delta"))
             args->use_ofs_delta = 1;
 -   if (server_supports("side-band-64k"))
-+   if (config_use_sideband && server_supports("side-band-64k"))
-            use_sideband = 1;
+-           use_sideband = 1;
++   use_sideband = use_sideband && server_supports("side-band-64k");
     if (server_supports("quiet"))
             quiet_supported = 1;
+    if (server_supports("agent"))

Reordering patches

To keep each commit in a compileable state, we need to e.g. move the MAX_LONG_PATH into the commit that introduces it and use MAX_PATH before that commit:

  • 84: 38c82cb ! 117: dbb4179 Add config option windows.appendAtomically
diff
@@ compat/mingw.c: ssize_t mingw_write(int fd, const void *buf, size_t len)
                     errno = EPIPE;
 -           else
 +           else {
-+                   wchar_t path[MAX_LONG_PATH];
++                   wchar_t path[MAX_PATH];
 +                   DWORD ret = GetFinalPathNameByHandleW(h, path,
 +                                                   ARRAY_SIZE(path), 0);
 +                   UINT drive_type = ret > 0 && ret < ARRAY_SIZE(path) ?
diff
@@ compat/mingw.c: static enum hide_dotfiles_type hide_dotfiles = HIDE_DOTFILES_DOT
 +   return enabled < 0 ? fallback : enabled;
 +}
 +
- int mingw_core_config(const char *var, const char *value, void *cb)
+ int mingw_core_config(const char *var, const char *value,
+                  const struct config_context *ctx, void *cb)
  {
-    if (!strcmp(var, "core.hidedotfiles")) {
 @@ compat/mingw.c: static wchar_t *normalize_ntpath(wchar_t *wbuf)
  int mingw_unlink(const char *pathname)
  {
@@ compat/mingw.c: FILE *mingw_freopen (const char *filename, const char *otype, FI

     if (xutftowcs(wotype, otype, ARRAY_SIZE(wotype)) < 0)
 @@ compat/mingw.c: ssize_t mingw_write(int fd, const void *buf, size_t len)
+            if (GetFileType(h) == FILE_TYPE_PIPE)
+                    errno = EPIPE;
+            else {
+-                   wchar_t path[MAX_PATH];
++                   wchar_t path[MAX_LONG_PATH];
+                    DWORD ret = GetFinalPathNameByHandleW(h, path,
+                                                    ARRAY_SIZE(path), 0);
+                    UINT drive_type = ret > 0 && ret < ARRAY_SIZE(path) ?
+@@ compat/mingw.c: ssize_t mingw_write(int fd, const void *buf, size_t len)

  int mingw_access(const char *filename, int mode)
  {
@@ compat/mingw.c: int wmain(int argc, const wchar_t **wargv)

  ## compat/mingw.h ##
 @@ compat/mingw.h: typedef _sigset_t sigset_t;
+ #endif

  extern int core_fscache;
-
-+struct repository;
 +int are_long_paths_enabled(void);
-+

</details>

## `init-db()` moved from `builtin/init-db.c` to `setup.c`

This explains the chatty diff (that does not contain any functional changes) in:

> * 80:  e7911298b87f !  74:  0f7910d9a374 init: do parse _all_ core.* settings early

<details><summary>diff</summary>


``````diff
@@ Commit message

     Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

- ## builtin/init-db.c ##
-@@ builtin/init-db.c: int init_db(const char *git_dir, const char *real_git_dir,
-    startup_info->have_repository = 1;
-
-    /* Ensure `core.hidedotfiles` is processed */
--   git_config(platform_core_config, NULL);
-+   git_config(git_default_core_config, NULL);
-
-    safe_create_dir(git_dir, 0);
-
-
  ## config.c ##
 @@ config.c: int git_config_color(char *dest, const char *var, const char *value)
     return 0;
  }

--static int git_default_core_config(const char *var, const char *value, void *cb)
-+int git_default_core_config(const char *var, const char *value, void *cb)
+-static int git_default_core_config(const char *var, const char *value,
+-                              const struct config_context *ctx, void *cb)
++int git_default_core_config(const char *var, const char *value,
++                       const struct config_context *ctx, void *cb)
  {
     /* This needs a better name */
     if (!strcmp(var, "core.filemode")) {

  ## config.h ##
-@@ config.h: struct config_options {
- typedef int (*config_fn_t)(const char *, const char *, void *);
+@@ config.h: typedef int (*config_fn_t)(const char *, const char *,

- int git_default_config(const char *, const char *, void *);
-+int git_default_core_config(const char *var, const char *value, void *cb);
+ int git_default_config(const char *, const char *,
+                   const struct config_context *, void *);
++int git_default_core_config(const char *var, const char *value,
++                       const struct config_context *ctx, void *cb);

  /**
   * Read a specific file in git-config format.
+
+ ## setup.c ##
+@@ setup.c: int init_db(const char *git_dir, const char *real_git_dir,
+    startup_info->have_repository = 1;
+
+    /* Ensure `core.hidedotfiles` is processed */
+-   git_config(platform_core_config, NULL);
++   git_config(git_default_core_config, NULL);
+
+    safe_create_dir(git_dir, 0);
+

and

  • 194: a5102ee ! 196: 2edd352 Introduce helper to create symlinks that knows about index_state
diff
@@ builtin/difftool.c: static int run_dir_diff(const char *extcmd, int symlinks, co
                                             goto finish;
                                     }

- ## builtin/init-db.c ##
-@@ builtin/init-db.c: static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
-                    if (strbuf_readlink(&lnk, template_path->buf,
-                                        st_template.st_size) < 0)
-                            die_errno(_("cannot readlink '%s'"), template_path->buf);
--                   if (symlink(lnk.buf, path->buf))
-+                   if (create_symlink(NULL, lnk.buf, path->buf))
-                            die_errno(_("cannot symlink '%s' '%s'"),
-                                      lnk.buf, path->buf);
-                    strbuf_release(&lnk);
-@@ builtin/init-db.c: static int create_default_files(const char *template_path,
-            path = git_path_buf(&buf, "tXXXXXX");
-            if (!close(xmkstemp(path)) &&
-                !unlink(path) &&
--               !symlink("testing", path) &&
-+               !create_symlink(NULL, "testing", path) &&
-                !lstat(path, &st1) &&
-                S_ISLNK(st1.st_mode))
-                    unlink(path); /* good */
-
  ## compat/mingw.c ##
 @@ compat/mingw.c: int link(const char *oldpath, const char *newpath)
     return 0;
@@ refs/files-backend.c: static int create_ref_symlink(struct ref_lock *lock, const
     free(ref_path);

     if (ret)
+
+ ## setup.c ##
+@@ setup.c: static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
+                    if (strbuf_readlink(&lnk, template_path->buf,
+                                        st_template.st_size) < 0)
+                            die_errno(_("cannot readlink '%s'"), template_path->buf);
+-                   if (symlink(lnk.buf, path->buf))
++                   if (create_symlink(NULL, lnk.buf, path->buf))
+                            die_errno(_("cannot symlink '%s' '%s'"),
+                                      lnk.buf, path->buf);
+                    strbuf_release(&lnk);
+@@ setup.c: static int create_default_files(const char *template_path,
+            path = git_path_buf(&buf, "tXXXXXX");
+            if (!close(xmkstemp(path)) &&
+                !unlink(path) &&
+-               !symlink("testing", path) &&
++               !create_symlink(NULL, "testing", path) &&
+                !lstat(path, &st1) &&
+                S_ISLNK(st1.st_mode))
+                    unlink(path); /* good */

Upstream shuffling in t9200

The code moved around a bit, it seems, but there is no functional change required:

diff
@@ t/t6407-merge-binary.sh: TEST_PASSES_SANITIZE_LEAK=true
     test_tick &&

  ## t/t9200-git-cvsexportcommit.sh ##
-@@ t/t9200-git-cvsexportcommit.sh: test_expect_success \
-     'mkdir A B C D E F &&
-      echo hello1 >A/newfile1.txt &&
-      echo hello2 >B/newfile2.txt &&
--     cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&
--     cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&
-+     cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png C/newfile3.png &&
-+     cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png D/newfile4.png &&
-      git add A/newfile1.txt &&
-      git add B/newfile2.txt &&
-      git add C/newfile3.png &&
-@@ t/t9200-git-cvsexportcommit.sh: test_expect_success \
-      rm -f B/newfile2.txt &&
-      rm -f C/newfile3.png &&
-      echo Hello5  >E/newfile5.txt &&
--     cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&
--     cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&
-+     cp "$TEST_DIRECTORY"/lib-diff/test-binary-2.png D/newfile4.png &&
-+     cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png F/newfile6.png &&
-      git add E/newfile5.txt &&
-      git add F/newfile6.png &&
-      git commit -a -m "Test: Remove, add and update" &&
-@@ t/t9200-git-cvsexportcommit.sh: test_expect_success \
-      'mkdir "G g" &&
-       echo ok then >"G g/with spaces.txt" &&
-       git add "G g/with spaces.txt" && \
--      cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \
-+      cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png "G g/with spaces.png" && \
-       git add "G g/with spaces.png" &&
-       git commit -a -m "With spaces" &&
-       id=$(git rev-list --max-count=1 HEAD) &&
-@@ t/t9200-git-cvsexportcommit.sh: test_expect_success \
- test_expect_success \
-      'Update file with spaces in file name' \
-      'echo Ok then >>"G g/with spaces.txt" &&
--      cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \
-+      cat "$TEST_DIRECTORY"/lib-diff/test-binary-1.png \
-+   >>"G g/with spaces.png" && \
-       git add "G g/with spaces.png" &&
-       git commit -a -m "Update with spaces" &&
-       id=$(git rev-list --max-count=1 HEAD) &&
-@@ t/t9200-git-cvsexportcommit.sh: test_expect_success !MINGW \
-      'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
-       echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
-       git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
--      cp "$TEST_DIRECTORY"/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
-+      cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
-       git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
-       git commit -a -m "Går det så går det" && \
-       id=$(git rev-list --max-count=1 HEAD) &&
+@@ t/t9200-git-cvsexportcommit.sh: test_expect_success 'New file' '
+    mkdir A B C D E F &&
+    echo hello1 >A/newfile1.txt &&
+    echo hello2 >B/newfile2.txt &&
+-   cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&
+-   cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&
++   cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png C/newfile3.png &&
++   cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png D/newfile4.png &&
+    git add A/newfile1.txt &&
+    git add B/newfile2.txt &&
+    git add C/newfile3.png &&
+@@ t/t9200-git-cvsexportcommit.sh: test_expect_success 'Remove two files, add two and update two' '
+    rm -f B/newfile2.txt &&
+    rm -f C/newfile3.png &&
+    echo Hello5  >E/newfile5.txt &&
+-   cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&
+-   cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&
++   cp "$TEST_DIRECTORY"/lib-diff/test-binary-2.png D/newfile4.png &&
++   cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png F/newfile6.png &&
+    git add E/newfile5.txt &&
+    git add F/newfile6.png &&
+    git commit -a -m "Test: Remove, add and update" &&
+@@ t/t9200-git-cvsexportcommit.sh: test_expect_success 'New file with spaces in file name' '
+    mkdir "G g" &&
+    echo ok then >"G g/with spaces.txt" &&
+    git add "G g/with spaces.txt" && \
+-   cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \
++   cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png "G g/with spaces.png" && \
+    git add "G g/with spaces.png" &&
+    git commit -a -m "With spaces" &&
+    id=$(git rev-list --max-count=1 HEAD) &&
+@@ t/t9200-git-cvsexportcommit.sh: test_expect_success 'New file with spaces in file name' '
+
+ test_expect_success 'Update file with spaces in file name' '
+    echo Ok then >>"G g/with spaces.txt" &&
+-   cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \
++   cat "$TEST_DIRECTORY"/lib-diff/test-binary-1.png >>"G g/with spaces.png" && \
+    git add "G g/with spaces.png" &&
+    git commit -a -m "Update with spaces" &&
+    id=$(git rev-list --max-count=1 HEAD) &&
+@@ t/t9200-git-cvsexportcommit.sh: test_expect_success !MINGW 'File with non-ascii file name' '
+    mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
+    echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
+    git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
+-   cp "$TEST_DIRECTORY"/test-binary-1.png ├à/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/├Ñ/├ñ/├/g├Ñrdets├Ñg├Ñrdet.png &&
++   cp "$TEST_DIRECTORY"/lib-diff/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
+    git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
+    git commit -a -m "Går det så går det" && \
+    id=$(git rev-list --max-count=1 HEAD) &&

Non-trivial context changes

The if (experimental) was changed from a single-statement conditional to a multi-statement one upstream, therefore we do not have to introduce the curly brackets anymore:

  • 81: d891c36 ! 75: ac44652 Enable the built-in FSMonitor as an experimental feature
diff
@@ repo-settings.c
  static void repo_cfg_bool(struct repository *r, const char *key, int *dest,
                       int def)
 @@ repo-settings.c: void prepare_repo_settings(struct repository *r)
-    repo_cfg_bool(r, "feature.experimental", &experimental, 0);
-
-    /* Defaults modified by feature.* */
--   if (experimental)
-+   if (experimental) {
+    if (experimental) {
             r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING;
+            r->settings.pack_use_bitmap_boundary_traversal = 1;
 +
 +           /*
 +            * Force enable the builtin FSMonitor (unless the repo
@@ repo-settings.c: void prepare_repo_settings(struct repository *r)
 +               repo_config_get_maybe_bool(r, "core.fsmonitor", &value) > 0 &&
 +               repo_config_get_bool(r, "core.useBuiltinFSMonitor", &value))
 +                   fsm_settings__set_ipc(r);
-+   }
+    }
     if (manyfiles) {
             r->settings.index_version = 4;
-            r->settings.index_skip_hash = 1;

This one also looks more complicated than it actually is:

  • 223: 746ca76 ! 231: ffbf3d5 fsmonitor: reintroduce core.useBuiltinFSMonitor
diff
@@ Commit message

  ## Documentation/config/advice.txt ##
 @@ Documentation/config/advice.txt: advice.*::
-            checkout.
-    diverging::
-            Advice shown when a fast-forward is not possible.
+            Advice shown when a user tries to create a worktree from an
+            invalid reference, to instruct how to create a new orphan
+            branch instead.
++
 +   useCoreFSMonitorConfig::
 +           Advice shown if the deprecated 'core.useBuiltinFSMonitor' config
 +           setting is in use.
@@ advice.c: static struct {
     [ADVICE_UPDATE_SPARSE_PATH]                     = { "updateSparsePath", 1 },
 +   [ADVICE_USE_CORE_FSMONITOR_CONFIG]              = { "useCoreFSMonitorConfig", 1 },
     [ADVICE_WAITING_FOR_EDITOR]                     = { "waitingForEditor", 1 },
+    [ADVICE_WORKTREE_ADD_ORPHAN]                    = { "worktreeAddOrphan", 1 },
  };
-

  ## advice.h ##
 @@ advice.h: struct string_list;
@@ advice.h: struct string_list;
 +   ADVICE_USE_CORE_FSMONITOR_CONFIG,
     ADVICE_WAITING_FOR_EDITOR,
     ADVICE_SKIPPED_CHERRY_PICKS,
- };
+    ADVICE_WORKTREE_ADD_ORPHAN,

  ## fsmonitor-settings.c ##
 @@

dscho and others added 30 commits August 7, 2023 21:41
If `feature.experimental` and `feature.manyFiles` are set and the user
has not explicitly turned off the builtin FSMonitor, we now start
the built-in FSMonitor by default.

Only forcing it when UNSET matches the behavior of UPDATE_DEFAULT_BOOL()
used for other repo settings.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
On LLP64 systems, such as Windows, the size of `long`, `int`, etc. is
only 32 bits (for backward compatibility). Git's use of `unsigned long`
for file memory sizes in many places, rather than size_t, limits the
handling of large files on LLP64 systems (commonly given as `>4GB`).

Provide a minimum test for handling a >4GB file. The `hash-object`
command, with the  `--literally` and without `-w` option avoids
writing the object, either loose or packed. This avoids the code paths
hitting the `bigFileThreshold` config test code, the zlib code, and the
pack code.

Subsequent patches will walk the test's call chain, converting types to
`size_t` (which is larger in LLP64 data models) where appropriate.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The previous commit adds a test that demonstrates a problem in the
`hash-object --literally` command, manifesting in an unnecessary file
size limit on systems using the LLP64 data model (which includes
Windows).

Walking the affected code path is `cmd_hash_object()` >> `hash_fd()` >>
`hash_literally()` >> `hash_object_file_literally()`.

The function `hash_object_file_literally()` is the first with a file
length parameter (via a mem buffer). This commit changes the type of
that parameter to the LLP64 compatible `size_t` type.

There are no other uses of the function. The `strbuf` type is already
`size_t` compatible.

Note: The hash-object test does not yet pass. Subsequent commits will
continue to walk the call tree's lower level functions to identify
further fixes.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Continue walking the code path for the >4GB `hash-object --literally`
test. The `hash_object_file_literally()` function internally uses both
`hash_object_file()` and `write_object_file_prepare()`. Both function
signatures use `unsigned long` rather than `size_t` for the mem buffer
sizes. Use `size_t` instead, for LLP64 compatibility.

While at it, convert those function's object's header buffer length to
`size_t` for consistency. The value is already upcast to `uintmax_t` for
print format compatibility.

Note: The hash-object test still does not pass. A subsequent commit
continues to walk the call tree's lower level hash functions to identify
further fixes.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Continue walking the code path for the >4GB `hash-object --literally`
test to the hash algorithm step for LLP64 systems.

This patch lets the SHA1DC code use `size_t`, making it compatible with
LLP64 data models (as used e.g. by Windows).

The interested reader of this patch will note that we adjust the
signature of the `git_SHA1DCUpdate()` function without updating _any_
call site. This certainly puzzled at least one reviewer already, so here
is an explanation:

This function is never called directly, but always via the macro
`platform_SHA1_Update`, which is usually called via the macro
`git_SHA1_Update`. However, we never call `git_SHA1_Update()` directly
in `struct git_hash_algo`. Instead, we call `git_hash_sha1_update()`,
which is defined thusly:

    static void git_hash_sha1_update(git_hash_ctx *ctx,
                                     const void *data, size_t len)
    {
        git_SHA1_Update(&ctx->sha1, data, len);
    }

i.e. it contains an implicit downcast from `size_t` to `unsigned long`
(before this here patch). With this patch, there is no downcast anymore.

With this patch, finally, the t1007-hash-object.sh "files over 4GB hash
literally" test case is fixed.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Just like the `hash-object --literally` code path, the `--stdin` code
path also needs to use `size_t` instead of `unsigned long` to represent
memory sizes, otherwise it would cause problems on platforms using the
LLP64 data model (such as Windows).

To limit the scope of the test case, the object is explicitly not
written to the object store, nor are any filters applied.

The `big` file from the previous test case is reused to save setup time;
To avoid relying on that side effect, it is generated if it does not
exist (e.g. when running via `sh t1007-*.sh --long --run=1,41`).

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
To complement the `--stdin` and `--literally` test cases that verify
that we can hash files larger than 4GB on 64-bit platforms using the
LLP64 data model, here is a test case that exercises `hash-object`
_without_ any options.

Just as before, we use the `big` file from the previous test case if it
exists to save on setup time, otherwise generate it.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
To verify that the `clean` side of the `clean`/`smudge` filter code is
correct with regards to LLP64 (read: to ensure that `size_t` is used
instead of `unsigned long`), here is a test case using a trivial filter,
specifically _not_ writing anything to the object store to limit the
scope of the test case.

As in previous commits, the `big` file from previous test cases is
reused if available, to save setup time, otherwise re-generated.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
In the case of Git for Windows (say, in a Git Bash window) running in a
Windows Subsystem for Linux (WSL) directory, the GetNamedSecurityInfoW()
call in is_path_owned_By_current_side() returns an error code other than
ERROR_SUCCESS. This is consistent behavior across this boundary.

In these cases, the owner would always be different because the WSL
owner is a different entity than the Windows user.

The change here is to suppress the error message that looks like this:

  error: failed to get owner for '//wsl.localhost/...' (1)

Before this change, this warning happens for every Git command,
regardless of whether the directory is marked with safe.directory.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
For Windows builds >= 15063 set $env:TERM to "xterm-256color" instead of
"cygwin" because they have a more capable console system that supports
this. Also set $env:COLORTERM="truecolor" if unset.

$env:TERM is initialized so that ANSI colors in color.c work, see
29a3963 (Win32: patch Windows environment on startup, 2012-01-15).

See git-for-windows#3629 regarding problems caused by always setting
$env:TERM="cygwin".

This is the same heuristic used by the Cygwin runtime.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
NtQueryObject under Wine can return a success but fill out no name.
In those situations, Wine will set Buffer to NULL, and set result to
the sizeof(OBJECT_NAME_INFORMATION).

Running a command such as

echo "$(git.exe --version 2>/dev/null)"

will crash due to a NULL pointer dereference when the code attempts to
null terminate the buffer, although, weirdly, removing the subshell or
redirecting stdout to a file will not trigger the crash.

Code has been added to also check Buffer and Length to ensure the check
is as robust as possible due to the current behavior being fragile at
best, and could potentially change in the future

This code is based on the behavior of NtQueryObject under wine and
reactos.

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
This is another fall-out of the recent refactoring flurry.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This fixes the build after 7bc341e (git-compat-util: add a test
balloon for C99 support, 2021-12-01).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This is now passed by default, ever since 6a8cbc4 (developer: enable
pedantic by default, 2021-09-03).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Since ef8a6c6 (reftable: utility functions, 2021-10-07) we not only
have a libreftable, but also a libreftable_test.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Visual Studio 2022 does not like that at all.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
These refactorings are really gifts that keep on giving.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
It is not useful because we do not have any persisted directory anymore,
not since dropping our Travis CI support.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
... so that we can test a MinGit backport in a private repository (with
GitHub Actions, minutes and parallel jobs are limited way more than with
Azure Pipelines in private repositories).

In this commit, we reinstate the exact version of `azure-pipelines.yml`
as 6081d38 (ci: retire the Azure Pipelines definition, 2020-04-11)
deleted.

Naturally, many adjustments are required to make it work again. Some of
the changes are actually outside of that file (such as the
`runs_on_pool` changes that are needed in the Azure Pipelines part of
`ci/lib.sh`) and they were made in the commits leading up to this here
commit.

However, other adjustments are required in the `azure-pipelines.yml`
file itself, and for ease of review (read: to build confidence in those
changes) they will be made in subsequent, individual commits that
explain the intent, context, implementation and justification like every
good commit message should do.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This is a follow-up to 6c280b4 (ci: remove GETTEXT_POISON jobs,
2021-01-20) after reinstating the Azure Pipeline.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
We have `ci/install-dependencies.sh` for that. Incidentally, this avoids
the following error in the linux-* jobs:

    The following packages have unmet dependencies:
    git-email : Depends: git (< 1:2.25.1-.) but 1:2.35.1-0ppa1~ubuntu20.04.1 is to be installed
	  Recommends: libemail-valid-perl but it is not going to be installed

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
We haven't used this feature in ages, we don't actually need to.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
…imal-sdk

The Azure Pipeline `git-sdk-64-minimal` was retired...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
These many refactorings in Git sure are gifts that keep on giving.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
CLANGARM64 is a relatively new MSYSTEM added by the MSYS2 team. In order
to have Git build correctly for this platform, let's add some
configuration for it to config.mak.uname.

Signed-off-by: Dennis Ameling <dennis@dennisameling.com>
This is inspired by d051ed7 (.github/workflows/main.yml: run
static-analysis on bionic, 2021-02-08) and by ef46584 (ci: update
'static-analysis' to Ubuntu 22.04, 2022-08-23), adapted to the Azure
Pipeline.

When Azure Pipelines' build agents transitioned 'ubuntu-latest' from
18.04 to 20.04, it broke our `static-analysis` job, since Coccinelle
was not madeavailable on Ubuntu focal (it is only available in the
universe suite).

This is not an issue with Ubuntu 22.04, but we will only know whether it
is an issue with 24.04 when _that_ comes out. So let's play it safe and
pin the `static_analysis` job to the latest Ubuntu version that we know
to offer a working Coccinelle package.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Whith Windows 2000, Microsoft introduced a flag to the PE header to mark executables as
"terminal server aware". Windows terminal servers provide a redirected Windows directory and
redirected registry hives when launching legacy applications without this flag set. Since we
do not use any INI files in the Windows directory and don't write to the registry, we don't
need  this additional preparation. Telling the OS that we don't need this should provide
slightly improved startup times in terminal server environments.

When building for supported Windows Versions with MSVC the /TSAWARE linker flag is
automatically set, but MinGW requires us to set the --tsaware flag manually.

This partially addresses git-for-windows#3935.

Signed-off-by: Matthias Aßhauer <mha1993@live.de>
Add FileVersion, which is a required field
As not all required fields were present, none were being included
Fixes git-for-windows#4090

Signed-off-by: Kiel Hurley <kielhurley@gmail.com>
dscho and others added 25 commits August 8, 2023 12:02
…ITOR"

In e3f7e01 (Revert "editor: save and reset terminal after calling
EDITOR", 2021-11-22), we reverted the commit wholesale where the
terminal state would be saved and restored before/after calling an
editor.

The reverted commit was intended to fix a problem with Windows Terminal
where simply calling `vi` would cause problems afterwards.

To fix the problem addressed by the revert, but _still_ keep the problem
with Windows Terminal fixed, let's revert the revert, with a twist: we
restrict the save/restore _specifically_ to the case where `vi` (or
`vim`) is called, and do not do the same for any other editor.

This should still catch the majority of the cases, and will bridge the
time until the original patch is re-done in a way that addresses all
concerns.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The `--stdin` option was a well-established paradigm in other commands,
therefore we implemented it in `git reset` for use by Visual Studio.

Unfortunately, upstream Git decided that it is time to introduce
`--pathspec-from-file` instead.

To keep backwards-compatibility for some grace period, we therefore
reinstate the `--stdin` option on top of the `--pathspec-from-file`
option, but mark it firmly as deprecated.

Helped-by: Victoria Dye <vdye@github.com>
Helped-by: Matthew John Cheetham <mjcheetham@outlook.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reintroduce the 'core.useBuiltinFSMonitor' config setting (originally added
in 0a756b2 (fsmonitor: config settings are repository-specific,
2021-03-05)) after its removal from the upstream version of FSMonitor.

Upstream, the 'core.useBuiltinFSMonitor' setting was rendered obsolete by
"overloading" the 'core.fsmonitor' setting to take a boolean value. However,
several applications (e.g., 'scalar') utilize the original config setting,
so it should be preserved for a deprecation period before complete removal:

* if 'core.fsmonitor' is a boolean, the user is correctly using the new
  config syntax; do not use 'core.useBuiltinFSMonitor'.
* if 'core.fsmonitor' is unspecified, use 'core.useBuiltinFSMonitor'.
* if 'core.fsmonitor' is a path, override and use the builtin FSMonitor if
  'core.useBuiltinFSMonitor' is 'true'; otherwise, use the FSMonitor hook
  indicated by the path.

Additionally, for this deprecation period, advise users to switch to using
'core.fsmonitor' to specify their use of the builtin FSMonitor.

Signed-off-by: Victoria Dye <vdye@github.com>
Rather than using private IFTTT Applets that send mails to this
maintainer whenever a new version of a Git for Windows component was
released, let's use the power of GitHub workflows to make this process
publicly visible.

This workflow monitors the Atom/RSS feeds, and opens a ticket whenever a
new version was released.

Note: Bash sometimes releases multiple patched versions within a few
minutes of each other (i.e. 5.1p1 through 5.1p4, 5.0p15 and 5.0p16). The
MSYS2 runtime also has a similar system. We can address those patches as
a group, so we shouldn't get multiple issues about them.

Note further: We're not acting on newlib releases, OpenSSL alphas, Perl
release candidates or non-stable Perl releases. There's no need to open
issues about them.

Co-authored-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
These are Git for Windows' Git GUI and gitk patches. We will have to
decide at some point what to do about them, but that's a little lower
priority (as Git GUI seems to be unmaintained for the time being, and
the gitk maintainer keeps a very low profile on the Git mailing list,
too).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The sentiment bot will help detect when things get too heated.
Hopefully.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
…dvice

clean: suggest using `core.longPaths` if paths are too long to remove
Git documentation refers to $HOME and $XDG_CONFIG_HOME often, but does not specify how or where these values come from on Windows where neither is set by default. The new documentation reflects the behavior of setup_windows_environment() in compat/mingw.c.

Signed-off-by: Alejandro Barreto <alejandro.barreto@ni.com>
This is the recommended way on GitHub to describe policies revolving around
security issues and about supported versions.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This was pull request git-for-windows#1645 from ZCube/master

Support windows container.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
…ws#4527)

With this patch, Git for Windows works as intended on mounted APFS
volumes (where renaming read-only files would fail).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This patch introduces support to set special NTFS attributes that are
interpreted by the Windows Subsystem for Linux as file mode bits, UID
and GID.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Handle Ctrl+C in Git Bash nicely

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
A fix for calling `vim` in Windows Terminal caused a regression and was
reverted. We partially un-revert this, to get the fix again.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This topic branch re-adds the deprecated --stdin/-z options to `git
reset`. Those patches were overridden by a different set of options in
the upstream Git project before we could propose `--stdin`.

We offered this in MinGit to applications that wanted a safer way to
pass lots of pathspecs to Git, and these applications will need to be
adjusted.

Instead of `--stdin`, `--pathspec-from-file=-` should be used, and
instead of `-z`, `--pathspec-file-nul`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Originally introduced as `core.useBuiltinFSMonitor` in Git for Windows
and developed, improved and stabilized there, the built-in FSMonitor
only made it into upstream Git (after unnecessarily long hemming and
hawing and throwing overly perfectionist style review sticks into the
spokes) as `core.fsmonitor = true`.

In Git for Windows, with this topic branch, we re-introduce the
now-obsolete config setting, with warnings suggesting to existing users
how to switch to the new config setting, with the intention to
ultimately drop the patch at some stage.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
…updates

Start monitoring updates of Git for Windows' component in the open
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho force-pushed the rebase-to-v2.42.0-rc0 branch from a8dc2c1 to 3b87459 Compare August 8, 2023 10:03
@dscho dscho marked this pull request as ready for review August 8, 2023 10:59
@dscho
Copy link
Member Author

dscho commented Aug 8, 2023

/git-artifacts

The tag-git workflow run was started

@dscho
Copy link
Member Author

dscho commented Aug 8, 2023

/release

The release-git workflow run was started

@dscho dscho merged commit 3b87459 into git-for-windows:main Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[New git version] v2.42.0-rc0