1. 01 Jun, 2018 6 commits
  2. 17 Mar, 2017 1 commit
    • submodule: resolve URLs relative to main worktree · b0c9bc92
      It is possible to specify submodule URLs relative to the repository
      location. E.g. having a submodule with URL "../submodule" will look for
      the submodule at "repo/../submodule".
      
      With the introduction of worktrees, though, we cannot simply resolve the
      URL relative to the repository location itself. If the repository for
      which a URL is to be resolved is a working tree, we have to resolve the
      URL relative to the parent's repository path. Otherwise, the URL would
      change depending on where the working tree is located.
      
      Fix this by special-casing when we have a working tree while getting the
      URL base.
      Patrick Steinhardt committed
  3. 14 Mar, 2017 1 commit
    • submodule: catch when submodule is not staged on update · 32ecc98e
      When calling `git_submodule_update` on a submodule, we have to retrieve
      the ID of the submodule entry in the index. If the function is called on
      a submodule which is only partly initialized, the submodule entry may
      not be added to the index yet. This leads to an assert when trying to
      look up the blob later on.
      
      Fix the issue by checking if the index actually holds the submodule's
      ID and erroring out if it does not.
      Patrick Steinhardt committed
  4. 17 Feb, 2017 3 commits
  5. 13 Feb, 2017 1 commit
    • repository: use `git_repository_item_path` · c5f3da96
      The recent introduction of the commondir variable of a repository
      requires callers to distinguish whether their files are part of
      the dot-git directory or the common directory shared between
      multpile worktrees. In order to take the burden from callers and
      unify knowledge on which files reside where, the
      `git_repository_item_path` function has been introduced which
      encapsulate this knowledge.
      
      Modify most existing callers of `git_repository_path` to use
      `git_repository_item_path` instead, thus making them implicitly
      aware of the common directory.
      Patrick Steinhardt committed
  6. 27 Jan, 2017 1 commit
    • Fix uninitialized variable warning · d0c418c0
      Fix the following warning emitted by clang:
      [ 16%] Building C object CMakeFiles/libgit2_clar.dir/src/submodule.c.o
      /Users/mplough/devel/external/libgit2/src/submodule.c:408:6: warning: variable 'i' is used uninitialized whenever 'if' condition is true
            [-Wsometimes-uninitialized]
              if ((error = load_submodule_names(names, cfg)))
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /Users/mplough/devel/external/libgit2/src/submodule.c:448:20: note: uninitialized use occurs here
              git_iterator_free(i);
                                ^
      /Users/mplough/devel/external/libgit2/src/submodule.c:408:2: note: remove the 'if' if its condition is always false
              if ((error = load_submodule_names(names, cfg)))
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /Users/mplough/devel/external/libgit2/src/submodule.c:404:17: note: initialize the variable 'i' to silence this warning
              git_iterator *i;
                             ^
                              = NULL
      1 warning generated.
      Matthew Plough committed
  7. 23 Jan, 2017 3 commits
  8. 20 Jan, 2017 3 commits
    • Skip submodule head/index update when caching. · 673dff88
      `git_submodule_status` is very slow, bottlenecked on
      `git_repository_head_tree`, which it uses through `submodule_update_head`.  If
      the user has requested submodule caching, assume that they want this status
      cached too and skip it.
      
      Signed-off-by: David Turner <dturner@twosigma.com>
      Brock Peabody committed
    • 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
    • Fix formatting · ca05857e
      Signed-off-by: David Turner <dturner@twosigma.com>
      David Turner committed
  9. 29 Dec, 2016 1 commit
  10. 09 Oct, 2016 2 commits
  11. 28 Jun, 2016 1 commit
  12. 20 Mar, 2016 1 commit
  13. 11 Mar, 2016 1 commit
    • submodule: avoid passing NULL pointers to strncmp · 486302d6
      In C89 it is undefined behavior to pass `NULL` pointers to
      `strncmp` and later on in C99 it has been explicitly stated that
      functions with an argument declared as `size_t nmemb` specifying
      the array length shall always have valid parameters, no matter if
      `nmemb` is 0 or not (see ISO 9899 §7.21.1.2).
      
      The function `str_equal_no_trailing_slash` always passes its
      parameters to `strncmp` if their lengths match. This means if one
      parameter is `NULL` and the other one either `NULL` or a string
      with length 0 we will pass the pointers to `strncmp` and cause
      undefined behavior.
      
      Fix this by explicitly handling the case when both lengths are 0.
      Patrick Steinhardt committed
  14. 16 Feb, 2016 1 commit
  15. 11 Feb, 2016 1 commit
  16. 08 Dec, 2015 1 commit
  17. 04 Nov, 2015 1 commit
  18. 27 Sep, 2015 1 commit
  19. 24 Sep, 2015 1 commit
  20. 10 Sep, 2015 1 commit
  21. 28 Aug, 2015 1 commit
  22. 13 Jul, 2015 2 commits
  23. 11 Jul, 2015 1 commit
  24. 01 Jul, 2015 1 commit
    • submodule: correctly delimit the keys to use for lookup · e0af3cb3
      The regex we use to look at the gitmodules file does not correctly
      delimit the name of submodule which we want to look up and puts '.*'
      straight after the name, maching on any submodule which has the seeked
      submodule as a prefix of its name.
      
      Add the missing '\.' in the regex so we want a full stop to exist both
      before and after the submodule name.
      Carlos Martín Nieto committed
  25. 29 Jun, 2015 3 commits