1. 14 Nov, 2021 1 commit
    • Fix a gcc 11 warning in src/threadstate.c · 0c4d24da
      When building under gcc 11, there is a warning about a misaligned guard clause
      because there were mixed spaces and tabs:
      
      ```
      [128/634] Building C object src/CMakeFiles/git2internal.dir/threadstate.c.o
      ../src/threadstate.c: In function ‘threadstate_dispose’:
      ../src/threadstate.c:39:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
         39 |     if (threadstate->error_t.message != git_str__initstr)
            |     ^~
      ../src/threadstate.c:41:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
         41 |         threadstate->error_t.message = NULL;
            |         ^~~~~~~~~~~
      ../src/threadstate.c: At top level:
      ```
      
      This change indents the code with tabs for consistency with the rest of the
      code, which makes the warning go away.
      lhchavez committed
  2. 17 Oct, 2021 1 commit
    • str: introduce `git_str` for internal, `git_buf` is external · f0e693b1
      libgit2 has two distinct requirements that were previously solved by
      `git_buf`.  We require:
      
      1. A general purpose string class that provides a number of utility APIs
         for manipulating data (eg, concatenating, truncating, etc).
      2. A structure that we can use to return strings to callers that they
         can take ownership of.
      
      By using a single class (`git_buf`) for both of these purposes, we have
      confused the API to the point that refactorings are difficult and
      reasoning about correctness is also difficult.
      
      Move the utility class `git_buf` to be called `git_str`: this represents
      its general purpose, as an internal string buffer class.  The name also
      is an homage to Junio Hamano ("gitstr").
      
      The public API remains `git_buf`, and has a much smaller footprint.  It
      is generally only used as an "out" param with strict requirements that
      follow the documentation.  (Exceptions exist for some legacy APIs to
      avoid breaking callers unnecessarily.)
      
      Utility functions exist to convert a user-specified `git_buf` to a
      `git_str` so that we can call internal functions, then converting it
      back again.
      Edward Thomson committed
  3. 03 Sep, 2021 1 commit
  4. 08 Dec, 2020 1 commit
  5. 14 Oct, 2020 1 commit
  6. 11 Oct, 2020 2 commits
    • runtime: move init/shutdown into the "runtime" · e316b0d3
      Provide a mechanism for system components to register for initialization
      and shutdown of the libgit2 runtime.
      Edward Thomson committed
    • global: separate global state from thread-local state · 4853d94c
      Our "global initialization" has accumulated some debris over the years.
      It was previously responsible for both running the various global
      initializers (that set up various subsystems) _and_ setting up the
      "global state", which is actually the thread-local state for things
      like error reporting.
      
      Separate the thread local state out into "threadstate".  Use the normal
      subsystem initialization functions that we already have to set it up.
      This makes both the global initialization system and the threadstate
      system simpler to reason about.
      Edward Thomson committed