1. 17 2月, 2012 7 次提交
    • J
      config: stop using config_exclusive_filename · 270a3443
      Jeff King 提交于
      The git-config command sometimes operates on the default set
      of config files (either reading from all, or writing to repo
      config), and sometimes operates on a specific file. In the
      latter case, we set the magic global config_exclusive_filename,
      and the code in config.c does the right thing.
      
      Instead, let's have git-config use the "advanced" variants
      of config.c's functions which let it specify an individual
      filename (or NULL for the default). This makes the code a
      lot more obvious, and fixes two small bugs:
      
        1. A relative path specified by GIT_CONFIG=foo will look
           in the wrong directory if we have to chdir as part of
           repository setup. We already handle this properly for
           "git config -f foo", but the GIT_CONFIG lookup used
           config_exclusive_filename directly. By dropping to a
           single magic variable, the GIT_CONFIG case now just
           works.
      
        2. Calling "git config -f foo --edit" would not respect
           core.editor. This is because just before editing, we
           called git_config, which would respect the
           config_exclusive_filename setting, even though this
           particular git_config call was not about looking in the
           user's specified file, but rather about loading actual
           git config, just as any other git program would.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      270a3443
    • J
      config: provide a version of git_config with more options · c9b5e2a5
      Jeff King 提交于
      Callers may want to provide a specific version of a file in which to look
      for config. Right now this can be done by setting the magic global
      config_exclusive_filename variable.  By providing a version of git_config
      that takes a filename, we can take a step towards making this magic global
      go away.
      
      Furthermore, by providing a more "advanced" interface, we now have a a
      natural place to add new options for callers like git-config, which care
      about tweaking the specifics of config lookup, without disturbing the
      large number of "simple" users (i.e., every other part of git).
      
      The astute reader of this patch may notice that the logic for handling
      config_exclusive_filename was taken out of git_config_early, but added
      into git_config. This means that git_config_early will no longer respect
      config_exclusive_filename.  That's OK, because the only other caller of
      git_config_early is check_repository_format_gently, but the only function
      which sets config_exclusive_filename is cmd_config, which does not call
      check_repository_format_gently (and if it did, it would have been a bug,
      anyway, as we would be checking the repository format in the wrong file).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c9b5e2a5
    • J
      config: teach git_config_rename_section a file argument · 42bd39b5
      Jeff King 提交于
      The other config-writing functions (git_config_set and
      git_config_set_multivar) each have an -"in_file" version to
      write a specific file. Let's add one for rename_section,
      with the eventual goal of moving away from the magic
      config_exclusive_filename global.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      42bd39b5
    • J
      config: teach git_config_set_multivar_in_file a default path · 0a5f5759
      Jeff King 提交于
      The git_config_set_multivar_in_file function takes a
      filename argument to specify the file into which the values
      should be written. Currently, this value must be non-NULL.
      Callers which want to write to the default location must use
      the regular, non-"in_file" version, which will either write
      to config_exclusive_filename, or to the repo config if the
      exclusive filename is NULL.
      
      Let's migrate the "default to using repo config" logic into
      the "in_file" form. That will let callers get the same
      default-if-NULL behavior as one gets with
      config_exclusive_filename, but without having to use the
      global variable.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0a5f5759
    • J
      config: copy the return value of prefix_filename · 839de252
      Jeff King 提交于
      The prefix_filename function returns a pointer to a static
      buffer which may be overwritten by subsequent calls. Since
      we are going to keep the result around for a while, let's be
      sure to duplicate it for safety.
      
      I don't think this can be triggered as a bug in the current
      code, but it's a good idea to be defensive, as any resulting
      bug would be quite subtle.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      839de252
    • J
      t1300: add missing &&-chaining · 27370b11
      Jeff King 提交于
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      27370b11
    • J
      docs/api-config: minor clarifications · d7be1f14
      Jeff King 提交于
      The first change simply drops some parentheses to make a
      statement more clear. The seconds clarifies that almost
      nobody wants to call git_config_early.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d7be1f14
  2. 07 2月, 2012 1 次提交
  3. 28 1月, 2012 1 次提交
  4. 27 1月, 2012 3 次提交
  5. 24 1月, 2012 1 次提交
  6. 19 1月, 2012 12 次提交
  7. 17 1月, 2012 3 次提交
    • J
      credential-cache: ignore "connection refused" errors · 35a71f14
      Jeff King 提交于
      The credential-cache helper will try to connect to its
      daemon over a unix socket. Originally, a failure to do so
      was silently ignored, and we would either give up (if
      performing a "get" or "erase" operation), or spawn a new
      daemon (for a "store" operation).
      
      But since 8ec6c8d7, we try to report more errors. We detect a
      missing daemon by checking for ENOENT on our connection
      attempt.  If the daemon is missing, we continue as before
      (giving up or spawning a new daemon). For any other error,
      we die and report the problem.
      
      However, checking for ENOENT is not sufficient for a missing
      daemon. We might also get ECONNREFUSED if a dead daemon
      process left a stale socket. This generally shouldn't
      happen, as the daemon cleans up after itself, but the daemon
      may not always be given a chance to do so (e.g., power loss,
      "kill -9").
      
      The resulting state is annoying not just because the helper
      outputs an extra useless message, but because it actually
      blocks the helper from spawning a new daemon to replace the
      stale socket.
      
      Fix it by checking for ECONNREFUSED.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      35a71f14
    • J
      Merge branch 'jn/maint-gitweb-grep-fix' · b63103e9
      Junio C Hamano 提交于
      * jn/maint-gitweb-grep-fix:
        gitweb: Harden "grep" search against filenames with ':'
        gitweb: Fix file links in "grep" search
      b63103e9
    • N
      diff-index: enable recursive pathspec matching in unpack_trees · 4838237c
      Nguyen Thai Ngoc Duy 提交于
      The pathspec structure has a few bits of data to drive various operation
      modes after we unified the pathspec matching logic in various codepaths.
      For example, max_depth field is there so that "git grep" can limit the
      output for files found in limited depth of tree traversal. Also in order
      to show just the surface level differences in "git diff-tree", recursive
      field stops us from descending into deeper level of the tree structure
      when it is set to false, and this also affects pathspec matching when
      we have wildcards in the pathspec.
      
      The diff-index has always wanted the recursive behaviour, and wanted to
      match pathspecs without any depth limit. But we forgot to do so when we
      updated tree_entry_interesting() logic to unify the pathspec matching
      logic.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4838237c
  8. 15 1月, 2012 1 次提交
  9. 14 1月, 2012 2 次提交
  10. 13 1月, 2012 9 次提交