1. 20 Jul, 2019 2 commits
    • path: extract function to check whether a path supports symlinks · ded77bb1
      When initializing a repository, we need to check whether its working
      directory supports symlinks to correctly set the initial value of the
      "core.symlinks" config variable. The code to check the filesystem is
      reusable in other parts of our codebase, like for example in our tests
      to determine whether certain tests can be expected to succeed or not.
      
      Extract the code into a new function `git_path_supports_symlinks` to
      avoid duplicate implementations. Remove a duplicate implementation in
      the repo test helper code.
      Patrick Steinhardt committed
    • fileops: rename to "futils.h" to match function signatures · e54343a4
      Our file utils functions all have a "futils" prefix, e.g.
      `git_futils_touch`. One would thus naturally guess that their
      definitions and implementation would live in files "futils.h" and
      "futils.c", respectively, but in fact they live in "fileops.h".
      
      Rename the files to match expectations.
      Patrick Steinhardt committed
  2. 19 Jul, 2019 1 commit
  3. 11 Jul, 2019 1 commit
    • fileops: fix creation of directory in filesystem root · 5ae22a63
      In commit 45f24e78 (git_repository_init: stop traversing at
      windows root, 2019-04-12), we have fixed `git_futils_mkdir` to
      correctly handle the case where we create a directory in
      Windows-style filesystem roots like "C:\repo".
      
      The problem here is an off-by-one: previously, to that commit,
      we've been checking wether the parent directory's length is equal
      to the root directory's length incremented by one. When we call
      the function with "/example", then the parent directory's length
      ("/") is 1, but the root directory offset is 0 as the path is
      directly rooted without a drive prefix. This resulted in `1 == 0 +
      1`, which was true. With the change, we've stopped incrementing
      the root directory length, and thus now compare `1 <= 0`, which
      is false.
      
      The previous way of doing it was kind of finicky any non-obvious,
      which is also why the error was introduced. So instead of just
      re-adding the increment, let's explicitly add a condition that
      aborts finding the parent if the current parent path is "/".
      
      Making this change causes Azure Pipelines to fail the testcase
      repo::init::nonexistent_paths on Unix-based systems. This is because we
      have just fixed creating directories in the filesystem root, which
      previously didn't work. As Docker-based tests are running as root user,
      we are thus able to create the non-existing path and will now succeed to
      create the repository that was expected to actually fail.
      
      Let's split this up into three different tests:
      
      - A test to verify that we do not create repos in a non-existing parent
        directoy if the flag `GIT_REPOSITORY_INIT_MKPATH` is not set.
      
      - A test to verify that we fail if the root directory does not exist. As
        there is a common root directory on Unix-based systems that always
        exist, we can only test for this on Windows-based systems.
      
      - A test to verify that we fail if trying to create a repository in an
        unwriteable parent directory. We can only test this if not running
        tests as root user, as CAP_DAC_OVERRIDE will cause us to ignore
        permissions when creating files.
      Patrick Steinhardt committed
  4. 17 Apr, 2019 1 commit
    • git_repository_init: stop traversing at windows root · 45f24e78
      Stop traversing the filesystem at the Windows directory root.  We were
      calculating the filesystem root for the given directory to create, and
      walking up the filesystem hierarchy.  We intended to stop when the
      traversal path length is equal to the root path length (ie, stopping at
      the root, since no path may be shorter than the root path).
      
      However, on Windows, the root path may be specified in two different
      ways, as either `Z:` or `Z:\`, where `Z:` is the current drive letter.
      `git_path_dirname_r` returns the path _without_ a trailing slash, even
      for the Windows root.  As a result, during traversal, we need to test
      that the traversal path is _less than or equal to_ the root path length
      to determine if we've hit the root to ensure that we stop when our
      traversal path is `Z:` and our calculated root path was `Z:\`.
      Edward Thomson committed
  5. 17 Jan, 2019 1 commit
  6. 20 Oct, 2018 4 commits
  7. 10 Jun, 2018 1 commit
  8. 12 Nov, 2017 1 commit
  9. 17 Jun, 2017 1 commit
  10. 27 Dec, 2015 3 commits
  11. 17 Sep, 2015 1 commit
    • git_futils_mkdir_*: make a relative-to-base mkdir · ac2fba0e
      Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter
      assumes that we own everything beneath the base, as if it were
      being called with a base of the repository or working directory,
      and is tailored towards checkout and ensuring that there is no
      bogosity beneath the base that must be cleaned up.
      
      This is (at best) slow and (at worst) unsafe in the larger context
      of a filesystem where we do not own things and cannot do things like
      unlink symlinks that are in our way.
      Edward Thomson committed
  12. 02 Jul, 2015 1 commit
  13. 03 Mar, 2015 1 commit
    • config: borrow refcounted references · 9a97f49e
      This changes the get_entry() method to return a refcounted version of
      the config entry, which you have to free when you're done.
      
      This allows us to avoid freeing the memory in which the entry is stored
      on a refresh, which may happen at any time for a live config.
      
      For this reason, get_string() has been forbidden on live configs and a
      new function get_string_buf() has been added, which stores the string in
      a git_buf which the user then owns.
      
      The functions which parse the string value takea advantage of the
      borrowing to parse safely and then release the entry.
      Carlos Martín Nieto committed
  14. 19 Feb, 2015 1 commit
  15. 05 Feb, 2015 1 commit
    • repo: ensure we can create repo at filesystem root · 865baaf9
      Test to ensure that we can create a repository at the filesystem
      root.  Introduces a new test environment variable,
      `GITTEST_INVASIVE_FILESYSTEM` for tests that do terrible things like
      escaping the clar sandbox and writing to the root directory.  It is
      expected that the CI builds will enable this but that normal people
      would not want this.
      Edward Thomson committed
  16. 08 Jan, 2015 1 commit
  17. 08 Nov, 2014 1 commit
  18. 17 Sep, 2014 1 commit
  19. 03 Sep, 2014 1 commit
  20. 14 Nov, 2013 1 commit
  21. 01 Nov, 2013 1 commit
  22. 03 Oct, 2013 3 commits
    • More cleanups to remove WIN assumptions · b8f9059d
      This cleans up more of the test suite to check actual filesystem
      behavior instead of relying on Windows vs. Mac vs. Linux to test.
      Russell Belfer committed
    • Update repo init with fewer platform assumptions · 840fb4fc
      The repo init code was assuming Windows == no filemode, and
      Mac or Windows == no case sensitivity.  Those assumptions are not
      consistently true depending on the mounted file system.  This is a
      first step to removing those assumptions.  It focuses on the repo
      init code and the tests of that code.  There are still many other
      tests that are broken when those assumptions don't hold true, but
      this clears up one area of the code.
      
      Also, this moves the core.precomposeunicode logic to be closer to
      the current logic in core Git where it will be set to true on any
      filesystem where composed unicode is decomposed when read back.
      Russell Belfer committed
    • Add check if we need to precompose unicode on Mac · 6b7991e2
      This adds initialization of core.precomposeunicode to repo init
      on Mac.  This is necessary because when a Mac accesses a repo on
      a VFAT or SAMBA file system, it will return directory entries in
      decomposed unicode even if the filesystem entry is precomposed.
      
      This also removes caching of a number of repo properties from the
      repo init pipeline because these are properties of the specific
      filesystem on which the repo is created, not of the system as a
      whole.
      Russell Belfer committed
  23. 24 Sep, 2013 1 commit
  24. 17 Sep, 2013 1 commit
  25. 05 Sep, 2013 3 commits
  26. 04 Sep, 2013 3 commits
  27. 16 Aug, 2013 2 commits