]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Sync with 2.22.2
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 4 Dec 2019 22:06:31 +0000 (23:06 +0100)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 6 Dec 2019 15:31:30 +0000 (16:31 +0100)
* maint-2.22: (43 commits)
  Git 2.22.2
  Git 2.21.1
  mingw: sh arguments need quoting in more circumstances
  mingw: fix quoting of empty arguments for `sh`
  mingw: use MSYS2 quoting even when spawning shell scripts
  mingw: detect when MSYS2's sh is to be spawned more robustly
  t7415: drop v2.20.x-specific work-around
  Git 2.20.2
  t7415: adjust test for dubiously-nested submodule gitdirs for v2.20.x
  Git 2.19.3
  Git 2.18.2
  Git 2.17.3
  Git 2.16.6
  test-drop-caches: use `has_dos_drive_prefix()`
  Git 2.15.4
  Git 2.14.6
  mingw: handle `subst`-ed "DOS drives"
  mingw: refuse to access paths with trailing spaces or periods
  mingw: refuse to access paths with illegal characters
  unpack-trees: let merged_entry() pass through do_add_entry()'s errors
  ...

17 files changed:
1  2 
Documentation/git-fast-import.txt
builtin/clone.c
builtin/submodule--helper.c
compat/mingw.c
compat/mingw.h
config.mak.uname
fast-import.c
fsck.c
git-compat-util.h
read-cache.c
submodule.c
submodule.h
t/t1450-fsck.sh
t/t9300-fast-import.sh
t/t9350-fast-export.sh
tree-walk.c
unpack-trees.c

Simple merge
diff --cc builtin/clone.c
Simple merge
Simple merge
diff --cc compat/mingw.c
index 738f0a826a51b850fcc93f0cadbf707c7eb0b492,176104a52a8fa59f2c0a519e0c0ff824d73b9491..7cbde1db34ae5af701c6f96173ac91c978145717
@@@ -2335,33 -2340,52 +2374,77 @@@ static void setup_windows_environment(v
        /* simulate TERM to enable auto-color (see color.c) */
        if (!getenv("TERM"))
                setenv("TERM", "cygwin", 1);
 +
 +      /* calculate HOME if not set */
 +      if (!getenv("HOME")) {
 +              /*
 +               * try $HOMEDRIVE$HOMEPATH - the home share may be a network
 +               * location, thus also check if the path exists (i.e. is not
 +               * disconnected)
 +               */
 +              if ((tmp = getenv("HOMEDRIVE"))) {
 +                      struct strbuf buf = STRBUF_INIT;
 +                      strbuf_addstr(&buf, tmp);
 +                      if ((tmp = getenv("HOMEPATH"))) {
 +                              strbuf_addstr(&buf, tmp);
 +                              if (is_directory(buf.buf))
 +                                      setenv("HOME", buf.buf, 1);
 +                              else
 +                                      tmp = NULL; /* use $USERPROFILE */
 +                      }
 +                      strbuf_release(&buf);
 +              }
 +              /* use $USERPROFILE if the home share is not available */
 +              if (!tmp && (tmp = getenv("USERPROFILE")))
 +                      setenv("HOME", tmp, 1);
 +      }
  }
  
