1. 11 Nov, 2021 1 commit
  2. 09 Nov, 2021 1 commit
  3. 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
  4. 30 Jul, 2021 2 commits
  5. 18 Jun, 2021 1 commit
  6. 25 Oct, 2020 1 commit
  7. 20 Jul, 2019 1 commit
  8. 22 Feb, 2019 1 commit
  9. 14 Feb, 2019 3 commits
    • branch: fix `branch_is_checked_out` with bare repos · bf013fc0
      In a bare repository, HEAD usually points to the branch that is
      considered the "default" branch. As the current implementation for
      `git_branch_is_checked_out` only does a comparison of HEAD with the
      branch that is to be checked, it will say that the branch pointed to by
      HEAD in such a bare repo is checked out.
      
      Fix this by skipping the main repo's HEAD when it is bare.
      Patrick Steinhardt committed
    • branches: do not assert that the given ref is a branch · 788cd2d5
      Libraries should use assert(3P) only very scarcely. First, we usually
      shouldn't cause the caller of our library to abort in case where the
      assert fails. Second, if code is compiled with -DNDEBUG, then the assert
      will not be included at all.
      
      In our `git_branch_is_checked_out` function, we have an assert that
      verifies that the given reference parameter is non-NULL and in fact a
      branch. While the first check is fine, the second is not. E.g. when
      compiled with -DNDEBUG, we'd proceed and treat the given reference as a
      branch in all cases.
      
      Fix the issue by instead treating a non-branch reference as not being
      checked out. This is the obvious solution, as references other than
      branches cannot be directly checked out.
      Patrick Steinhardt committed
    • branches: add tests for `git_branch_is_checked_out` · a0f87e16
      We currently do not have any tests at all for the
      `git_branch_is_checked_out` function. Add some basic ones.
      Patrick Steinhardt committed
  10. 22 Jan, 2019 1 commit
  11. 17 Jan, 2019 1 commit
  12. 01 Dec, 2018 1 commit
  13. 13 Oct, 2018 1 commit
  14. 10 Jun, 2018 1 commit
  15. 14 Nov, 2017 1 commit
  16. 29 Dec, 2016 1 commit
  17. 04 Nov, 2016 1 commit
    • branch: fix forced branch creation on HEAD of a bare repo · f9793884
      The code correctly detects that forced creation of a branch on a
      nonbare repo should not be able to overwrite a branch which is
      the HEAD reference.  But there's no reason to prevent this on
      a bare repo, and in fact, git allows this.  I.e.,
      
         git branch -f master new_sha
      
      works on a bare repo with HEAD set to master.  This change fixes
      that problem, and updates tests so that, for this case, both the
      bare and nonbare cases are checked for correct behavior.
      John Fultz committed
  18. 12 Jul, 2015 1 commit
  19. 22 May, 2015 1 commit
    • branch: error out if we cannot find the remote · 5014fe95
      When we look for which remote corresponds to a remote-tracking branch,
      we look in the refspecs to see which ones matches. If none do, we should
      abort. We currently ignore the error message from this operation, so
      let's not do that anymore.
      
      As part of the test we're writing, let's test for the expected behaviour
      if we cannot find a refspec which tells us what the remote-tracking
      branch for a remote would look like.
      Carlos Martín Nieto committed
  20. 13 May, 2015 1 commit
    • remote: remove live changing of refspecs · 77254990
      The base refspecs changing can be a cause of confusion as to what is the
      current base refspec set and complicate saving the remote's
      configuration.
      
      Change `git_remote_add_{fetch,push}()` to update the configuration
      instead of an instance.
      
      This finally makes `git_remote_save()` a no-op, it will be removed in a
      later commit.
      Carlos Martín Nieto committed
  21. 16 Mar, 2015 1 commit
  22. 08 Mar, 2015 1 commit
  23. 04 Mar, 2015 2 commits
  24. 03 Mar, 2015 4 commits
  25. 03 Feb, 2015 1 commit
  26. 17 Nov, 2014 1 commit
  27. 08 Nov, 2014 1 commit
  28. 30 May, 2014 2 commits
  29. 08 May, 2014 2 commits
    • Don't always test composed-insensitive lookups · 8a2ef218
      Only on a filesystem that is composed/decomposed insensitive,
      should be testing that a branch can be looked up by the opposite
      form and still work correctly.
      Russell Belfer committed
    • Pass unconverted data when iconv doesn't like it · 43a04135
      When using Iconv to convert unicode data and iconv doesn't like
      the source data (because it thinks that it's not actual UTF-8),
      instead of stopping the operation, just use the unconverted data.
      This will generally do the right thing on the filesystem, since
      that is the source of the non-UTF-8 path data anyhow.
      
      This adds some tests for creating and looking up branches with
      messy Unicode names.  Also, this takes the helper function that
      was previously internal to `git_repository_init` and makes it
      into `git_path_does_fs_decompose_unicode` which is a useful in
      tests to understand what the expected results should be.
      Russell Belfer committed
  30. 02 May, 2014 1 commit
  31. 16 Apr, 2014 1 commit