1. 07 10月, 2011 1 次提交
    • J
      attr: read core.attributesfile from git_default_core_config · 64589a03
      Junio C Hamano 提交于
      This code calls git_config from a helper function to parse the config entry
      it is interested in.  Calling git_config in this way may cause a problem if
      the helper function can be called after a previous call to git_config by
      another function since the second call to git_config may reset some
      variable to the value in the config file which was previously overridden.
      
      The above is not a problem in this case since the function passed to
      git_config only parses one config entry and the variable it sets is not
      assigned outside of the parsing function.  But a programmer who desires
      all of the standard config options to be parsed may be tempted to modify
      git_attr_config() so that it falls back to git_default_config() and then it
      _would_ be vulnerable to the above described behavior.
      
      So, move the call to git_config up into the top-level cmd_* function and
      move the responsibility for parsing core.attributesfile into the main
      config file parser.
      
      Which is only the logical thing to do ;-)
      Signed-off-by: NBrandon Casey <drafnel@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      64589a03
  2. 20 7月, 2011 1 次提交
  3. 07 7月, 2011 1 次提交
    • J
      core: log offset pack data accesses happened · 5f44324d
      Junio C Hamano 提交于
      In a workload other than "git log" (without pathspec nor any option that
      causes us to inspect trees and blobs), the recency pack order is said to
      cause the access jump around quite a bit. Add a hook to allow us observe
      how bad it is.
      
      "git config core.logpackaccess /var/tmp/pal.txt" will give you the log
      in the specified file.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5f44324d
  4. 23 6月, 2011 5 次提交
  5. 17 6月, 2011 1 次提交
    • R
      config.c: Make git_config() work correctly when called recursively · 924aaf3e
      Ramsay Jones 提交于
      On Cygwin, this fixes a test failure in t3301-notes.sh (test 98,
      "git notes copy --for-rewrite (disabled)").
      
      The test failure is caused by a recursive call to git_config() which
      has the effect of skipping to the end-of-file while processing the
      "notes.rewriteref" config variable. Thus, any config variables that
      appear after "notes.rewriteref" are simply ignored by git_config().
      Also, we note that the original FILE handle is leaked as a result
      of the recursive call.
      
      The recursive call to git_config() is due to the "schizophrenic stat"
      functions on cygwin, where one of two different implementations of
      the l/stat functions is selected lazily, depending on some config
      variables.
      
      In this case, the init_copy_notes_for_rewrite() function calls
      git_config() with the notes_rewrite_config() callback function.
      This callback, while processing the "notes.rewriteref" variable,
      in turn calls string_list_add_refs_by_glob() to process the
      associated ref value. This eventually leads to a call to the
      get_ref_dir() function, which in turn calls stat(). On cygwin,
      the stat() macro leads to an indirect call to cygwin_stat_stub()
      which, via init_stat(), then calls git_config() in order to
      determine which l/stat implementation to bind to.
      
      In order to solve this problem, we modify git_config() so that the
      global state variables used by the config reading code is packaged
      up and managed on a local state stack.
      Signed-off-by: NRamsay Jones <ramsay@ramsay1.demon.co.uk>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      924aaf3e
  6. 01 6月, 2011 1 次提交
  7. 25 5月, 2011 3 次提交
  8. 18 5月, 2011 1 次提交
  9. 10 5月, 2011 1 次提交
    • J
      convert: rename the "eol" global variable to "core_eol" · ec70f52f
      Junio C Hamano 提交于
      Yes, it is clear that "eol" wants to mean some sort of end-of-line thing,
      but as the name of a global variable, it is way too short to describe what
      kind of end-of-line thing it wants to represent. Besides, there are many
      codepaths that want to use their own local "char *eol" variable to point
      at the end of the current line they are processing.
      
      This global variable holds what we read from core.eol configuration
      variable. Name it as such.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ec70f52f
  10. 12 4月, 2011 1 次提交
  11. 06 4月, 2011 1 次提交
  12. 21 3月, 2011 1 次提交
  13. 17 3月, 2011 1 次提交
    • J
      standardize brace placement in struct definitions · 9cba13ca
      Jonathan Nieder 提交于
      In a struct definitions, unlike functions, the prevailing style is for
      the opening brace to go on the same line as the struct name, like so:
      
       struct foo {
      	int bar;
      	char *baz;
       };
      
      Indeed, grepping for 'struct [a-z_]* {$' yields about 5 times as many
      matches as 'struct [a-z_]*$'.
      
      Linus sayeth:
      
       Heretic people all over the world have claimed that this inconsistency
       is ...  well ...  inconsistent, but all right-thinking people know that
       (a) K&R are _right_ and (b) K&R are right.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9cba13ca
  14. 16 3月, 2011 1 次提交
  15. 12 3月, 2011 1 次提交
    • L
      Make the default abbrev length configurable · dce96489
      Linus Torvalds 提交于
      The default of 7 comes from fairly early in git development, when
      seven hex digits was a lot (it covers about 250+ million hash
      values). Back then I thought that 65k revisions was a lot (it was what
      we were about to hit in BK), and each revision tends to be about 5-10
      new objects or so, so a million objects was a big number.
      
      These days, the kernel isn't even the largest git project, and even
      the kernel has about 220k revisions (_much_ bigger than the BK tree
      ever was) and we are approaching two million objects. At that point,
      seven hex digits is still unique for a lot of them, but when we're
      talking about just two orders of magnitude difference between number
      of objects and the hash size, there _will_ be collisions in truncated
      hash values. It's no longer even close to unrealistic - it happens all
      the time.
      
      We should both increase the default abbrev that was unrealistically
      small, _and_ add a way for people to set their own default per-project
      in the git config file.
      
      This is the first step to first make it configurable; the default of 7
      is not raised yet.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dce96489
  16. 11 3月, 2011 1 次提交
  17. 23 2月, 2011 2 次提交
    • L
      Disallow empty section and variable names · 2169ddc0
      Libor Pechacek 提交于
      It is possible to break your repository config by creating an invalid key.  The
      config parser in turn chokes on it:
      
        $ git init
        Initialized empty Git repository in /tmp/gittest/.git/
        $ git config .foo false
        $ git config core.bare
        fatal: bad config file line 6 in .git/config
      
      This patch makes git-config reject keys which start or end with a dot and adds
      tests for these cases.
      Signed-off-by: NLibor Pechacek <lpechacek@suse.cz>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2169ddc0
    • L
      Sanity-check config variable names · b09c53a3
      Libor Pechacek 提交于
      Sanity-check config variable names when adding and retrieving them.  As a side
      effect code duplication between git_config_set_multivar and get_value (in
      builtin/config.c) was removed and the common functionality was placed in
      git_config_parse_key.
      
      This breaks a test in t1300 which used invalid section-less keys in the tests
      for "git -c". However, allowing such names there was useless, since there was
      no way to set them via config file, and no part of git actually tried to use
      section-less keys. This patch updates the test to use more realistic examples
      as well as adding its own test.
      Signed-off-by: NLibor Pechacek <lpechacek@suse.cz>
      Acked-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b09c53a3
  18. 17 2月, 2011 1 次提交
    • J
      push.default: Rename 'tracking' to 'upstream' · 53c40311
      Johan Herland 提交于
      Users are sometimes confused with two different types of "tracking" behavior
      in Git: "remote-tracking" branches (e.g. refs/remotes/*/*) versus the
      merge/rebase relationship between a local branch and its @{upstream}
      (controlled by branch.foo.remote and branch.foo.merge config settings).
      
      When the push.default is set to 'tracking', it specifies that a branch should
      be pushed to its @{upstream} branch. In other words, setting push.default to
      'tracking' applies only to the latter of the above two types of "tracking"
      behavior.
      
      In order to make this more understandable to the user, we rename the
      push.default == 'tracking' option to push.default == 'upstream'.
      
      push.default == 'tracking' is left as a deprecated synonym for 'upstream'.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      53c40311
  19. 23 12月, 2010 1 次提交
  20. 20 12月, 2010 1 次提交
    • J
      handle arbitrary ints in git_config_maybe_bool · db6195ef
      Jeff King 提交于
      This function recently gained the ability to recognize the documented "0"
      and "1" values as false/true. However, unlike regular git_config_bool, it
      did not treat arbitrary non-zero numbers as true.
      
      While this is undocumented and probably ridiculous for somebody to rely
      on, it is safer to behave exactly as git_config_bool would. Because
      git_config_maybe_bool can be used to retrofit new non-bool values onto
      existing bool options, not behaving in exactly the same way is technically
      a regression.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      db6195ef
  21. 18 11月, 2010 1 次提交
    • J
      log.decorate: accept 0/1 bool values · b2be2f6a
      Jeff King 提交于
      We explicitly document "0" and "1" as synonyms for "false"
      and "true" in boolean config options. However, we don't
      actually handle those values in git_config_maybe_bool.
      
      In most cases this works fine, as we call git_config_bool,
      which in turn calls git_config_bool_or_int, which in turn
      calls git_config_maybe_bool. Values of 0/1 are considered
      "not bool", but their integer values end up being converted
      to the corresponding boolean values.
      
      However, the log.decorate code looks for maybe_bool
      explicitly, so that it can fall back to the "short" and
      "full" strings. It does not handle 0/1 at all, and considers
      them invalid values.
      
      We cannot simply add 0/1 support to git_config_maybe_bool.
      That would confuse git_config_bool_or_int, which may want to
      distinguish the integer values "0" and "1" from bools.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b2be2f6a
  22. 29 10月, 2010 1 次提交
    • J
      core.abbrevguard: Ensure short object names stay unique a bit longer · 72a5b561
      Junio C Hamano 提交于
      Even though git makes sure that it uses enough hexdigits to show an
      abbreviated object name unambiguously, as more objects are added to the
      repository over time, a short name that used to be unique will stop being
      unique.  Git uses this many extra hexdigits that are more than necessary
      to make the object name currently unique, in the hope that its output will
      stay unique a bit longer.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      72a5b561
  23. 22 10月, 2010 1 次提交
    • J
      config: treat non-existent config files as empty · 1f2baa78
      Jeff King 提交于
      The git_config() function signals error by returning -1 in
      two instances:
      
        1. An actual error occurs in opening a config file (parse
           errors cause an immediate die).
      
        2. Of the three possible config files, none was found.
      
      However, this second case is often not an error at all; it
      simply means that the user has no configuration (they are
      outside a repo, and they have no ~/.gitconfig file). This
      can lead to confusing errors, such as when the bash
      completion calls "git config --list" outside of a repo. If
      the user has a ~/.gitconfig, the command completes
      succesfully; if they do not, it complains to stderr.
      
      This patch allows callers of git_config to distinguish
      between the two cases. Error is signaled by -1, and
      otherwise the return value is the number of files parsed.
      This means that the traditional "git_config(...) < 0" check
      for error should work, but callers who want to know whether
      we parsed any files or not can still do so.
      
      [jc: with tests from Jonathan]
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1f2baa78
  24. 01 9月, 2010 1 次提交
  25. 25 8月, 2010 1 次提交
    • J
      pass "git -c foo=bar" params through environment · 2b64fc89
      Jeff King 提交于
      Git uses the "-c foo=bar" parameters to set a config
      variable for a single git invocation. We currently do this
      by making a list in the current process and consulting that
      list in git_config.
      
      This works fine for built-ins, but the config changes are
      silently ignored by subprocesses, including dashed externals
      and invocations to "git config" from shell scripts.
      
      This patch instead puts them in an environment variable
      which we consult when looking at config (both internally and
      via calls "git config").
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2b64fc89
  26. 07 6月, 2010 1 次提交
  27. 20 5月, 2010 1 次提交
    • E
      Add per-repository eol normalization · fd6cce9e
      Eyvind Bernhardsen 提交于
      Change the semantics of the "crlf" attribute so that it enables
      end-of-line normalization when it is set, regardless of "core.autocrlf".
      
      Add a new setting for "crlf": "auto", which enables end-of-line
      conversion but does not override the automatic text file detection.
      
      Add a new attribute "eol" with possible values "crlf" and "lf".  When
      set, this attribute enables normalization and forces git to use CRLF or
      LF line endings in the working directory, respectively.
      
      The line ending style to be used for normalized text files in the
      working directory is set using "core.autocrlf".  When it is set to
      "true", CRLFs are used in the working directory; when set to "input" or
      "false", LFs are used.
      Signed-off-by: NEyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fd6cce9e
  28. 29 3月, 2010 3 次提交
  29. 18 2月, 2010 1 次提交
    • J
      git_config_maybe_bool() · 8420ccd8
      Junio C Hamano 提交于
      Some configuration variables can take boolean values in addition to
      enumeration specific to them.  Introduce git_config_maybe_bool() that
      returns 0 or 1 if the given value is boolean, or -1 if not, so that
      a parser for such a variable can check for boolean first and then
      parse other kinds of values as a fallback.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8420ccd8
  30. 11 1月, 2010 1 次提交
    • J
      ident.c: check explicit identity for name and email separately · 91c38a21
      Junio C Hamano 提交于
      bb1ae3f6 (commit: Show committer if automatic, 2008-05-04) added a logic to
      check both name and email were given explicitly by the end user, but it
      assumed that fmt_ident() is never called before git_default_user_config()
      is called, which was fragile.  The former calls setup_ident() and fills
      the "default" name and email, so the check in the config parser would have
      mistakenly said both are given even if only user.name was provided.
      
      Make the logic more robust by keeping track of name and email separately.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      Acked-by: NSanti Béjar <santi@agolina.net>
      91c38a21
  31. 18 11月, 2009 1 次提交