1. 27 Jul, 2018 1 commit
  2. 18 Jul, 2018 1 commit
    • tree: accept null ids in existing trees when updating · 2dff7e28
      When we add entries to a treebuilder we validate them. But we validate even
      those that we're adding because they exist in the base tree. This disables
      using the normal mechanisms on these trees, even to fix them.
      
      Keep track of whether the entry we're appending comes from an existing tree and
      bypass the name and id validation if it's from existing data.
      Carlos Martín Nieto committed
  3. 22 Jun, 2018 1 commit
    • tree: implement function to parse raw data · 73bd6411
      Currently, parsing objects is strictly tied to having an ODB object
      available. This makes it hard to parse an object when all that is
      available is its raw object and size. Furthermore, hacking around that
      limitation by directly creating an ODB structure either on stack or on
      heap does not really work that well due to ODB objects being reference
      counted and then automatically free'd when reaching a reference count of
      zero.
      
      Implement a function `git_tree__parse_raw` to parse a tree object from a
      pair of `data` and `size`.
      Patrick Steinhardt committed
  4. 15 Jun, 2018 2 commits
  5. 10 Jun, 2018 1 commit
  6. 23 May, 2018 1 commit
  7. 16 Feb, 2018 1 commit
    • 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
  8. 26 Jan, 2018 1 commit
    • tree: reject writing null-OID entries to a tree · c0487bde
      In commit a96d3cc3f (cache-tree: reject entries with null sha1,
      2017-04-21), the git.git project has changed its stance on null OIDs in
      tree objects. Previously, null OIDs were accepted in tree entries to
      help tools repair broken history. This resulted in some problems though
      in that many code paths mistakenly passed null OIDs to be added to a
      tree, which was not properly detected.
      
      Align our own code base according to the upstream change and reject
      writing tree entries early when the OID is all-zero.
      Patrick Steinhardt committed
  9. 31 Dec, 2017 1 commit
  10. 03 Jul, 2017 1 commit
    • Make sure to always include "common.h" first · 0c7f49dd
      Next to including several files, our "common.h" header also declares
      various macros which are then used throughout the project. As such, we
      have to make sure to always include this file first in all
      implementation files. Otherwise, we might encounter problems or even
      silent behavioural differences due to macros or defines not being
      defined as they should be. So in fact, our header and implementation
      files should make sure to always include "common.h" first.
      
      This commit does so by establishing a common include pattern. Header
      files inside of "src" will now always include "common.h" as its first
      other file, separated by a newline from all the other includes to make
      it stand out as special. There are two cases for the implementation
      files. If they do have a matching header file, they will always include
      this one first, leading to "common.h" being transitively included as
      first file. If they do not have a matching header file, they instead
      include "common.h" as first file themselves.
      
      This fixes the outlined problems and will become our standard practice
      for header and source files inside of the "src/" from now on.
      Patrick Steinhardt committed
  11. 28 Mar, 2017 3 commits
  12. 17 Feb, 2017 2 commits
  13. 29 Dec, 2016 1 commit
  14. 12 Dec, 2016 1 commit
    • write_tree: use shared buffer for writing trees · 87aaefe2
      The function to write trees allocates a new buffer for each tree.
      This causes problems with performance when performing a lot
      of actions involving writing trees, e.g. when doing many merges.
      Fix the issue by instead handing in a shared buffer, which is then
      re-used across the calls without having to re-allocate between
      calls.
      Michael Tesch committed
  15. 14 Nov, 2016 3 commits
  16. 07 Oct, 2016 1 commit
  17. 24 May, 2016 1 commit
  18. 19 May, 2016 2 commits
  19. 18 May, 2016 1 commit
  20. 17 May, 2016 1 commit
    • Introduce a function to create a tree based on a different one · 9464f9eb
      Instead of going through the usual steps of reading a tree recursively
      into an index, modifying it and writing it back out as a tree, introduce
      a function to perform simple updates more efficiently.
      
      `git_tree_create_updated` avoids reading trees which are not modified
      and supports upsert and delete operations. It is not as versatile as
      modifying the index, but it makes some common operations much more
      efficient.
      Carlos Martín Nieto committed
  21. 31 Mar, 2016 1 commit
  22. 22 Mar, 2016 1 commit
  23. 20 Mar, 2016 2 commits
  24. 04 Mar, 2016 1 commit
  25. 28 Feb, 2016 1 commit
  26. 16 Feb, 2016 1 commit
  27. 06 Dec, 2015 1 commit
  28. 02 Dec, 2015 1 commit
  29. 01 Dec, 2015 1 commit
    • tree: mark cloned tree entries as un-pooled · 9487585d
      When duplicating a `struct git_tree_entry` with
      `git_tree_entry_dup` the resulting structure is not allocated
      inside a memory pool. As we do a 1:1 copy of the original struct,
      though, we also copy the `pooled` field, which is set to `true`
      for pooled entries. This results in a huge memory leak as we
      never free tree entries that were duplicated from a pooled
      tree entry.
      
      Fix this by marking the newly duplicated entry as un-pooled.
      Patrick Steinhardt committed
  30. 30 Nov, 2015 1 commit
  31. 28 Nov, 2015 2 commits