1. 10 Apr, 2023 1 commit
  2. 23 Feb, 2022 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. 15 Jun, 2021 1 commit
  5. 03 Jun, 2021 1 commit
  6. 20 Jul, 2019 1 commit
  7. 10 Jun, 2018 1 commit
  8. 06 Jun, 2018 1 commit
    • tests: submodule: do not rely on config iteration order · 8178c70f
      The test submodule::lookup::duplicated_path, which tries to verify that
      we detect submodules with duplicated paths, currently relies on the
      gitmodules file of "submod2_target". While this file has two gitmodules
      with the same path, one of these gitmodules has an empty name and thus
      does not pass `git_submodule_name_is_valid`. Because of this, the test
      is in fact dependent on the iteration order in which we process the
      submodules. In fact the "valid" submodule comes first, the "invalid"
      submodule will cause the desired error. In fact the "invalid" submodule
      comes first, it will be skipped due to its name being invalid, and we
      will not see the desired error. While this works on the master branch
      just right due to the refactoring of our config code, where iteration
      order is now deterministic, this breaks on all older maintenance
      branches.
      
      Fix the issue by simply using `cl_git_rewritefile` to rewrite the
      gitmodules file. This greatly simplifies the test and also makes the
      intentions of it much clearer.
      Patrick Steinhardt committed
  9. 30 May, 2018 1 commit
    • submodule: detect duplicated submodule paths · b2a389c8
      When loading submodule names, we build a map of submodule paths and
      their respective names. While looping over the configuration keys,
      we do not check though whether a submodule path was seen already. This
      leads to a memory leak in case we have multiple submodules with the same
      path, as we just overwrite the old value in the map in that case.
      
      Fix the error by verifying that the path to be added is not yet part of
      the string map. Git does not allow to have multiple submodules for a
      path anyway, so we now do the same and detect this duplication,
      reporting it to the user.
      Patrick Steinhardt committed
  10. 27 Mar, 2018 1 commit
  11. 25 Aug, 2017 3 commits
  12. 20 Jan, 2017 1 commit
    • Allow for caching of submodules. · 4d99c4cf
      Added `git_repository_submodule_cache_all` to initialze a cache of
      submodules on the repository so that operations looking up N
      submodules are O(N) and not O(N^2).  Added a
      `git_repository_submodule_cache_clear` function to remove the cache.
      
      Also optimized the function that loads all submodules as it was itself
      O(N^2) w.r.t the number of submodules, having to loop through the
      `.gitmodules` file once per submodule.  I changed it to process the
      `.gitmodules` file once, into a map.
      
      Signed-off-by: David Turner <dturner@twosigma.com>
      Brock Peabody committed
  13. 21 Dec, 2015 1 commit
  14. 18 Sep, 2015 1 commit
  15. 10 Sep, 2015 1 commit
  16. 13 Jul, 2015 1 commit
  17. 11 Jul, 2015 1 commit
  18. 01 Jul, 2015 1 commit
  19. 29 Jun, 2015 1 commit
  20. 03 Mar, 2015 1 commit
    • Remove the signature from ref-modifying functions · 659cf202
      The signature for the reflog is not something which changes
      dynamically. Almost all uses will be NULL, since we want for the
      repository's default identity to be used, making it noise.
      
      In order to allow for changing the identity, we instead provide
      git_repository_set_ident() and git_repository_ident() which allow a user
      to override the choice of signature.
      Carlos Martín Nieto committed
  21. 22 Dec, 2014 1 commit
    • Introduce a convenience function for submodule update · 9d1f97df
      This introduces the functionality of submodule update in
      'git_submodule_do_update'. The existing 'git_submodule_update' function is
      renamed to 'git_submodule_update_strategy'. The 'git_submodule_update'
      function now refers to functionality similar to `git submodule update`,
      while `git_submodule_update_strategy` is used to get the configured value
      of submodule.<name>.update.
      Jameson Miller committed
  22. 01 Apr, 2014 2 commits
    • More tests and fix submodule index refresh · 8f4e5275
      There was a little bug where the submodule cache thought that the
      index date was out of date even when it wasn't that was resulting
      in some extra scans of index data even when not needed.
      
      Mostly this commit adds a bunch of new tests including adding and
      removing submodules in the index and in the HEAD and seeing if we
      can automatically pick them up when refreshing.
      Russell Belfer committed
    • Remove most submodule reloads from tests · 8061d519
      With the new submodule cache validity checks, we generally don't
      need to call git_submodule_reload_all to have up-to-date submodule
      data.  Some tests are still calling it where I want to actually
      test that it can be called safely and doesn't break anything, but
      mostly it is not needed.
      
      This also expands some of the existing submodule tests to cover
      some variants on the behavior that was already being tested.
      Russell Belfer committed
  23. 26 Mar, 2014 1 commit
    • Fix error when submodule path and name differ · 380f864a
      When a submodule was inserted with a different path and name, the
      return value from khash greater than zero was allowed to propagate
      back out to the caller when it should really be zeroed.  This led
      to a possible crash when reloading submodules if that was the
      first time that submodule data was loaded.
      Russell Belfer committed
  24. 25 Mar, 2014 1 commit
    • Make submodules externally refcounted · a15c7802
      `git_submodule` objects were already refcounted internally in case
      the submodule name was different from the path at which it was
      stored.  This makes that refcounting externally used as well, so
      `git_submodule_lookup` and `git_submodule_add_setup` return an
      object that requires a `git_submodule_free` when done.
      Russell Belfer committed
  25. 15 Jan, 2014 1 commit
  26. 14 Nov, 2013 1 commit
  27. 08 Oct, 2013 1 commit
    • More filemode cleanups for FAT on MacOS · 14997dc5
      This cleans up some additional issues.  The main change is that
      on a filesystem that doesn't support mode bits, libgit2 will now
      create new blobs with GIT_FILEMODE_BLOB always instead of being
      at the mercy to the filesystem driver to report executable or not.
      This means that if "core.filemode" lies and claims that filemode
      is not supported, then we will ignore the executable bit from the
      filesystem.  Previously we would have allowed it.
      
      This adds an option to the new git_repository_reset_filesystem to
      recurse through submodules if desired.  There may be other types
      of APIs that would like a "recurse submodules" option, but this
      one is particularly useful.
      
      This also has a number of cleanups, etc., for related things
      including trying to give better error messages when problems come
      up from the filesystem.  For example, the FAT filesystem driver on
      MacOS appears to return errno EINVAL if you attempt to write a
      filename with invalid UTF-8 in it.  We try to capture that with a
      better error message now.
      Russell Belfer committed
  28. 17 Sep, 2013 1 commit
    • No such thing as an orphan branch · 605da51a
      Unfortunately git-core uses the term "unborn branch" and "orphan
      branch" interchangeably. However, "orphan" is only really there for
      the checkout command, which has the `--orphan` option so it doesn't
      actually create the branch.
      
      Branches never have parents, so the distinction of a branch with no
      parents is odd to begin with. Crucially, the error messages deal with
      unborn branches, so let's use that.
      Carlos Martín Nieto committed
  29. 28 Jun, 2013 1 commit
  30. 19 Mar, 2013 1 commit
    • Three submodule status bug fixes · 65025cb8
      1. Fix sort order problem with submodules where "mod" was sorting
         after "mod-plus" because they were being sorted as "mod/" and
         "mod-plus/".  This involved pushing the "contains a .git entry"
         test significantly lower in the stack.
      2. Reinstate behavior that a directory which contains a .git entry
         will be treated as a submodule during iteration even if it is
         not yet added to the .gitmodules.
      3. Now that any directory containing .git is reported as submodule,
         we have to be more careful checking for GIT_EEXISTS when we
         do a submodule lookup, because that is the error code that is
         returned by git_submodule_lookup when you try to look up a
         directory containing .git that has no record in gitmodules or
         the index.
      Russell Belfer committed
  31. 27 Nov, 2012 1 commit
  32. 05 Sep, 2012 1 commit
  33. 24 Aug, 2012 1 commit