1. 09 4月, 2018 1 次提交
  2. 18 11月, 2017 1 次提交
    • H
      config: add --expiry-date · 5f967424
      Haaris Mehmood 提交于
      Add --expiry-date as a data-type for config files when
      'git config --get' is used. This will return any relative
      or fixed dates from config files as timestamps.
      
      This is useful for scripts (e.g. gc.reflogexpire) that work
      with timestamps so that '2.weeks' can be converted to a format
      acceptable by those scripts/functions.
      
      Following the convention of git_config_pathname(), move
      the helper function required for this feature from
      builtin/reflog.c to builtin/config.c where other similar
      functions exist (e.g. for --bool or --path), and match
      the order of parameters with other functions (i.e. output
      pointer as first parameter).
      Signed-off-by: NHaaris Mehmood <hsed@unimetic.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5f967424
  3. 01 10月, 2017 1 次提交
    • B
      fsmonitor: teach git to optionally utilize a file system monitor to speed up... · 883e248b
      Ben Peart 提交于
      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: NBen Peart <benpeart@microsoft.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      883e248b
  4. 07 9月, 2017 1 次提交
  5. 23 8月, 2017 1 次提交
    • J
      rerere: allow approxidate in gc.rerereResolved/gc.rerereUnresolved · 6e96cb52
      Junio C Hamano 提交于
      These two configuration variables are described in the documentation
      to take an expiry period expressed in the number of days:
      
          gc.rerereResolved::
      	    Records of conflicted merge you resolved earlier are
      	    kept for this many days when 'git rerere gc' is run.
      	    The default is 60 days.
      
          gc.rerereUnresolved::
      	    Records of conflicted merge you have not resolved are
      	    kept for this many days when 'git rerere gc' is run.
      	    The default is 15 days.
      
      There is no strong reason not to allow a more general "approxidate"
      expiry specification, e.g. "5.days.ago", or "never".
      
      Rename the config_get_expiry() helper introduced in the previous
      step to git_config_get_expiry_in_days() and move it to a more
      generic place, config.c, and use date.c::parse_expiry_date() to do
      so.  Give it an ability to allow the caller to tell among three
      cases (i.e. there is no "gc.rerereResolved" config, there is and it
      is correctly parsed into the *expiry variable, and there was an
      error in parsing the given value).  The current caller can work
      correctly without using the return value, though.
      
      In the future, we may find other variables that only allow an
      integer that specifies "this many days" or other unit of time, and
      when it happens we may need to drop "_days" suffix from the name of
      the function and instead pass the "scale" value as another parameter.
      
      But this will do for now.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6e96cb52
  6. 03 8月, 2017 1 次提交
  7. 18 7月, 2017 1 次提交
  8. 24 6月, 2017 1 次提交
    • B
      config: read config from a repository object · 3b256228
      Brandon Williams 提交于
      Teach the config machinery to read config information from a repository
      object.  This involves storing a 'struct config_set' inside the
      repository object and adding a number of functions (repo_config*) to be
      able to query a repository's config.
      
      The current config API enables lazy-loading of the config.  This means
      that when 'git_config_get_int()' is called, if the_config_set hasn't
      been populated yet, then it will be populated and properly initialized by
      reading the necessary config files (system wide .gitconfig, user's home
      .gitconfig, and the repository's config).  To maintain this paradigm,
      the new API to read from a repository object's config will also perform
      this lazy-initialization.
      
      Since both APIs (git_config_get* and repo_config_get*) have the same
      semantics we can migrate the default config to be stored within
      'the_repository' and just have the 'git_config_get*' family of functions
      redirect to the 'repo_config_get*' functions.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3b256228
  9. 16 6月, 2017 4 次提交
    • B
      config: don't implicitly use gitdir or commondir · dc8441fd
      Brandon Williams 提交于
      'git_config_with_options()' takes a 'config_options' struct which
      contains feilds for 'git_dir' and 'commondir'.  If those feilds happen
      to be NULL the config machinery falls back to querying global repository
      state.  Let's change this and instead use these fields in the
      'config_options' struct explicilty all the time.  Since the API is
      slightly changing to require these two fields to be set if callers want
      the config machinery to load the repository's config, let's change the
      name to 'config_with_optison()'.  This allows the config machinery to
      not implicitly rely on any global repository state.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dc8441fd
    • B
      config: respect commondir · a577fb5f
      Brandon Williams 提交于
      Worktrees present an interesting problem when it comes to the config.
      Historically we could assume that the per-repository config lives at
      'gitdir/config', but since worktrees were introduced this isn't the case
      anymore.  There is currently no way to specify per-worktree
      configuration, and as such the repository config is shared with all
      worktrees and is located at 'commondir/config'.
      
      Many users of the config machinery correctly set
      'config_options.git_dir' with the repository's commondir, allowing the
      config to be properly loaded when operating in a worktree.  But other's,
      like 'read_early_config()', set 'config_options.git_dir' with the
      repository's gitdir which can be incorrect when using worktrees.
      
      To fix this issue, and to make things less ambiguous, lets add a
      'commondir' field to the 'config_options' struct and have all callers
      properly set both the 'git_dir' and 'commondir' fields so that the
      config machinery is able to properly find the repository's config.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a577fb5f
    • B
      config: remove git_config_iter · f1c985da
      Brandon Williams 提交于
      Since there is no implementation of the function 'git_config_iter',
      let's stop exporting it and remove the prototype from config.h.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f1c985da
    • B
      config: create config.h · e67a57fc
      Brandon Williams 提交于
      Move all config related declarations from cache.h to a new config.h
      header file.  This makes cache.h smaller and allows for the opportunity
      in a following patch to only include config.h when needed.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e67a57fc