1. 14 Aug, 2017 4 commits
  2. 11 Aug, 2017 1 commit
  3. 09 Aug, 2017 3 commits
    • oid: use memcmp in git_oid__hashcmp · c9b1e646
      The open-coded version was inherited from git.git. But it
      turns out it was based on an older version of glibc, whose
      memcmp was not very optimized.
      
      Modern glibc does much better, and some compilers (like gcc
      7) can even inline the memcmp into a series of multi-byte
      xors.
      
      Upstream is switching to using memcmp in
      git/git@0b006014c87f400bd9a86267ed30fd3e7b383884.
      Jeff King committed
    • sha1_lookup: drop sha1_entry_pos function · 9842b327
      This was pulled over from git.git, and is an experiment in
      making binary-searching lists of sha1s faster. It was never
      compiled by default (nor was it used upstream by default
      without a special environment variable).
      
      Unfortunately, it is actually slower in practice, and
      upstream is planning to drop it in
      git/git@f1068efefe6dd3beaa89484db5e2db730b094e0b (which has
      some timing results). It's worth doing the same here for
      simplicity.
      Jeff King committed
    • sha1_position: convert do-while to while · 09930192
      If we enter the sha1_position() function with "lo == hi",
      we have no elements. But the do-while loop means that we'll
      enter the loop body once anyway, picking "mi" at that same
      value and comparing nonsense to our desired key. This is
      unlikely to match in practice, but we still shouldn't be
      looking at the memory in the first place.
      
      This bug is inherited from git.git; it was fixed there in
      e01580cfe01526ec2c4eb4899f776a82ade7e0e1.
      Jeff King committed
  4. 31 Jul, 2017 2 commits
  5. 30 Jul, 2017 3 commits
  6. 28 Jul, 2017 2 commits
  7. 27 Jul, 2017 1 commit
  8. 26 Jul, 2017 6 commits
  9. 25 Jul, 2017 1 commit
  10. 24 Jul, 2017 4 commits
  11. 21 Jul, 2017 1 commit
  12. 20 Jul, 2017 1 commit
  13. 19 Jul, 2017 2 commits
  14. 15 Jul, 2017 7 commits
    • config_file: refuse modifying included variables · 1b329089
      Modifying variables pulled in by an included file currently succeeds,
      but it doesn't actually do what one would expect, as refreshing the
      configuration will cause the values to reappear. As we are currently not
      really able to support this use case, we will instead just return an
      error for deleting and setting variables which were included via an
      include.
      Patrick Steinhardt committed
    • config_file: move reader into `config_read` only · 28c2cc3d
      Right now, we have multiple call sites which initialize a `reader`
      structure. As the structure is only actually used inside of
      `config_read`, we can instead just move the reader inside of the
      `config_read` function. Instead, we can just pass in the configuration
      file into `config_read`, which eases code readability.
      Patrick Steinhardt committed
    • config_file: refresh all files if includes were modified · 83bcd3a1
      Currently, we only re-parse the top-level configuration file when it has
      changed itself. This can cause problems when an include is changed, as
      we were not updating all values correctly.
      
      Instead of conditionally reparsing only refreshed files, the logic
      becomes much clearer and easier to follow if we always re-parse the
      top-level configuration file when either the file itself or one of its
      included configuration files has changed on disk. This commit implements
      this logic.
      
      Note that this might impact performance in some cases, as we need to
      re-read all configuration files whenever any of the included files
      changed. It could increase performance to just re-parse include files
      which have actually changed, but this would compromise maintainability
      of the code without much gain. The only case where we will gain anything
      is when we actually use includes and when only these includes are
      updated, which will probably be quite an unusual scenario to actually be
      worthwhile to optimize.
      Patrick Steinhardt committed
    • config_file: remove unused backend field from parse data · 56a7a264
      The backend passed to `config_read` is never actually used anymore, so
      we can remove it from the function and the `parse_data` structure.
      Patrick Steinhardt committed
    • config_file: pass reader directly to callbacks · 3a7f7a6e
      Previously, the callbacks passed to `config_parse` got the reader via a
      pointer to a pointer. This allowed the callbacks to update the callers
      `reader` variable when the array holding it has been reallocated. As the
      array is no longer present, we can simply the code by making the reader
      a simple pointer.
      Patrick Steinhardt committed
    • config_file: refactor include handling · 73df75d8
      Current code for configuration files uses the `reader` structure to
      parse configuration files and store additional metadata like the file's
      path and checksum. These structures are stored within an array in the
      backend itself, which causes multiple problems.
      
      First, it does not make sense to keep around the file's contents with
      the backend itself. While this data is usually free'd before being added
      to the backend, this brings along somewhat intricate lifecycle problems.
      A better solution would be to store only the file paths as well as the
      checksum of the currently parsed content only.
      
      The second problem is that the `reader` structures are stored inside an
      array. When re-parsing configuration files due to changed contents, we
      may cause this array to be reallocated, requiring us to update pointers
      hold by callers. Furthermore, we do not keep track of includes which
      are already associated to a reader inside of this array. This causes us
      to add readers multiple times to the backend, e.g. in the scenario of
      refreshing configurations.
      
      This commit fixes these shortcomings. We introduce a split between the
      parsing data and the configuration file's metadata. The `reader` will
      now only hold the file's contents and the parser state and the new
      `config_file` structure holds the file's path and checksum. Furthermore,
      the new structure is a recursive structure in that it will also hold
      references to the files it directly includes. The diskfile is changed to
      only store the top-level configuration file.
      
      These changes allow us further refactorings and greatly simplify
      understanding the code.
      Patrick Steinhardt committed
  15. 14 Jul, 2017 1 commit
  16. 12 Jul, 2017 1 commit