1. 26 Dec, 2017 1 commit
  2. 19 Nov, 2017 1 commit
  3. 18 Nov, 2017 2 commits
    • Merge pull request #4420 from pks-t/pks/strict-aliasing · a8f19f81
      refcount: make refcounting conform to aliasing rules
      Carlos Martín Nieto committed
    • refcount: make refcounting conform to aliasing rules · 585b5dac
      Strict aliasing rules dictate that for most data types, you are not
      allowed to cast them to another data type and then access the casted
      pointers. While this works just fine for most compilers, technically we
      end up in undefined behaviour when we hurt that rule.
      
      Our current refcounting code makes heavy use of casting and thus
      violates that rule. While we didn't have any problems with that code,
      Travis started spitting out a lot of warnings due to a change in their
      toolchain. In the refcounting case, the code is also easy to fix:
      as all refcounting-statements are actually macros, we can just access
      the `rc` field directly instead of casting.
      
      There are two outliers in our code where that doesn't work. Both the
      `git_diff` and `git_patch` structures have specializations for generated
      and parsed diffs/patches, which directly inherit from them. Because of
      that, the refcounting code is only part of the base structure and not of
      the children themselves. We can help that by instead passing their base
      into `GIT_REFCOUNT_INC`, though.
      Patrick Steinhardt committed
  4. 15 Nov, 2017 1 commit
  5. 13 Nov, 2017 2 commits
  6. 12 Nov, 2017 4 commits
  7. 11 Nov, 2017 12 commits
    • Merge pull request #4310 from pks-t/pks/common-parser · 1d7c15ad
      Common parser interface
      Edward Thomson committed
    • clar: verify command line arguments before execute · 32758631
      When executing `libgit2_clar -smerge -invalid_option`, it will first execute
      the merge test suite and afterwards output help because of the invalid option.
      
      With this changa, it verifies all options before execute. If there are any
      invalid options, it will output help and exit without actually executing
      the test suites.
      Yoney committed
    • Merge pull request #4403 from hkleynhans/select_bundled_zlib · 46e1dabb
      cmake: Allow user to select bundled zlib
      Edward Thomson committed
    • config_parse: use common parser interface · 9e66590b
      As the config parser is now cleanly separated from the config file code,
      we can easily refactor the code and make use of the common parser
      module. This removes quite a lot of duplicated functionality previously
      used for handling the actual parser state and replaces it with the
      generic interface provided by the parser context.
      Patrick Steinhardt committed
    • config_file: split out module to parse config files · 1953c68b
      The configuration file code grew quite big and intermingles both actual
      configuration logic as well as the parsing logic of the configuration
      syntax. This makes it hard to refactor the parsing logic on its own and
      convert it to make use of our new parsing context module.
      
      Refactor the code and split it up into two parts. The config file code
      will only handle actual handling of configuration files, includes and
      writing new files. The newly created config parser module is then only
      responsible for parsing the actual contents of a configuration file,
      leaving everything else to callbacks provided to its provided function
      `git_config_parse`.
      Patrick Steinhardt committed
    • parse: always initialize line pointer · 7bdfc0a6
      Upon initializing the parser context, we do not currently initialize the
      current line, line length and line number. Do so in order to make the
      interface easier to use and more obvious for future consumers of the
      parsing API.
      Patrick Steinhardt committed
    • parse: implement `git_parse_peek` · e72cb769
      Some code parts need to inspect the next few bytes without actually
      consuming it yet, for example to examine what content it has to expect
      next. Create a new function `git_parse_peek` which returns the next byte
      without modifying the parsing context and use it at multiple call sites.
      Patrick Steinhardt committed
    • parse: implement and use `git_parse_advance_digit` · 252f2eee
      The patch parsing code has multiple recurring patterns where we want to
      parse an actual number. Create a new function `git_parse_advance_digit`
      and use it to avoid code duplication.
      Patrick Steinhardt committed
    • patch_parse: use git_parse_contains_s · 65dcb645
      Instead of manually checking the parsing context's remaining length and
      comparing the leading bytes with a specific string, we can simply re-use
      the function `git_parse_ctx_contains_s`. Do so to avoid code duplication
      and to further decouple patch parsing from the parsing context's struct
      members.
      Patrick Steinhardt committed
    • parse: extract parse module · ef1395f3
      The `git_patch_parse_ctx` encapsulates both parser state as well as
      options specific to patch parsing. To advance this state and keep it
      consistent, we provide a few functions which handle advancing the
      current position and accessing bytes of the patch contents. In fact,
      these functions are quite generic and not related to patch-parsing by
      themselves. Seeing that we have similar logic inside of other modules,
      it becomes quite enticing to extract this functionality into its own
      parser module.
      
      To do so, we create a new module `parse` with a central struct called
      `git_parse_ctx`. It encapsulates both the content that is to be parsed
      as well as its lengths and the current position. `git_patch_parse_ctx`
      now only contains this `parse_ctx` only, which is then accessed whenever
      we need to touch the current parser. This is the first step towards
      re-using this functionality across other modules which require parsing
      functionality and remove code-duplication.
      Patrick Steinhardt committed
    • cmake: Allow user to select bundled zlib · a0b0b808
      Under some circumstances the installed / system version of zlib may not
      be desirable due to being too old or buggy.  This patch adds the option
      `USE_BUNDLED_ZLIB` that will cause the bundled version of zlib to be
      used.
      
      We may also want to add similar functionality to allow the user to
      select other bundled 3rd-party dependencies instead of using the system
      versions.
      
      /cc @pks-t @ethomson
      Henry Kleynhans committed
    • Merge pull request #4308 from pks-t/pks/header-state-machine · 0393ecc6
      patch_parse: implement state machine for parsing patch headers
      Edward Thomson committed
  8. 10 Nov, 2017 2 commits
  9. 09 Nov, 2017 1 commit
  10. 06 Nov, 2017 4 commits
  11. 04 Nov, 2017 5 commits
  12. 31 Oct, 2017 3 commits
  13. 30 Oct, 2017 2 commits