+ int is_valid_win32_path(const char *path)
+ {
+       int preceding_space_or_period = 0, i = 0, periods = 0;
+       if (!protect_ntfs)
+               return 1;
+       skip_dos_drive_prefix((char **)&path);
+       for (;;) {
+               char c = *(path++);
+               switch (c) {
+               case '\0':
+               case '/': case '\\':
+                       /* cannot end in ` ` or `.`, except for `.` and `..` */
+                       if (preceding_space_or_period &&
+                           (i != periods || periods > 2))
+                               return 0;
+                       if (!c)
+                               return 1;
+                       i = periods = preceding_space_or_period = 0;
+                       continue;
+               case '.':
+                       periods++;
+                       /* fallthru */
+               case ' ':
+                       preceding_space_or_period = 1;
+                       i++;
+                       continue;
+               case ':': /* DOS drive prefix was already skipped */
+               case '<': case '>': case '"': case '|': case '?': case '*':
+                       /* illegal character */
+                       return 0;
+               default:
+                       if (c > '\0' && c < '\x20')
+                               /* illegal character */
+                               return 0;
+               }
+               preceding_space_or_period = 0;
+               i++;
+       }
+ }
 +#if !defined(_MSC_VER)
  /*
   * Disable MSVCRT command line wildcard expansion (__getmainargs called from
   * mingw startup code, see init.c in mingw runtime).
diff --cc compat/mingw.h
Simple merge
index db7f06b95fda4ea8de9f409e11f594c163220463,53f4463be701be2888b278fc13c08ca9c2eeddfe..3e46a8e399146dcb6140d529a73c8e4d9e7e3415
@@@ -434,46 -400,19 +434,45 @@@ ifeq ($(uname_S),Windows
                compat/win32/pthread.o compat/win32/syslog.o \
                compat/win32/trace2_win32_process_info.o \
                compat/win32/dirent.o
 -      COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
 -      BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
 -      EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj
 +      COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
 +      BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
 +      # invalidcontinue.obj allows Git's source code to close the same file
 +      # handle twice, or to access the osfhandle of an already-closed stdout
 +      # See https://msdn.microsoft.com/en-us/library/ms235330.aspx
 +      EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
        PTHREAD_LIBS =
        lib =
-       BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
 +      BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
 +ifndef DEBUG
 +      BASIC_CFLAGS += $(vcpkg_rel_lib)
 +else
 +      BASIC_CFLAGS += $(vcpkg_dbg_lib)
 +endif
 +      BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
 +
 +ifneq ($(USE_MSVC_CRTDBG),)
 +      # Optionally enable memory leak reporting.
 +      BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
 +endif
 +      # Always give "-Zi" to the compiler and "-debug" to linker (even in
 +      # release mode) to force a PDB to be generated (like RelWithDebInfo).
 +      BASIC_CFLAGS += -Zi
 +      BASIC_LDFLAGS += -debug -Zf
 +
 +ifdef NO_SAFESEH
 +      LDFLAGS += -SAFESEH:NO
 +endif
 +
  ifndef DEBUG
 -      BASIC_CFLAGS += -GL -Os -MD
 -      BASIC_LDFLAGS += -LTCG
 +      BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
 +      BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
        AR += -LTCG
  else
 -      BASIC_CFLAGS += -Zi -MDd
 +      BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
  endif
        X = .exe
 +
 +compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
  endif
  ifeq ($(uname_S),Interix)
        NO_INITGROUPS = YesPlease
diff --cc fast-import.c
Simple merge
diff --cc fsck.c
Simple merge
Simple merge
diff --cc read-cache.c
Simple merge
diff --cc submodule.c
index 0f199c51378dc93458904abcaca4f58875952313,9a3b0dfdc2fb62b7210d7756f67d91525e2107bc..9da7181321f089e8450ec7e39692f7928f5638a8
@@@ -1997,10 -2038,11 +2038,10 @@@ int validate_submodule_git_dir(char *gi
   * Embeds a single submodules git directory into the superprojects git dir,
   * non recursively.
   */
 -static void relocate_single_git_dir_into_superproject(const char *prefix,
 -                                                    const char *path)
 +static void relocate_single_git_dir_into_superproject(const char *path)
  {
        char *old_git_dir = NULL, *real_old_git_dir = NULL, *real_new_git_dir = NULL;
-       const char *new_git_dir;
+       char *new_git_dir;
        const struct submodule *sub;
  
        if (submodule_uses_worktrees(path))
diff --cc submodule.h
Simple merge
diff --cc t/t1450-fsck.sh
Simple merge
Simple merge
Simple merge
diff --cc tree-walk.c
Simple merge
diff --cc unpack-trees.c
Simple merge