1. 30 Dec, 2020 1 commit
  2. 04 Oct, 2020 1 commit
    • p_chmod: Android compatibility · e8ab3db9
      Fix #5565
      
      Pre-Android 5 did not implement a virtual filesystem atop FAT partitions for Unix permissions, which causes chmod to fail. However, Unix permissions have no effect on Android anyway as file permissions are not actually managed this way, so treating it as a no-op across all Android is safe.
      kevinlul committed
  3. 20 Feb, 2020 1 commit
  4. 01 Aug, 2019 1 commit
  5. 19 May, 2019 1 commit
  6. 01 Feb, 2018 1 commit
  7. 12 Sep, 2017 1 commit
    • features.h: allow building without CMake-generated feature header · 26f531d3
      In commit a390a846 (cmake: move defines into "features.h" header,
      2017-07-01), we have introduced a new "features.h" header. This file is
      being generated by the CMake build system based on how the libgit2 build
      has been configured, replacing the preexisting method of simply setting
      the defines inside of the CMake build system. This was done to help
      splitting up the build instructions into multiple separate
      subdirectories.
      
      An overlooked shortcoming of this approach is that some projects making
      use of libgit2 build the library with custom build systems, without
      making use of CMake. For those users, the introduction of the
      "features.h" file makes their life harder as they would have to also
      generate this file.
      
      Fix this issue by guarding all inclusions of the generated header file
      by the `LIBGIT2_NO_FEATURES_H` define. Like this, other build systems
      can skip the feature header and simply define all used features by
      specifying `-D` flags for the compiler again.
      Patrick Steinhardt committed
  8. 16 Aug, 2017 2 commits
    • cmake: move regcomp and futimens checks to "features.h" · 8341d6cf
      In our CMakeLists.txt, we have to check multiple functions in order to
      determine if we have to use our own or whether we can use the
      platform-provided one. For two of these functions, namely `regcomp_l()`
      and `futimens`, the defined macro is actually used inside of the header
      file "src/unix/posix.h". As such, these macros are not only required by
      the library, but also by our test suite, which is makes use of internal
      headers.
      
      To prepare for the CMakeLists.txt split, move these two defines inside
      of the "features.h" header.
      Patrick Steinhardt committed
    • cmake: move defines into "features.h" header · a390a846
      In a future commit, we will split out the build instructions for our
      library directory and move them into a subdirectory. One of the benefits
      is fixing scoping issues, where e.g. defines do not leak to build
      targets where they do not belong to. But unfortunately, this does also
      pose the problem of how to propagate some defines which are required by
      both the library and the test suite.
      
      One way would be to create another variable keeping track of all added
      defines and declare it inside of the parent scope. While this is the
      most obvious and simplest way of going ahead, it is kind of unfortunate.
      The main reason to not use this is that these defines become implicit
      dependencies between the build targets. By simply observing a define
      inside of the CMakeLists.txt file, one cannot reason whether this define
      is only required by the current target or whether it is required by
      different targets, as well.
      
      Another approach would be to use an internal header file keeping track
      of all defines shared between targets. While configuring the library, we
      will set various variables and let CMake configure the file, adding or
      removing defines based on what has been configured. Like this, one can
      easily keep track of the current environment by simply inspecting the
      header file. Furthermore, these dependencies are becoming clear inside
      the CMakeLists.txt, as instead of simply adding a define, we now call
      e.g. `SET(GIT_THREADSAFE 1)`.
      
      Having this header file though requires us to make sure it is always
      included before any "#ifdef"-preprocessor checks are executed. As we
      have already refactored code to always include the "common.h" header
      file before any statement inside of a file, this becomes easy: just make
      sure "common.h" includes the new "features.h" header file first.
      Patrick Steinhardt committed
  9. 28 Feb, 2017 1 commit
    • odb_loose: fsync tests · e6ed0d2f
      Introduce a simple counter that `p_fsync` implements.  This is useful
      for ensuring that `p_fsync` is called when we expect it to be, for
      example when we have enabled an odb backend to perform `fsync`s when
      writing objects.
      Edward Thomson committed
  10. 17 Feb, 2017 1 commit
    • p_snprintf: no need for arguments to a format · cc172642
      `snprintf` requires a _format_ but does not require _arguments_ to the
      format.  eg: `snprintf(buf, 42, "hi")` is perfectly legal.  Expand the
      macro to match.
      
      Without this, `p_sprintf(buf, 42, "hi")` errors with:
      
      ```
      error: expected expression
                      p_snprintf(msg, 42, "hi");
                      ^
      src/unix/posix.h:53:34: note: expanded from macro 'p_snprintf'
                                       ^
      /usr/include/secure/_stdio.h:57:73: note: expanded from macro 'snprintf'
        __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str),
      __VA_ARGS__)
      ```
      Edward Thomson committed
  11. 06 Oct, 2016 1 commit
  12. 25 Feb, 2016 1 commit
    • nsec: support NDK's crazy nanoseconds · 3d6a42d1
      Android NDK does not have a `struct timespec` in its `struct stat`
      for nanosecond support, instead it has a single nanosecond member inside
      the struct stat itself.  We will use that and use a macro to expand to
      the `st_mtim` / `st_mtimespec` definition on other systems (much like
      the existing `st_mtime` backcompat definition).
      Edward Thomson committed
  13. 12 Feb, 2016 1 commit
  14. 30 Sep, 2015 1 commit
  15. 30 Jun, 2015 1 commit
  16. 17 Jun, 2015 1 commit
  17. 16 Jun, 2015 2 commits
    • Introduce p_utimes and p_futimes · 121c3171
      Provide functionality to set the time on a filesystem entry,
      using utimes or futimes on POSIX type systems or SetFileTime
      on Win32.
      Edward Thomson committed
    • crlf: tick the index forward to work around racy-git behaviour · c4e6ab5f
      In order to avoid racy-git, we zero out the file size for entries with
      the same timestamp as the index (or during the initial checkout). This
      is the case in a couple of crlf tests, as the code is fast enough to do
      everything in the same second.
      
      As we know that we do not perform the modification just after writing
      out the index, which is what this is designed to work around, tick the
      mtime of the index file such that it doesn't agree with the files
      anymore, and we do not zero out these entries.
      Carlos Martín Nieto committed
  18. 01 May, 2015 1 commit
  19. 05 Aug, 2014 3 commits
  20. 13 Jul, 2014 1 commit
  21. 20 Apr, 2014 1 commit
  22. 21 Apr, 2013 1 commit
  23. 09 Mar, 2013 1 commit
    • Make tree iterator handle icase equivalence · e40f1c2d
      There is a serious bug in the previous tree iterator implementation.
      If case insensitivity resulted in member elements being equivalent
      to one another, and those member elements were trees, then the
      children of the colliding elements would be processed in sequence
      instead of in a single flattened list.  This meant that the tree
      iterator was not truly acting like a case-insensitive list.
      
      This completely reworks the tree iterator to manage lists with
      case insensitive equivalence classes and advance through the items
      in a unified manner in a single sorted frame.
      
      It is possible that at a future date we might want to update this
      to separate the case insensitive and case sensitive tree iterators
      so that the case sensitive one could be a minimal amount of code
      and the insensitive one would always know what it needed to do
      without checking flags.
      
      But there would be so much shared code between the two, that I'm
      not sure it that's a win.  For now, this gets what we need.
      
      More tests are needed, though.
      Russell Belfer committed
  24. 29 Jan, 2013 1 commit
  25. 08 Jan, 2013 1 commit
  26. 15 Nov, 2012 1 commit
    • Add POSIX compat lstat() variant for win32 · cccacac5
      The existing p_lstat implementation on win32 is not quite POSIX
      compliant when setting errno to ENOTDIR.  This adds an option to
      make is be compliant so that code (such as checkout) that cares
      to have separate behavior for ENOTDIR can use it portably.
      
      This also contains a couple of other minor cleanups in the
      posix_w32.c implementations to avoid unnecessary work.
      Russell Belfer committed
  27. 07 Nov, 2012 1 commit
  28. 15 Oct, 2012 1 commit
  29. 22 Aug, 2012 2 commits
    • Some cleanup suggested during review · 85bd1746
      This cleans up a number of items suggested during code review
      with @vmg, including:
      
      * renaming "outside repo" config API to `git_config_open_default`
      * killing the `git_config_open_global` API
      * removing the `git_` prefix from the static functions in fileops
      * removing some unnecessary functionality from the "cp" command
      Russell Belfer committed
    • Add template dir and set gid to repo init · ca1b6e54
      This extends git_repository_init_ext further with support for
      initializing the repository from an external template directory
      and with support for the "create shared" type flags that make a
      set GID repository directory.
      
      This also adds tests for much of the new functionality to the
      existing `repo/init.c` test suite.
      
      Also, this adds a bunch of new utility functions including a
      very general purpose `git_futils_mkdir` (with the ability to
      make paths and to chmod the paths post-creation) and a file
      tree copying function `git_futils_cp_r`.  Also, this includes
      some new path functions that were useful to keep the code
      simple.
      Russell Belfer committed
  30. 16 Jul, 2012 1 commit
  31. 07 Jun, 2012 1 commit
  32. 12 May, 2012 1 commit
    • Fix readdir_r() usage for Solaris · 6fb1c0b4
      On Solaris, struct dirent is defined differently than Linux. The field
      containing the path name is of size 0, rather than NAME_MAX. So, we need to
      use a properly sized buffer on Solaris to avoid a stack overflow.
      
      Also fix some DIR* leaks on cleanup.
      Scott J. Goldman committed
  33. 10 May, 2012 1 commit
  34. 02 Mar, 2012 1 commit
    • Update diff to use iterators · 74fa4bfa
      This is a major reorganization of the diff code.  This changes
      the diff functions to use the iterators for traversing the
      content.  This allowed a lot of code to be simplified.  Also,
      this moved the functions relating to outputting a diff into a
      new file (diff_output.c).
      
      This includes a number of other changes - adding utility
      functions, extending iterators, etc. plus more tests for the
      diff code.  This also takes the example diff.c program much
      further in terms of emulating git-diff command line options.
      Russell Belfer committed
  35. 23 Feb, 2012 1 commit