1. 03 Sep, 2023 1 commit
  2. 27 Feb, 2022 1 commit
  3. 23 Feb, 2022 2 commits
  4. 11 May, 2020 3 commits
    • assert: allow non-int returning functions to assert · cbae1c21
      Include GIT_ASSERT_WITH_RETVAL and GIT_ASSERT_ARG_WITH_RETVAL so that
      functions that do not return int (or more precisely, where `-1` would
      not be an error code) can assert.
      
      This allows functions that return, eg, NULL on an error code to do that
      by passing the return value (in this example, `NULL`) as a second
      parameter to the GIT_ASSERT_WITH_RETVAL functions.
      Edward Thomson committed
    • assert: optionally fall-back to assert(3) · a95096ba
      Fall back to the system assert(3) in debug builds, which may aide
      in debugging.
      
      "Safe" assertions can be enabled in debug builds by setting
      GIT_ASSERT_HARD=0.  Similarly, hard assertions can be enabled in
      release builds by setting GIT_ASSERT_HARD to nonzero.
      Edward Thomson committed
    • Introduce GIT_ASSERT macros · abe2efe1
      Provide macros to replace usages of `assert`.  A true `assert` is
      punishing as a library.  Instead we should do our best to not crash.
      
      GIT_ASSERT_ARG(x) will now assert that the given argument complies to
      some format and sets an error message and returns `-1` if it does not.
      
      GIT_ASSERT(x) is for internal usage, and available as an internal
      consistency check.  It will set an error message and return `-1` in the
      event of failure.
      Edward Thomson committed