1. 03 Jul, 2017 1 commit
    • Make sure to always include "common.h" first · 0c7f49dd
      Next to including several files, our "common.h" header also declares
      various macros which are then used throughout the project. As such, we
      have to make sure to always include this file first in all
      implementation files. Otherwise, we might encounter problems or even
      silent behavioural differences due to macros or defines not being
      defined as they should be. So in fact, our header and implementation
      files should make sure to always include "common.h" first.
      
      This commit does so by establishing a common include pattern. Header
      files inside of "src" will now always include "common.h" as its first
      other file, separated by a newline from all the other includes to make
      it stand out as special. There are two cases for the implementation
      files. If they do have a matching header file, they will always include
      this one first, leading to "common.h" being transitively included as
      first file. If they do not have a matching header file, they instead
      include "common.h" as first file themselves.
      
      This fixes the outlined problems and will become our standard practice
      for header and source files inside of the "src/" from now on.
      Patrick Steinhardt committed
  2. 21 Feb, 2017 1 commit
    • attrcache: remove useless `do_init` indirection · ce6f61da
      Remove useless indirection from `git_attr_cache__init` to
      `git_attr_cache__do_init`. The difference is that the
      `git_attr_cache__init` macro first checks if the cache is already
      initialized and, if so, not call `git_attr_cache__do_init`. But
      actually, `git_attr_cache__do_init` already does the same thing and
      returns immediately if the cache is already initialized.
      
      Remove the indirection.
      Patrick Steinhardt committed
  3. 03 Feb, 2015 1 commit
    • attrcache: don't re-read attrs during checkout · 9f779aac
      During checkout, assume that the .gitattributes files aren't
      modified during the checkout.  Instead, create an "attribute session"
      during checkout.  Assume that attribute data read in the same
      checkout "session" hasn't been modified since the checkout started.
      (But allow subsequent checkouts to invalidate the cache.)
      
      Further, cache nonexistent git_attr_file data even when .gitattributes
      files are not found to prevent re-scanning for nonexistent files.
      Edward Thomson committed
  4. 17 Apr, 2014 3 commits
  5. 24 May, 2013 1 commit
    • Add ~ expansion to global attributes and excludes · 7a5ee3dc
      This adds ~/ prefix expansion for the value of core.attributesfile
      and core.excludesfile, plus it fixes the fact that the attributes
      cache was holding on to the string data from the config for a long
      time (instead of making its own strdup) which could have caused a
      problem if the config was refreshed.  Adds a test for the new
      expansion capability.
      Russell Belfer committed
  6. 15 Mar, 2013 1 commit
    • Implement global/system file search paths · 5540d947
      The goal of this work is to expose the search logic for "global",
      "system", and "xdg" files through the git_libgit2_opts() interface.
      
      Behind the scenes, I changed the logic for finding files to have a
      notion of a git_strarray that represents a search path and to store
      a separate search path for each of the three tiers of config file.
      For each tier, I implemented a function to initialize it to default
      values (generally based on environment variables), and then general
      interfaces to get it, set it, reset it, and prepend new directories
      to it.
      
      Next, I exposed these interfaces through the git_libgit2_opts
      interface, reusing the GIT_CONFIG_LEVEL_SYSTEM, etc., constants
      for the user to control which search path they were modifying.
      There are alternative designs for the opts interface / argument
      ordering, so I'm putting this phase out for discussion.
      
      Additionally, I ended up doing a little bit of clean up regarding
      attr.h and attr_file.h, adding a new attrcache.h so the other two
      files wouldn't have to be included in so many places.
      Russell Belfer committed