Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Dec 22, 2014
  1. @gitster

    Merge branch 'dm/compat-s-ifmt-for-zos'

    gitster authored
    Long overdue departure from the assumption that S_IFMT is shared by
    everybody made in 2005.
    
    * dm/compat-s-ifmt-for-zos:
      compat: convert modes to use portable file type values
Commits on Dec 5, 2014
  1. @gitster

    Merge branch 'js/windows-open-eisdir-error'

    gitster authored
    * js/windows-open-eisdir-error:
      Windows: correct detection of EISDIR in mingw_open()
Commits on Dec 4, 2014
  1. @dm0- @gitster

    compat: convert modes to use portable file type values

    dm0- authored gitster committed
    This adds simple wrapper functions around calls to stat(), fstat(),
    and lstat() that translate the operating system's native file type
    bits to those used by most operating systems.  It also rewrites the
    S_IF* macros to the common values, so all file type processing is
    performed using the translated modes.  This makes projects portable
    across operating systems that use different file type definitions.
    
    Only the file type bits may be affected by these compatibility
    functions; the file permission bits are assumed to be 07777 and are
    passed through unchanged.
    
    Signed-off-by: David Michael <fedora.dm0@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 17, 2014
  1. @gitster

    Windows: correct detection of EISDIR in mingw_open()

    Johannes Sixt authored gitster committed
    According to the Linux open(2) man page, open() must return EISDIR
    if a directory was attempted to be opened for writing. Our emulation
    in mingw_open() does not get this right: it checks only for O_CREAT.
    
    Fix it to check for a write request.
    
    This fixes a failure in reflog handling, which opens files with
    O_APPEND|O_WRONLY, but without O_CREAT, and expects EISDIR when the
    named file happens to be a directory.
    
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 29, 2014
  1. @gitster

    Merge branch 'dm/port2zos'

    gitster authored
    z/OS port
    
    * dm/port2zos:
      compat/bswap.h: detect endianness from XL C compiler macros
      Makefile: reorder linker flags in the git executable rule
      git-compat-util.h: support variadic macros with the XL C compiler
Commits on Oct 27, 2014
  1. @dm0- @gitster

    compat/bswap.h: detect endianness from XL C compiler macros

    dm0- authored gitster committed
    There is no /usr/include/endian.h equivalent on z/OS, but the
    compiler will define macros to indicate endianness on host and
    target hardware.  This adds a test for these macros as a last
    resort for determining byte order.
    
    Signed-off-by: David Michael <fedora.dm0@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 22, 2014
  1. @gitster

    mingw.h: add dummy functions for sigset_t operations

    Johannes Sixt authored gitster committed
    Windows does not have POSIX-like signals, and so we ignore all
    operations on the non-existent signal mask machinery.
    
    Do not turn sigemptyset into a function, but leave it a macro that
    erases the code in the argument because it is used to set sa_mask
    of a struct sigaction, but our dummy in mingw.h does not have that
    member.
    
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 30, 2014
  1. @gitster

    Merge branch 'sk/mingw-uni-fix-more'

    gitster authored
    Most of these are battle-tested in msysgit and are needed to
    complete what has been merged to 'master' already.
    
    * sk/mingw-uni-fix-more:
      Win32: enable color output in Windows cmd.exe
      Win32: patch Windows environment on startup
      Win32: keep the environment sorted
      Win32: use low-level memory allocation during initialization
      Win32: reduce environment array reallocations
      Win32: don't copy the environment twice when spawning child processes
      Win32: factor out environment block creation
      Win32: unify environment function names
      Win32: unify environment case-sensitivity
      Win32: fix environment memory leaks
      Win32: Unicode environment (incoming)
      Win32: Unicode environment (outgoing)
      Revert "Windows: teach getenv to do a case-sensitive search"
      tests: do not pass iso8859-1 encoded parameter
