1. 15 Aug, 2018 1 commit
  2. 07 Feb, 2018 1 commit
    • Duy Nguyen's avatar
      dir.c: ignore paths containing .git when invalidating untracked cache · 0cacebf0
      Duy Nguyen authored
      read_directory() code ignores all paths named ".git" even if it's not
      a valid git repository. See treat_path() for details. Since ".git" is
      basically invisible to read_directory(), when we are asked to
      invalidate a path that contains ".git", we can safely ignore it
      because the slow path would not consider it anyway.
      
      This helps when fsmonitor is used and we have a real ".git" repo at
      worktree top. Occasionally .git/index will be updated and if the
      fsmonitor hook does not filter it, untracked cache is asked to
      invalidate the path ".git/index".
      
      Without this patch, we invalidate the root directory unncessarily,
      which:
      
      - makes read_directory() fall back to slow path for root directory
        (slower)
      
      - makes the index dirty (because UNTR extension is updated). Depending
        on the index size, writing it down could also be slow.
      
      A note about the new "safe_path" knob. Since this new check could be
      relatively expensive, avoid it when we know it's not needed. If the
      path comes from the index, it can't contain ".git". If it does
      contain, we may be screwed up at many more levels, not just this one.
      Noticed-by: Ævar Arnfjörð Bjarmason's avatarÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: Duy Nguyen's avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      0cacebf0
  3. 10 Nov, 2017 1 commit
    • Alex Vandiver's avatar
      fsmonitor: store fsmonitor bitmap before splitting index · 3bd28eb2
      Alex Vandiver authored
      ba1b9cac ("fsmonitor: delay updating state until after split index
      is merged", 2017-10-27) resolved the problem of the fsmonitor data
      being applied to the non-base index when reading; however, a similar
      problem exists when writing the index.  Specifically, writing of the
      fsmonitor extension happens only after the work to split the index
      has been applied -- as such, the information in the index is only
      for the non-"base" index, and thus the extension information
      contains only partial data.
      
      When saving, compute the ewah bitmap before the index is split, and
      store it in the fsmonitor_dirty field, mirroring the behavior that
      occurred during reading.  fsmonitor_dirty is kept from being leaked by
      being freed when the extension data is written -- which always happens
      precisely once, no matter the split index configuration.
      Signed-off-by: default avatarAlex Vandiver <alexmv@dropbox.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      3bd28eb2
  4. 01 Oct, 2017 1 commit
    • Ben Peart's avatar
      fsmonitor: teach git to optionally utilize a file system monitor to speed up... · 883e248b
      Ben Peart authored
      fsmonitor: teach git to optionally utilize a file system monitor to speed up detecting new or changed files.
      
      When the index is read from disk, the fsmonitor index extension is used
      to flag the last known potentially dirty index entries. The registered
      core.fsmonitor command is called with the time the index was last
      updated and returns the list of files changed since that time. This list
      is used to flag any additional dirty cache entries and untracked cache
      directories.
      
      We can then use this valid state to speed up preload_index(),
      ie_match_stat(), and refresh_cache_ent() as they do not need to lstat()
      files to detect potential changes for those entries marked
      CE_FSMONITOR_VALID.
      
      In addition, if the untracked cache is turned on valid_cached_dir() can
      skip checking directories for new or changed files as fsmonitor will
      invalidate the cache only for those directories that have been
      identified as having potential changes.
      
      To keep the CE_FSMONITOR_VALID state accurate during git operations;
      when git updates a cache entry to match the current state on disk,
      it will now set the CE_FSMONITOR_VALID bit.
      
      Inversely, anytime git changes a cache entry, the CE_FSMONITOR_VALID bit
      is cleared and the corresponding untracked cache directory is marked
      invalid.
      Signed-off-by: default avatarBen Peart <benpeart@microsoft.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      883e248b