1. 12 Jun, 2017 7 commits
    • tests: odb: add tests with multiple backends · f148258a
      Previous to pulling out and extending the fake backend, it was quite
      cumbersome to write tests for very specific scenarios regarding
      backends. But as we have made it more generic, it has become much easier
      to do so. As such, this commit adds multiple tests for scenarios with
      multiple backends for the ODB.
      
      The changes also include a test for a very targeted scenario. When one
      backend found a matching object via `read_prefix`, but the last backend
      returns `GIT_ENOTFOUND` and when object hash verification is turned off,
      we fail to reset the error code to `GIT_OK`. This causes us to segfault
      later on, when doing a double-free on the returned object.
      Patrick Steinhardt committed
    • tests: odb: allow passing fake objects to the fake backend · 6e010bb1
      Right now, the fake backend is quite restrained in the way how it
      works: we pass it an OID which it is to return later as well as an error
      code we want it to return. While this is sufficient for existing tests,
      we can make the fake backend a little bit more generic in order to allow
      us testing for additional scenarios.
      
      To do so, we change the backend to not accept an error code and OID
      which it is to return for queries, but instead a simple array of OIDs
      with their respective blob contents. On each query, the fake backend
      simply iterates through this array and returns the first matching
      object.
      Patrick Steinhardt committed
    • tests: do not reuse OID from backend · 369cb45f
      In order to make the fake backend more useful, we want to enable it
      holding multiple object references. To do so, we need to decouple it
      from the single fake OID it currently holds, which we simply move up
      into the calling tests.
      Patrick Steinhardt committed
    • tests: odb: move fake backend into its own file · 2add34d0
      The fake backend used by the test suite `odb::backend::nonrefreshing` is
      useful to have some low-level tests for the ODB layer. As such, we move
      the implementation into its own `backend_helpers` module.
      Patrick Steinhardt committed
    • Merge pull request #4261 from RogerGee/fix_wait_while_ack · 9927e958
      smart_protocol: fix parsing of server ACK responses
      Edward Thomson committed
    • Merge pull request #4264 from libgit2/ethomson/read_prefix · 2ade8fb0
      odb_read_prefix: reset error in backends loop
      Patrick Steinhardt committed
    • odb_read_prefix: reset error in backends loop · cb3010c5
      When looking for an object by prefix, we query all the backends so that
      we can ensure that there is no ambiguity.  We need to reset the `error`
      value between backends; otherwise the first backend may find an object
      by prefix, but subsequent backends may not.  If we do not reset the
      `error` value then it will remain at `GIT_ENOTFOUND` and `read_prefix_1`
      will fail, despite having actually found an object.
      Edward Thomson committed
  2. 11 Jun, 2017 6 commits
  3. 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
  4. 09 Jun, 2017 1 commit
  5. 08 Jun, 2017 15 commits
  6. 07 Jun, 2017 7 commits