Commits on Jul 21, 2014
  1. @gitster

    Merge branch 'maint'

    gitster authored
    * maint:
      use xmemdupz() to allocate copies of strings given by start and length
      use xcalloc() to allocate zero-initialized memory
  2. @gitster

    Merge branch 'sk/mingw-uni-fix'

    gitster authored
    * sk/mingw-uni-fix:
      Win32: Unicode file name support (dirent)
      Win32: Unicode file name support (except dirent)
  3. @gitster

    use xcalloc() to allocate zero-initialized memory

    René Scharfe authored gitster committed
    Use xcalloc() instead of xmalloc() followed by memset() to allocate
    and zero out memory because it's shorter and avoids duplicating the
    function parameters.
    
    Signed-off-by: Rene Scharfe <l.s.r@web.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. @kblees @gitster

    Win32: enable color output in Windows cmd.exe

    kblees authored gitster committed
    Git requires the TERM environment variable to be set for all color*
    settings. Simulate the TERM variable if it is not set (default on Windows).
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. @kblees @gitster

    Win32: patch Windows environment on startup

    kblees authored gitster committed
    Fix Windows specific environment settings on startup rather than checking
    for special values on every getenv call.
    
    As a side effect, this makes the patched environment (i.e. with properly
    initialized TMPDIR and TERM) available to child processes.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  6. @kblees @gitster

    Win32: keep the environment sorted

    kblees authored gitster committed
    The Windows environment is sorted, keep it that way for O(log n)
    environment access.
    
    Change compareenv to compare only the keys, so that it can be used to
    find an entry irrespective of the value.
    
    Change lookupenv to binary seach for an entry. Return one's complement of
    the insert position if not found (libc's bsearch returns NULL).
    
    Replace MSVCRT's getenv with a minimal do_getenv based on the binary search
    function.
    
    Change do_putenv to insert new entries at the correct position. Simplify
    the function by swapping if conditions and using memmove instead of for
    loops.
    
    Move qsort from make_environment_block to mingw_startup. We still need to
    sort on startup to make sure that the environment is sorted according to
    our compareenv function (while Win32 / CreateProcess requires the
    environment block to be sorted case-insensitively, CreateProcess currently
    doesn't enforce this, and some applications such as bash just don't care).
    
    Note that environment functions are _not_ thread-safe and are not required
    to be so by POSIX, the application is responsible for synchronizing access
    to the environment. MSVCRT's getenv and our new getenv implementation are
    better than that in that they are thread-safe with respect to other getenv
    calls as long as the environment is not modified. Git's indiscriminate use
    of getenv in background threads currently requires this property.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  7. @kblees @gitster

    Win32: use low-level memory allocation during initialization

    kblees authored gitster committed
    As of d41489a "Add more large blob test cases", git's high-level memory
    allocation functions (xmalloc, xmemdupz etc.) access the environment to
    simulate limited memory in tests (see 'getenv("GIT_ALLOC_LIMIT")' in
    memory_limit_check()). These functions should not be used before the
    environment is fully initialized (particularly not to initialize the
    environment itself).
    
    The current solution ('environ = NULL; ALLOC_GROW(environ...)') only works
    because MSVCRT's getenv() reinitializes environ when it is NULL (i.e. it
    leaves us with two sets of unusabe (non-UTF-8) and unfreeable (CRT-
    allocated) environments).
    
    Add our own set of malloc-or-die functions to be used in startup code.
    
    Also check the result of __wgetmainargs, which may fail if there's not
    enough memory for wide-char arguments and environment.
    
    This patch is in preparation of the sorted environment feature, which
    completely replaces MSVCRT's getenv() implementation.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  8. @kblees @gitster

    Win32: reduce environment array reallocations

    kblees authored gitster committed
    Move environment array reallocation from do_putenv to the respective
    callers. Keep track of the environment size in a global variable. Use
    ALLOC_GROW in mingw_putenv to reduce reallocations. Allocate a
    sufficiently sized environment array in make_environment_block to prevent
    reallocations.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  9. @kblees @gitster

    Win32: don't copy the environment twice when spawning child processes

    kblees authored gitster committed
    When spawning child processes via start_command(), the environment and all
    environment entries are copied twice. First by make_augmented_environ /
    copy_environ to merge with child_process.env. Then a second time by
    make_environment_block to create a sorted environment block string as
    required by CreateProcess.
    
    Move the merge logic to make_environment_block so that we only need to copy
    the environment once. This changes semantics of the env parameter: it now
    expects a delta (such as child_process.env) rather than a full environment.
    This is not a problem as the parameter is only used by start_command()
    (all other callers previously passed char **environ, and now pass NULL).
    
    The merge logic no longer xstrdup()s the environment strings, so do_putenv
    must not free them. Add a parameter to distinguish this from normal putenv.
    
    Remove the now unused make_augmented_environ / free_environ API.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  10. @kblees @gitster

    Win32: factor out environment block creation

    kblees authored gitster committed
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  11. @kblees @gitster

    Win32: unify environment function names

    kblees authored gitster committed
    Environment helper functions use random naming ('env' prefix or suffix or
    both, with or without '_'). Change to POSIX naming scheme ('env' suffix,
    no '_').
    
    Env_setenv has more in common with putenv than setenv. Change to do_putenv.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  12. @kblees @gitster

    Win32: unify environment case-sensitivity

    kblees authored gitster committed
    The environment on Windows is case-insensitive. Some environment functions
    (such as unsetenv and make_augmented_environ) have always used case-
    sensitive comparisons instead, while others (getenv, putenv, sorting in
    spawn*) were case-insensitive.
    
    Prevent potential inconsistencies by using case-insensitive comparison in
    lookup_env (used by putenv, unsetenv and make_augmented_environ).
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  13. @kblees @gitster

    Win32: fix environment memory leaks

    kblees authored gitster committed
    All functions that modify the environment have memory leaks.
    
    Disable gitunsetenv in the Makefile and use env_setenv (via mingw_putenv)
    instead (this frees removed environment entries).
    
    Move xstrdup from env_setenv to make_augmented_environ, so that
    mingw_putenv no longer copies the environment entries (according to POSIX
    [1], "the string [...] shall become part of the environment"). This also
    fixes the memory leak in gitsetenv, which expects a POSIX compliant putenv.
    
    [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/putenv.html
    
    Note: This patch depends on taking control of char **environ and having
    our own mingw_putenv (both introduced in "Win32: Unicode environment
    (incoming)").
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  14. @kblees @gitster

    Win32: Unicode environment (incoming)

    kblees authored gitster committed
    Convert environment from UTF-16 to UTF-8 on startup.
    
    No changes to getenv() are necessary, as the MSVCRT version is implemented
    on top of char **environ.
    
    However, putenv / _wputenv from MSVCRT no longer work, for two reasons:
    1. they try to keep environ, _wenviron and the Win32 process environment
    in sync, using the default system encoding instead of UTF-8 to convert
    between charsets
    2. msysgit and MSVCRT use different allocators, memory allocated in git
    cannot be freed by the CRT and vice versa
    
    Implement mingw_putenv using the env_setenv helper function from the
    environment merge code.
    
    Note that in case of memory allocation failure, putenv now dies with error
    message (due to xrealloc) instead of failing with ENOMEM. As git assumes
    setenv / putenv to always succeed, this prevents it from continuing with
    incorrect settings.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  15. @kblees @gitster

    Win32: Unicode environment (outgoing)

    kblees authored gitster committed
    Convert environment from UTF-8 to UTF-16 when creating other processes.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 17, 2014
  1. @kblees @gitster

    Revert "Windows: teach getenv to do a case-sensitive search"

    kblees authored gitster committed
    This reverts commit df599e9.
    
    As of 5e9637c "i18n: add infrastructure for translating Git with gettext",
    eval_gettext uses MinGW envsubst.exe instead of git-sh-i18n--envsubst.exe
    for variable substitution. This breaks git-submodule.sh messages and tests,
    as envsubst.exe doesn't support case-sensitive environment lookup (the same
    is true for almost everything on Windows, including MSys and Cygwin tools).
    
    30a615a "Windows/i18n: rename $path to prevent clashes with $PATH" renames
    the conflicting variable in git-submodule.sh, so that it works on Windows
    (i.e. with case-insensitive environment, regardless of the toolset).
    
    Revert to the documented behaviour of case-insensitive environment on
    Windows.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 16, 2014
  1. @kblees @gitster

    MinGW: fix compile error due to missing ELOOP

    kblees authored gitster committed
    MinGW and MSVC before 2010 don't define ELOOP, use EMLINK (aka "Too many
    links") instead.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 15, 2014
  1. @kblees @gitster

    Win32: Unicode file name support (dirent)

    kblees authored gitster committed
    Changes opendir/readdir to use Windows Unicode APIs and convert between
    UTF-8/UTF-16.
    
    Removes parameter checks that are already covered by xutftowcs_path. This
    changes detection of ENAMETOOLONG from MAX_PATH - 2 to MAX_PATH (matching
    is_dir_empty in mingw.c). If name + "/*" or the resulting absolute path is
    too long, FindFirstFile fails and errno is set through err_win_to_posix.
    
    Increases the size of dirent.d_name to accommodate the full
    WIN32_FIND_DATA.cFileName converted to UTF-8 (UTF-16 to UTF-8 conversion
    may grow by factor three in the worst case).
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @kblees @gitster

    Win32: Unicode file name support (except dirent)

    kblees authored gitster committed
    Replaces Windows "ANSI" APIs dealing with file- or path names with their
    Unicode equivalent, adding UTF-8/UTF-16LE conversion as necessary.
    
    The dirent API (opendir/readdir/closedir) is updated in a separate commit.
    
    Adds trivial wrappers for access, chmod and chdir.
    
    Adds wrapper for mktemp (needed for both mkstemp and mkdtemp).
    
    The simplest way to convert a repository with legacy-encoded (e.g. Cp1252)
    file names to UTF-8 ist to checkout with an old msysgit version and
    "git add --all & git commit" with the new version.
    
    Includes a fix for bug reported by John Chen:
    On Windows XP (not Win7), directories cannot be deleted while a find handle
    is open, causing "Deletion of directory '...' failed. Should I try again?"
    prompts.
    
    Prior to this commit, these failures were silently ignored due to
    strbuf_free in is_dir_empty resetting GetLastError to ERROR_SUCCESS.
    
    Close the find handle in is_dir_empty so that git doesn't block deletion
    of the directory even after all other applications have released it.
    
    Reported-by: John Chen <john0312@gmail.com>
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 9, 2014
  1. @gitster

    Merge branch 'sk/mingw-unicode-spawn-args'

    gitster authored
    * sk/mingw-unicode-spawn-args:
      Win32: Unicode arguments (incoming)
      Win32: Unicode arguments (outgoing)
      MinGW: disable CRT command line globbing
      Win32: fix potential multi-threading issue
      Win32: simplify internal mingw_spawn* APIs
      Win32: let mingw_execve() return an int
  2. @gitster

    Merge branch 'sk/mingw-dirent'

    gitster authored
    * sk/mingw-dirent:
      Win32 dirent: improve dirent implementation
      Win32 dirent: clarify #include directives
      Win32 dirent: change FILENAME_MAX to MAX_PATH
      Win32 dirent: remove unused dirent.d_reclen member
      Win32 dirent: remove unused dirent.d_ino member
  3. @gitster

    Merge branch 'sk/mingw-uni-console'

    gitster authored
    * sk/mingw-uni-console:
      Win32: reliably detect console pipe handles
      Win32: fix broken pipe detection
      Win32: Thread-safe windows console output
      Win32: add Unicode conversion functions
      Win32: warn if the console font doesn't support Unicode
      Win32: detect console streams more reliably
      Win32: support Unicode console output
  4. @gitster

    Merge branch 'sk/mingw-main'

    gitster authored
    * sk/mingw-main:
      mingw: avoid const warning
      Win32: move main macro to a function
Commits on Jun 25, 2014
  1. @gitster

    Merge branch 'ym/fix-opportunistic-index-update-race' into maint

    gitster authored
    "git status", even though it is a read-only operation, tries to
    update the index with refreshed lstat(2) info to optimize future
    accesses to the working tree opportunistically, but this could
    race with a "read-write" operation that modify the index while it
    is running.  Detect such a race and avoid overwriting the index.
    
    * ym/fix-opportunistic-index-update-race:
      read-cache.c: verify index file before we opportunistically update it
      wrapper.c: add xpread() similar to xread()
Commits on Jun 16, 2014
  1. @kblees @gitster

    Win32: Unicode arguments (incoming)

    kblees authored gitster committed
    Convert command line arguments from UTF-16 to UTF-8 on startup.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @kblees @gitster

    Win32: Unicode arguments (outgoing)

    kblees authored gitster committed
    Convert command line arguments from UTF-8 to UTF-16 when creating other
    processes.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @kblees @gitster

    MinGW: disable CRT command line globbing

    kblees authored gitster committed
    MingwRT listens to _CRT_glob to decide if __getmainargs should
    perform globbing, with the default being that it should.
    Unfortunately, __getmainargs globbing is sub-par; for instance
    patterns like "*.c" will only match c-sources in the current
    directory.
    
    Disable __getmainargs' command line wildcard expansion, so these
    patterns will be left untouched, and handled by Git's superior
    built-in globbing instead.
    
    MSVC defaults to no globbing, so we don't need to do anything
    in that case.
    
    This fixes t5505 and t7810.
    
    Signed-off-by: Karsten Blees <blees@dcon.de>
    Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
    Signed-off-by: Stepan Kasal <kasal@ucw.cz>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.