1. 17 2月, 2012 2 次提交
    • 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: 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
  2. 28 12月, 2011 1 次提交
  3. 11 10月, 2011 1 次提交
  4. 20 8月, 2011 2 次提交
    • J
      config: refactor get_colorbool function · c659f55b
      Jeff King 提交于
      For "git config --get-colorbool color.foo", we use a custom
      callback that looks not only for the key that the user gave
      us, but also for "diff.color" (for backwards compatibility)
      and "color.ui" (as a fallback).
      
      For the former, we use a custom variable to store the
      diff.color value. For the latter, though, we store it in the
      main "git_use_color_default" variable, turning on color.ui
      for any other parts of git that respect this value.
      
      In practice, this doesn't cause any bugs, because git-config
      runs without caring about git_use_color_default, and then
      exits. But it crosses module boundaries in an unusual and
      confusing way, and it makes refactoring color handling
      harder than it needs to be.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c659f55b
    • J
      color: delay auto-color decision until point of use · daa0c3d9
      Jeff King 提交于
      When we read a color value either from a config file or from
      the command line, we use git_config_colorbool to convert it
      from the tristate always/never/auto into a single yes/no
      boolean value.
      
      This has some timing implications with respect to starting
      a pager.
      
      If we start (or decide not to start) the pager before
      checking the colorbool, everything is fine. Either isatty(1)
      will give us the right information, or we will properly
      check for pager_in_use().
      
      However, if we decide to start a pager after we have checked
      the colorbool, things are not so simple. If stdout is a tty,
      then we will have already decided to use color. However, the
      user may also have configured color.pager not to use color
      with the pager. In this case, we need to actually turn off
      color. Unfortunately, the pager code has no idea which color
      variables were turned on (and there are many of them
      throughout the code, and they may even have been manipulated
      after the colorbool selection by something like "--color" on
      the command line).
      
      This bug can be seen any time a pager is started after
      config and command line options are checked. This has
      affected "git diff" since 89d07f75 (diff: don't run pager if
      user asked for a diff style exit code, 2007-08-12). It has
      also affect the log family since 1fda91b5 (Fix 'git log'
      early pager startup error case, 2010-08-24).
      
      This patch splits the notion of parsing a colorbool and
      actually checking the configuration. The "use_color"
      variables now have an additional possible value,
      GIT_COLOR_AUTO. Users of the variable should use the new
      "want_color()" wrapper, which will lazily determine and
      cache the auto-color decision.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      daa0c3d9
  5. 19 8月, 2011 1 次提交
  6. 18 5月, 2011 1 次提交
    • M
      config: Give error message when not changing a multivar · 5a2df368
      Michael J Gruber 提交于
      When trying to set a multivar with "git config var value", "git config"
      issues
      
      warning: remote.repoor.push has multiple values
      
      leaving the user under the impression that the operation succeeded,
      unless one checks the return value.
      
      Instead, make it
      
      warning: remote.repoor.push has multiple values
      error: cannot overwrite multiple values with a single value
             Use a regexp, --add or --set-all to change remote.repoor.push.
      
      to be clear and helpful.
      
      Note: The "warning" is raised through other code paths also so that it
      needs to remain a warning for these (which do not raise the error). Only
      the caller can determine how to go on from that.
      Signed-off-by: NMichael J Gruber <git@drmicha.warpmail.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5a2df368
  7. 16 3月, 2011 1 次提交
  8. 23 2月, 2011 1 次提交
    • 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
  9. 16 2月, 2011 1 次提交
  10. 14 2月, 2011 1 次提交
  11. 16 8月, 2010 1 次提交
  12. 05 8月, 2010 1 次提交
  13. 29 3月, 2010 1 次提交
  14. 23 2月, 2010 1 次提交
    • L
      Move 'builtin-*' into a 'builtin/' subdirectory · 81b50f3c
      Linus Torvalds 提交于
      This shrinks the top-level directory a bit, and makes it much more
      pleasant to use auto-completion on the thing. Instead of
      
      	[torvalds@nehalem git]$ em buil<tab>
      	Display all 180 possibilities? (y or n)
      	[torvalds@nehalem git]$ em builtin-sh
      	builtin-shortlog.c     builtin-show-branch.c  builtin-show-ref.c
      	builtin-shortlog.o     builtin-show-branch.o  builtin-show-ref.o
      	[torvalds@nehalem git]$ em builtin-shor<tab>
      	builtin-shortlog.c  builtin-shortlog.o
      	[torvalds@nehalem git]$ em builtin-shortlog.c
      
      you get
      
      	[torvalds@nehalem git]$ em buil<tab>		[type]
      	builtin/   builtin.h
      	[torvalds@nehalem git]$ em builtin		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/sh<tab>	[type]
      	shortlog.c     shortlog.o     show-branch.c  show-branch.o  show-ref.c     show-ref.o
      	[torvalds@nehalem git]$ em builtin/sho		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/shor<tab>	[type]
      	shortlog.c  shortlog.o
      	[torvalds@nehalem git]$ em builtin/shortlog.c
      
      which doesn't seem all that different, but not having that annoying
      break in "Display all 180 possibilities?" is quite a relief.
      
      NOTE! If you do this in a clean tree (no object files etc), or using an
      editor that has auto-completion rules that ignores '*.o' files, you
      won't see that annoying 'Display all 180 possibilities?' message - it
      will just show the choices instead.  I think bash has some cut-off
      around 100 choices or something.
      
      So the reason I see this is that I'm using an odd editory, and thus
      don't have the rules to cut down on auto-completion.  But you can
      simulate that by using 'ls' instead, or something similar.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      81b50f3c
  15. 27 1月, 2010 1 次提交
  16. 01 1月, 2010 1 次提交
  17. 28 6月, 2009 1 次提交
  18. 25 5月, 2009 1 次提交
  19. 30 4月, 2009 1 次提交
  20. 18 3月, 2009 1 次提交
  21. 08 3月, 2009 1 次提交
  22. 22 2月, 2009 9 次提交
  23. 09 2月, 2009 1 次提交
  24. 31 10月, 2008 1 次提交
  25. 24 7月, 2008 1 次提交
  26. 14 7月, 2008 1 次提交
    • S
      Make usage strings dash-less · 1b1dd23f
      Stephan Beyer 提交于
      When you misuse a git command, you are shown the usage string.
      But this is currently shown in the dashed form.  So if you just
      copy what you see, it will not work, when the dashed form
      is no longer supported.
      
      This patch makes git commands show the dash-less version.
      
      For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh
      generates a dash-less usage string now.
      Signed-off-by: NStephan Beyer <s-beyer@gmx.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1b1dd23f
  27. 01 7月, 2008 1 次提交
    • D
      Only use GIT_CONFIG in "git config", not other programs · dc871831
      Daniel Barkalow 提交于
      For everything other than using "git config" to read or write a
      git-style config file that isn't the current repo's config file,
      GIT_CONFIG was actively detrimental. Rather than argue over which
      programs are important enough to have work anyway, just fix all of
      them at the root.
      
      Also removes GIT_LOCAL_CONFIG, which would only be useful for programs
      that do want to use global git-specific config, but not the repo's own
      git-specific config, and want to use some other, presumably
      git-specific config. Despite being documented, I can't find any sign that
      it was ever used.
      Signed-off-by: NDaniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dc871831
  28. 15 5月, 2008 1 次提交
  29. 14 4月, 2008 1 次提交
  30. 11 4月, 2008 1 次提交