1. 28 Feb, 2018 1 commit
  2. 27 Feb, 2018 5 commits
  3. 25 Feb, 2018 4 commits
  4. 24 Feb, 2018 4 commits
    • checkout test: ensure workdir mode is simplified · 275693e2
      Ensure that when examining the working directory for checkout that the
      mode is correctly simplified.  Git only pays attention to whether a file
      is executable or not.  When examining a working directory, we should
      coalesce modes in the working directory to either `0755` (indicating
      that a file is executable) or `0644` (indicating that it is not).
      
      Test this by giving the file an exotic mode, and ensuring that when
      checkout out a branch that changes the file's contents, that we do not
      have a checkout conflict.
      Edward Thomson committed
    • checkout test: add core.filemode checkout tests · ec96db57
      Add two tests for filemode.
      
      The first ensures that `core.filemode=true` is honored: if we have
      changed the filemode such that a file that _was_ executable (mode 0755)
      is now executable (mode 0644) and we go to check out a branch that has
      otherwise changed the contents of the file, then we should raise a
      checkout conflict for that file.
      
      The second ensures that `core.filemode=false` is honored: in the same
      situation, we set a file that was executable to be non-executable, and
      check out the branch that changes the contents of the file.  However,
      since `core.filemode` is false, we do not detect the filemode change.
      
      We run these tests on both operating systems that obey `core.filemode`
      (eg, POSIX) and those that have no conception of filemode (eg, Win32).
      This ensures that `core.filemode` is always honored, as it is a cache of
      the underlying filesystem's settings.  This ensures that we do not
      make assumptions based on the operating system, and honor the
      configuration setting even if it were misconfigured.
      Edward Thomson committed
    • testrepo: add new branch · 18d9c847
      Add a new branch to the `testrepo` repository, where the `README` file
      has changed to executable.  This branch enables typechange tests between
      the new `executable` branch and `master`.
      Edward Thomson committed
  5. 20 Feb, 2018 11 commits
  6. 19 Feb, 2018 3 commits
    • checkout: take mode into account when comparing index to baseline · d7fea1e1
      When checking out a file, we determine whether the baseline (what we
      expect to be in the working directory) actually matches the contents
      of the working directory.  This is safe behavior to prevent us from
      overwriting changes in the working directory.
      
      We look at the index to optimize this test: if we know that the index
      matches the working directory, then we can simply look at the index
      data compared to the baseline.
      
      We have historically compared the baseline to the index entry by oid.
      However, we must also compare the mode of the two items to ensure that
      they are identical.  Otherwise, we will refuse to update the working
      directory for a mode change.
      Edward Thomson committed
    • Merge pull request #4537 from pks-t/pks/tests-filemode-uninitialized-memory · 952cf714
      tests: index::filemodes: fix use of uninitialized memory
      Edward Thomson committed
    • tests: index::filemodes: fix use of uninitialized memory · cabe16df
      The new index entry structure was not being initialized to all-zeroes.
      As that structure is used to add a new entry to the current index, and
      the hashing algorithm of the index making use of the uninitialized flags
      to calculate the state, we might miscompute the hash of the entry and
      add it at the wrong position. Later lookups would then fail.
      
      Initialize the structure with `memset` to fix the test breaking on some
      platforms.
      Patrick Steinhardt committed
  7. 18 Feb, 2018 3 commits
  8. 16 Feb, 2018 5 commits
    • util: clean up header includes · 92324d84
      While "util.h" declares the macro `git__tolower`, which simply resorts
      to tolower(3P) on Unix-like systems, the <ctype.h> header is only being
      included in "util.c". Thus, anybody who has included "util.h" without
      having <ctype.h> included will fail to compile as soon as the macro is
      in use.
      
      Furthermore, we can clean up additional includes in "util.c" and simply
      replace them with an include for "common.h".
      Patrick Steinhardt committed
    • Explicitly mark fallthrough cases with comments · 06b8a40f
      A lot of compilers nowadays generate warnings when there are cases in a
      switch statement which implicitly fall through to the next case. To
      avoid this warning, the last line in the case that is falling through
      can have a comment matching a regular expression, where one possible
      comment body would be `/* fall through */`.
      
      An alternative to the comment would be an explicit attribute like e.g.
      `[[clang::fallthrough]` or `__attribute__ ((fallthrough))`. But GCC only
      introduced support for such an attribute recently with GCC 7. Thus, and
      also because the fallthrough comment is supported by most compilers, we
      settle for using comments instead.
      
      One shortcoming of that method is that compilers are very strict about
      that. Most interestingly, that comment _really_ has to be the last line.
      In case a closing brace follows the comment, the heuristic will fail.
      Patrick Steinhardt committed
    • index: shut up warning on uninitialized variable · 7c6e9175
      Even though the `entry` variable will always be initialized when
      `read_entry` returns success and even though we never dereference
      `entry` in case `read_entry` fails, GCC prints a warning about
      uninitialized use. Just initialize the pointer to `NULL` in order to
      shut GCC up.
      Patrick Steinhardt committed
    • CMakeLists: increase strict aliasing level to 3 · 522f3e4b
      The strict aliasing rules disallow dereferencing the pointer to a
      variable of a certain type as another type, which is frequently used
      e.g. when casting structs to their base type. We currently have the
      warning level for strict aliasing rules set to `2`, which is described
      by gcc(1) as being "Aggressive, quick, not too precise." And in fact, we
      experience quite a lot of warnings when doing a release build due to
      that.
      
      GCC provides multiple levels, where higher levels are more accurate, but
      also slower due to the additional analysis required. Still, we want to
      have warning level 3 instead of 2 to avoid the current warnings we have
      in the Travis CI release builds. As this is the default warning level
      when no level is passed to `-Wstrict-aliasing`, we can just remove the
      level and use that default.
      Patrick Steinhardt committed
    • streams: openssl: fix use of uninitialized variable · 84f03b3a
      When verifying the server certificate, we do try to make sure that the
      hostname actually matches the certificate alternative names. In cases
      where the host is either an IPv4 or IPv6 address, we have to compare the
      binary representations of the hostname with the declared IP address of
      the certificate. We only do that comparison in case we were successfully
      able to parse the hostname as an IP, which would always result in the
      memory region being initialized. Still, GCC 6.4.0 was complaining about
      usage of non-initialized memory.
      
      Fix the issue by simply asserting that `addr` needs to be initialized.
      This shuts up the GCC warning.
      Patrick Steinhardt committed
  9. 15 Feb, 2018 4 commits