1. 13 Jun, 2017 8 commits
    • tests: odb: implement `exists_prefix` for the fake backend · b2e53f36
      The fake backend currently implements all reading functions except for
      the `exists_prefix` one. Implement it to enable further testing of the
      ODB layer.
      Patrick Steinhardt committed
    • tests: odb: use correct OID length · 983e627d
      The `search_object` function takes the OID length as one of its
      parameters, where its maximum length is `GIT_OID_HEXSZ`. The `exists`
      function of the fake backend used `GIT_OID_RAWSZ` though, leading to
      only the first half of the OID being used when finding the correct
      object.
      Patrick Steinhardt committed
    • tests: odb: have the fake backend detect ambiguous prefixes · c4cbb3b1
      In order to be able to test the ODB prefix functions, we need to be able
      to detect ambiguous prefixes in case multiple objects with the same
      prefix exist in the fake ODB. Extend `search_object` to detect ambiguous
      queries and have callers return its error code instead of always
      returning `GIT_ENOTFOUND`.
      Patrick Steinhardt committed
    • tests: core: test initialization of `git_proxy_options` · 95170294
      Initialization of the `git_proxy_options` structure is never tested
      anywhere. Include it in our usual initialization test in
      "core::structinit::compare".
      Patrick Steinhardt committed
    • tests: network: add missing include for `git_repository_new` · bee423cc
      A newly added test uses the `git_repository_new` function without the
      corresponding header file being included. While this works due to the
      compiler deducing the correct function signature, we should obviously
      just include the function's declaration file.
      Patrick Steinhardt committed
    • cmake: disable optimization on debug builds · a64532e1
      While our debug builds on MSVC platforms already tune the code optimizer
      to aid debugging code, all the other platforms still use the default
      optimization level. This makes it hard for developers on these platforms
      to actually debug code while maintaining his sanity due to optimizations
      like inlined code, elided variables etc.
      
      To help this common use case, we can simply follow the MSVC example and
      turn off code optimization with "-O0" for debug builds. While it would
      be preferable to instead use "-Og" supported by more modern compilers,
      we cannot guarantee that this level is available on all supported
      platforms.
      Patrick Steinhardt committed
    • cmake: set "-D_DEBUG" on non-Windows platforms · 61399953
      In our code base, we have some occasions where we use the "_DEBUG"
      preprocessor macro to enable additional code which should not be part of
      release builds. While we define this flag on MSVC platforms, it is
      guarded by the conditional `WIN32 AND NOT CYGWIN` on other platforms
      since 19be3f9e (Improve MSVC compiler, linker flags, 2013-02-13). While
      this condition can be fulfilled by the MSVC platform, it is never
      encountered due to being part of the `ELSE` part of `IF (MSVC)`.
      
      The intention of the conditional was most likely to avoid the
      preprocessor macro on Cygwin platforms, but to include it on everthing
      else. As such, the correct condition here would be `IF (NOT CYGWIN)`
      instead. But digging a bit further, the condition is only ever used in
      two places:
      
      1. To skip the test in "core::structinit", which should also work on
         Cygwin.
      2. In "src/win32/git2.rc", where it is used to set additional file
         flags. As this file is included in MSVC builds only, it cannot cause
         any harm to set "_DEBUG" on Cygwin here.
      
      As such, we can simply drop the conditional and always set "-D_DEBUG" on
      all platforms.
      Patrick Steinhardt committed
    • cmake: remove stale comment on precompiled headers · e94be4c0
      In commit 9f75a9ce (Turning on runtime checks when building debug under
      MSVC., 2012-03-30), we introduced a comment "Precompiled headers", which
      actually refers to no related commands. Seeing that the comment never
      had anything to refer to, we can simply remove it here.
      Patrick Steinhardt committed
  2. 12 Jun, 2017 15 commits
  3. 11 Jun, 2017 6 commits
  4. 10 Jun, 2017 4 commits
    • git_futils_rmdir: only allow `EBUSY` when asked · 4a0df574
      Only ignore `EBUSY` from `rmdir` when the `GIT_RMDIR_SKIP_NONEMPTY` bit
      is set.
      Edward Thomson committed
    • checkout: cope with untracked files in directory deletion · 83989d70
      When deleting a directory during checkout, do not simply delete the
      directory, since there may be untracked files.  Instead, go into
      the iterator and examine each file.
      
      In the original code (the code with the faulty assumption), we look to
      see if there's an index entry beneath the directory that we want to
      remove.   Eg, it looks to see if we have a workdir entry foo and an
      index entry foo/bar.txt. If this is not the case, then the working
      directory must have precious files in that directory. This part is okay.
      The part that's not okay is if there is an index entry foo/bar.txt. It
      just blows away the whole damned directory.
      
      That's not cool.
      
      Instead, by simply pushing the directory itself onto the stack and
      iterating each entry, we will deal with the files one by one - whether
      they're in the index (and can be force removed) or not (and are
      precious).
      
      The original code was a bad optimization, assuming that we didn't need
      to git_iterator_advance_into if there was any index entry in the folder.
      That's wrong - we could have optimized this iff all folder entries are
      in the index.
      
      Instead, we need to simply dig into the directory and analyze its
      entries.
      Edward Thomson committed
    • checkout: do not delete directories with untracked entries · 0ef405b3
      If the `GIT_CHECKOUT_FORCE` flag is given to any of the `git_checkout`
      invocations, we remove files which were previously staged. But while
      doing so, we unfortunately also remove unstaged files in a directory
      which contains at least one staged file, resulting in potential data
      loss.
      
      This commit adds two tests to verify behavior.
      Patrick Steinhardt committed
    • smart_protocol: fix parsing of server ACK responses · e141f079
      Fix ACK parsing in wait_while_ack() internal function. This patch
      handles the case where multi_ack_detailed mode sends 'ready' ACKs. The
      existing functionality would bail out too early, thus causing the
      processing of the ensuing packfile to fail if/when 'ready' ACKs were
      sent.
      Roger Gee committed
  5. 09 Jun, 2017 1 commit
  6. 08 Jun, 2017 6 commits