1. 25 Apr, 2018 1 commit
  2. 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
  3. 17 Mar, 2017 1 commit
  4. 13 Feb, 2017 3 commits
    • worktree: compute workdir for worktrees opened via their gitdir · 39abd3ad
      When opening a worktree via the gitdir of its parent repository
      we fail to correctly set up the worktree's working directory. The
      problem here is two-fold: we first fail to see that the gitdir
      actually is a gitdir of a working tree and then subsequently
      fail to determine the working tree location from the gitdir.
      
      The first problem of not noticing a gitdir belongs to a worktree
      can be solved by checking for the existence of a `gitdir` file in
      the gitdir. This file points back to the gitlink file located in
      the working tree's working directory. As this file only exists
      for worktrees, it should be sufficient indication of the gitdir
      belonging to a worktree.
      
      The second problem, that is determining the location of the
      worktree's working directory, can then be solved by reading the
      `gitdir` file in the working directory's gitdir. When we now
      resolve relative paths and strip the final `.git` component, we
      have the actual worktree's working directory location.
      Patrick Steinhardt committed
    • worktree: implement locking mechanisms · 2a503485
      Working trees support locking by creating a file `locked` inside
      the tree's gitdir with an optional reason inside. Support this
      feature by adding functions to get and set the locking status.
      Patrick Steinhardt committed
    • worktree: introduce `struct git_worktree` · d3bc09e8
      Introduce a new `struct git_worktree`, which holds information
      about a possible working tree connected to a repository.
      Introduce functions to allow opening working trees for a
      repository.
      Patrick Steinhardt committed