1. 06 8月, 2014 1 次提交
  2. 15 10月, 2013 1 次提交
  3. 10 9月, 2013 5 次提交
    • J
      git-config: always treat --int as 64-bit internally · 00160242
      Jeff King 提交于
      When you run "git config --int", the maximum size of integer
      you get depends on how git was compiled, and what it
      considers to be an "int".
      
      This is almost useful, because your scripts calling "git
      config" will behave similarly to git internally. But relying
      on this is dubious; you have to actually know how git treats
      each value internally (e.g., int versus unsigned long),
      which is not documented and is subject to change. And even
      if you know it is "unsigned long", we do not have a
      git-config option to match that behavior.
      
      Furthermore, you may simply be asking git to store a value
      on your behalf (e.g., configuration for a hook). In that
      case, the relevant range check has nothing at all to do with
      git, but rather with whatever scripting tools you are using
      (and git has no way of knowing what the appropriate range is
      there).
      
      Not only is the range check useless, but it is actively
      harmful, as there is no way at all for scripts to look
      at config variables with large values. For instance, one
      cannot reliably get the value of pack.packSizeLimit via
      git-config. On an LP64 system, git happily uses a 64-bit
      "unsigned long" internally to represent the value, but the
      script cannot read any value over 2G.
      
      Ideally, the "--int" option would simply represent an
      arbitrarily large integer. For practical purposes, however,
      a 64-bit integer is large enough, and is much easier to
      implement (and if somebody overflows it, we will still
      notice the problem, and not simply return garbage).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      00160242
    • J
      config: make numeric parsing errors more clear · 2f666581
      Jeff King 提交于
      If we try to parse an integer config argument and get a
      number outside of the representable range, we die with the
      cryptic message: "bad config value for '%s'".
      
      We can improve two things:
      
        1. Show the value that produced the error (e.g., bad
           config value '3g' for 'foo.bar').
      
        2. Mention the reason the value was rejected (e.g.,
           "invalid unit" versus "out of range").
      
      A few tests need to be updated with the new output, but that
      should not be representative of real-world breakage, as
      scripts should not be depending on the exact text of our
      stderr output, which is subject to i18n anyway.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2f666581
    • J
      config: set errno in numeric git_parse_* functions · 33fdd77e
      Jeff King 提交于
      When we are parsing an integer or unsigned long, we use
      the strto*max functions, which properly set errno to ERANGE
      if we get a large value. However, we also do further range
      checks after applying our multiplication factor, but do not
      set ERANGE. This means that a caller cannot tell if an error
      was caused by ERANGE or if the input was simply not a valid
      number.
      
      This patch teaches git_parse_signed and git_parse_unsigned to set
      ERANGE for range errors, and EINVAL for other errors, so that the
      caller can reliably tell these cases apart.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      33fdd77e
    • J
      config: properly range-check integer values · 42d194e9
      Jeff King 提交于
      When we look at a config value as an integer using the
      git_config_int function, we carefully range-check the value
      we get and complain if it is out of our range. But the range
      we compare to is that of a "long", which we then cast to an
      "int" in the function's return value. This means that on
      systems where "int" and "long" have different sizes (e.g.,
      LP64 systems), we may pass the range check, but then return
      nonsense by truncating the value as we cast it to an int.
      
      We can solve this by converting git_parse_long into
      git_parse_int, and range-checking the "int" range. Nobody
      actually cared that we used a "long" internally, since the
      result was truncated anyway. And the only other caller of
      git_parse_long is git_config_maybe_bool, which should be
      fine to just use int (though we will now forbid out-of-range
      nonsense like setting "merge.ff" to "10g" to mean "true",
      which is probably a good thing).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      42d194e9
    • J
      config: factor out integer parsing from range checks · 7192777d
      Jeff King 提交于
      When we are parsing integers for config, we use an intmax_t
      (or uintmax_t) internally, and then check against the size
      of our result type at the end. We can parameterize the
      maximum representable value, which will let us re-use the
      parsing code for a variety of range checks.
      
      Unfortunately, we cannot combine the signed and unsigned
      parsing functions easily, as we have to rely on the signed
      and unsigned C types internally.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7192777d
  4. 27 8月, 2013 1 次提交
    • J
      config: do not use C function names as struct members · 49d6cfa5
      Jeff King 提交于
      According to C99, section 7.1.4:
      
        Any function declared in a header may be additionally
        implemented as a function-like macro defined in the
        header.
      
      Therefore calling our struct member function pointer "fgetc"
      may run afoul of unwanted macro expansion when we call:
      
        char c = cf->fgetc(cf);
      
      This turned out to be a problem on uclibc, which defines
      fgetc as a macro and causes compilation failure.
      
      The standard suggests fixing this in a few ways:
      
        1. Using extra parentheses to inhibit the function-like
           macro expansion. E.g., "(cf->fgetc)(cf)". This is
           undesirable as it's ugly, and each call site needs to
           remember to use it (and on systems without the macro,
           forgetting will compile just fine).
      
        2. Using #undef (because a conforming implementation must
           also be providing fgetc as a function). This is
           undesirable because presumably the implementation was
           using the macro for a performance benefit, and we are
           dropping that optimization.
      
      Instead, we can simply use non-colliding names.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      49d6cfa5
  5. 13 7月, 2013 5 次提交
  6. 10 6月, 2013 1 次提交
  7. 07 5月, 2013 1 次提交
  8. 15 4月, 2013 1 次提交
    • J
      config: allow inaccessible configuration under $HOME · 4698c8fe
      Jonathan Nieder 提交于
      The changes v1.7.12.1~2^2~4 (config: warn on inaccessible files,
      2012-08-21) and v1.8.1.1~22^2~2 (config: treat user and xdg config
      permission problems as errors, 2012-10-13) were intended to prevent
      important configuration (think "[transfer] fsckobjects") from being
      ignored when the configuration is unintentionally unreadable (for
      example with EIO on a flaky filesystem, or with ENOMEM due to a DoS
      attack).  Usually ~/.gitconfig and ~/.config/git are readable by the
      current user, and if they aren't then it would be easy to fix those
      permissions, so the damage from adding this check should have been
      minimal.
      
      Unfortunately the access() check often trips when git is being run as
      a server.  A daemon (such as inetd or git-daemon) starts as "root",
      creates a listening socket, and then drops privileges, meaning that
      when git commands are invoked they cannot access $HOME and die with
      
       fatal: unable to access '/root/.config/git/config': Permission denied
      
      Any patch to fix this would have one of three problems:
      
        1. We annoy sysadmins who need to take an extra step to handle HOME
           when dropping privileges (the current behavior, or any other
           proposal that they have to opt into).
      
        2. We annoy sysadmins who want to set HOME when dropping privileges,
           either by making what they want to do impossible, or making them
           set an extra variable or option to accomplish what used to work
           (e.g., a patch to git-daemon to set HOME when --user is passed).
      
        3. We loosen the check, so some cases which might be noteworthy are
           not caught.
      
      This patch is of type (3).
      
      Treat user and xdg configuration that are inaccessible due to
      permissions (EACCES) as though no user configuration was provided at
      all.
      
      An alternative method would be to check if $HOME is readable, but that
      would not help in cases where the user who dropped privileges had a
      globally readable HOME with only .config or .gitconfig being private.
      
      This does not change the behavior when /etc/gitconfig or .git/config
      is unreadable (since those are more serious configuration errors),
      nor when ~/.gitconfig or ~/.config/git is unreadable due to problems
      other than permissions.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Improved-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4698c8fe
  9. 24 1月, 2013 1 次提交
  10. 23 1月, 2013 1 次提交
    • R
      Enable minimal stat checking · c08e4d5b
      Robin Rosenberg 提交于
      Specifically the fields uid, gid, ctime, ino and dev are set to zero
      by JGit. Other implementations, eg. Git in cygwin are allegedly also
      somewhat incompatible with Git For Windows and on *nix platforms
      the resolution of the timestamps may differ.
      
      Any stat checking by git will then need to check content, which may
      be very slow, particularly on Windows. Since mtime and size
      is typically enough we should allow the user to tell git to avoid
      checking these fields if they are set to zero in the index.
      
      This change introduces a core.checkstat config option where the
      the user can select to check all fields (default), or just size
      and the whole second part of mtime (minimal).
      Signed-off-by: NRobin Rosenberg <robin.rosenberg@dewire.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c08e4d5b
  11. 17 1月, 2013 1 次提交
    • J
      Allow custom "comment char" · eff80a9f
      Junio C Hamano 提交于
      Some users do want to write a line that begin with a pound sign, #,
      in their commit log message.  Many tracking system recognise
      a token of #<bugid> form, for example.
      
      The support we offer these use cases is not very friendly to the end
      users.  They have a choice between
      
       - Don't do it.  Avoid such a line by rewrapping or indenting; and
      
       - Use --cleanup=whitespace but remove all the hint lines we add.
      
      Give them a way to set a custom comment char, e.g.
      
          $ git -c core.commentchar="%" commit
      
      so that they do not have to do either of the two workarounds.
      
      [jc: although I started the topic, all the tests and documentation
      updates, many of the call sites of the new strbuf_add_commented_*()
      functions, and the change to git-submodule.sh scripted Porcelain are
      from Ralf.]
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NRalf Thielow <ralf.thielow@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      eff80a9f
  12. 16 12月, 2012 1 次提交
    • J
      silence some -Wuninitialized false positives · a469a101
      Jeff King 提交于
      There are a few error functions that simply wrap error() and
      provide a standardized message text. Like error(), they
      always return -1; knowing that can help the compiler silence
      some false positive -Wuninitialized warnings.
      
      One strategy would be to just declare these as inline in the
      header file so that the compiler can see that they always
      return -1. However, gcc does not always inline them (e.g.,
      it will not inline opterror, even with -O3), which renders
      our change pointless.
      
      Instead, let's follow the same route we did with error() in
      the last patch, and define a macro that makes the constant
      return value obvious to the compiler.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a469a101
  13. 13 12月, 2012 1 次提交
  14. 24 10月, 2012 1 次提交
    • J
      git-config: fix regexp memory leaks on error conditions · 97ed50f9
      Jeff King 提交于
      The get_value function has a goto label for cleaning up on
      errors, but it only cleans up half of what the function
      might allocate. Let's also clean up the key and regexp
      variables there.
      
      Note that we need to take special care when compiling the
      regex fails to clean it up ourselves, since it is in a
      half-constructed state (we would want to free it, but not
      regfree it).
      
      Similarly, we fix git_config_parse_key to return NULL when
      it fails, not a pointer to some already-freed memory.
      Signed-off-by: NJeff King <peff@peff.net>
      97ed50f9
  15. 15 10月, 2012 1 次提交
    • J
      config: exit on error accessing any config file · 8f2bbe45
      Jonathan Nieder 提交于
      There is convenience in warning and moving on when somebody has a
      bogus permissions on /etc/gitconfig and cannot do anything about it.
      But the cost in predictability and security is too high --- when
      unreadable config files are skipped, it means an I/O error or
      permissions problem causes important configuration to be bypassed.
      
      For example, servers may depend on /etc/gitconfig to enforce security
      policy (setting transfer.fsckObjects or receive.deny*).  Best to
      always error out when encountering trouble accessing a config file.
      
      This may add inconvenience in some cases:
      
        1. You are inspecting somebody else's repo, and you do not have
           access to their .git/config file.  Git typically dies in this
           case already since we cannot read core.repositoryFormatVersion,
           so the change should not be too noticeable.
      
        2. You have used "sudo -u" or a similar tool to switch uid, and your
           environment still points Git at your original user's global
           config, which is not readable.  In this case people really would
           be inconvenienced (they would rather see the harmless warning and
           continue the operation) but they can work around it by setting
           HOME appropriately after switching uids.
      
        3. You do not have access to /etc/gitconfig due to a broken setup.
           In this case, erroring out is a good way to put pressure on the
           sysadmin to fix the setup.  While they wait for a reply, users
           can set GIT_CONFIG_NOSYSTEM to true to keep Git working without
           complaint.
      
      After this patch, errors accessing the repository-local and systemwide
      config files and files requested in include directives cause Git to
      exit, just like errors accessing ~/.gitconfig.
      Explained-by: NJeff King <peff@peff.net>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Acked-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8f2bbe45
  16. 14 10月, 2012 1 次提交
    • J
      config: treat user and xdg config permission problems as errors · 96b9e0e3
      Jonathan Nieder 提交于
      Git reads multiple configuration files: settings come first from the
      system config file (typically /etc/gitconfig), then the xdg config
      file (typically ~/.config/git/config), then the user's dotfile
      (~/.gitconfig), then the repository configuration (.git/config).
      
      Git has always used access(2) to decide whether to use each file; as
      an unfortunate side effect, that means that if one of these files is
      unreadable (e.g., EPERM or EIO), git skips it.  So if I use
      ~/.gitconfig to override some settings but make a mistake and give it
      the wrong permissions then I am subject to the settings the sysadmin
      chose for /etc/gitconfig.
      
      Better to error out and ask the user to correct the problem.
      
      This only affects the user and xdg config files, since the user
      presumably has enough access to fix their permissions.  If the system
      config file is unreadable, the best we can do is to warn about it so
      the user knows to notify someone and get on with work in the meantime.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      96b9e0e3
  17. 02 10月, 2012 1 次提交
    • B
      Remove the hard coded length limit on variable names in config files · 0971e992
      Ben Walton 提交于
      Previously while reading the variable names in config files, there
      was a 256 character limit with at most 128 of those characters being
      used by the section header portion of the variable name.  This
      limitation was only enforced while reading the config files.  It was
      possible to write a config file that was not subsequently readable.
      
      Instead of enforcing this limitation for both reading and writing,
      remove it entirely by changing the var member of the config_file
      struct to a strbuf instead of a fixed length buffer.  Update all of
      the parsing functions in config.c to use the strbuf instead of the
      static buffer.
      
      The parsing functions that returned the base length of the variable
      name now return simply 0 for success and -1 for failure.  The base
      length information is obtained through the strbuf's len member.
      
      We now send the buf member of the strbuf to external callback
      functions to preserve the external api.  None of the external
      callers rely on the old size limitation for sizing their own buffers
      so removing the limit should have no externally visible effect.
      Signed-off-by: NBen Walton <bdwalton@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0971e992
  18. 22 8月, 2012 1 次提交
    • J
      config: warn on inaccessible files · ba8bd830
      Jeff King 提交于
      Before reading a config file, we check "!access(path, R_OK)"
      to make sure that the file exists and is readable. If it's
      not, then we silently ignore it.
      
      For the case of ENOENT, this is fine, as the presence of the
      file is optional. For other cases, though, it may indicate a
      configuration error (e.g., not having permissions to read
      the file). Let's print a warning in these cases to let the
      user know.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ba8bd830
  19. 17 7月, 2012 1 次提交
  20. 09 7月, 2012 1 次提交
    • T
      git on Mac OS and precomposed unicode · 76759c7d
      Torsten Bögershausen 提交于
      Mac OS X mangles file names containing unicode on file systems HFS+,
      VFAT or SAMBA.  When a file using unicode code points outside ASCII
      is created on a HFS+ drive, the file name is converted into
      decomposed unicode and written to disk. No conversion is done if
      the file name is already decomposed unicode.
      
      Calling open("\xc3\x84", ...) with a precomposed "Ä" yields the same
      result as open("\x41\xcc\x88",...) with a decomposed "Ä".
      
      As a consequence, readdir() returns the file names in decomposed
      unicode, even if the user expects precomposed unicode.  Unlike on
      HFS+, Mac OS X stores files on a VFAT drive (e.g. an USB drive) in
      precomposed unicode, but readdir() still returns file names in
      decomposed unicode.  When a git repository is stored on a network
      share using SAMBA, file names are send over the wire and written to
      disk on the remote system in precomposed unicode, but Mac OS X
      readdir() returns decomposed unicode to be compatible with its
      behaviour on HFS+ and VFAT.
      
      The unicode decomposition causes many problems:
      
      - The names "git add" and other commands get from the end user may
        often be precomposed form (the decomposed form is not easily input
        from the keyboard), but when the commands read from the filesystem
        to see what it is going to update the index with already is on the
        filesystem, readdir() will give decomposed form, which is different.
      
      - Similarly "git log", "git mv" and all other commands that need to
        compare pathnames found on the command line (often but not always
        precomposed form; a command line input resulting from globbing may
        be in decomposed) with pathnames found in the tree objects (should
        be precomposed form to be compatible with other systems and for
        consistency in general).
      
      - The same for names stored in the index, which should be
        precomposed, that may need to be compared with the names read from
        readdir().
      
      NFS mounted from Linux is fully transparent and does not suffer from
      the above.
      
      As Mac OS X treats precomposed and decomposed file names as equal,
      we can
      
       - wrap readdir() on Mac OS X to return the precomposed form, and
      
       - normalize decomposed form given from the command line also to the
         precomposed form,
      
      to ensure that all pathnames used in Git are always in the
      precomposed form.  This behaviour can be requested by setting
      "core.precomposedunicode" configuration variable to true.
      
      The code in compat/precomposed_utf8.c implements basically 4 new
      functions: precomposed_utf8_opendir(), precomposed_utf8_readdir(),
      precomposed_utf8_closedir() and precompose_argv().  The first three
      are to wrap opendir(3), readdir(3), and closedir(3) functions.
      
      The argv[] conversion allows to use the TAB filename completion done
      by the shell on command line.  It tolerates other tools which use
      readdir() to feed decomposed file names into git.
      
      When creating a new git repository with "git init" or "git clone",
      "core.precomposedunicode" will be set "false".
      
      The user needs to activate this feature manually.  She typically
      sets core.precomposedunicode to "true" on HFS and VFAT, or file
      systems mounted via SAMBA.
      Helped-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NTorsten Bögershausen <tboegi@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      76759c7d
  21. 26 6月, 2012 1 次提交
  22. 23 5月, 2012 1 次提交
  23. 30 4月, 2012 1 次提交
  24. 26 4月, 2012 1 次提交
  25. 25 4月, 2012 1 次提交
    • M
      push: introduce new push.default mode "simple" · b55e6775
      Matthieu Moy 提交于
      When calling "git push" without argument, we want to allow Git to do
      something simple to explain and safe. push.default=matching is unsafe
      when used to push to shared repositories, and hard to explain to
      beginners in some contexts. It is debatable whether 'upstream' or
      'current' is the safest or the easiest to explain, so introduce a new
      mode called 'simple' that is the intersection of them: push to the
      upstream branch, but only if it has the same name remotely. If not, give
      an error that suggests the right command to push explicitely to
      'upstream' or 'current'.
      
      A question is whether to allow pushing when no upstream is configured. An
      argument in favor of allowing the push is that it makes the new mode work
      in more cases. On the other hand, refusing to push when no upstream is
      configured encourages the user to set the upstream, which will be
      beneficial on the next pull. Lacking better argument, we chose to deny
      the push, because it will be easier to change in the future if someone
      shows us wrong.
      Original-patch-by: NJeff King <peff@peff.net>
      Signed-off-by: NMatthieu Moy <Matthieu.Moy@imag.fr>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b55e6775
  26. 13 3月, 2012 1 次提交
  27. 17 2月, 2012 5 次提交
    • J
      config: add include directive · 9b25a0b5
      Jeff King 提交于
      It can be useful to split your ~/.gitconfig across multiple
      files. For example, you might have a "main" file which is
      used on many machines, but a small set of per-machine
      tweaks. Or you may want to make some of your config public
      (e.g., clever aliases) while keeping other data back (e.g.,
      your name or other identifying information). Or you may want
      to include a number of config options in some subset of your
      repos without copying and pasting (e.g., you want to
      reference them from the .git/config of participating repos).
      
      This patch introduces an include directive for config files.
      It looks like:
      
        [include]
          path = /path/to/file
      
      This is syntactically backwards-compatible with existing git
      config parsers (i.e., they will see it as another config
      entry and ignore it unless you are looking up include.path).
      
      The implementation provides a "git_config_include" callback
      which wraps regular config callbacks. Callers can pass it to
      git_config_from_file, and it will transparently follow any
      include directives, passing all of the discovered options to
      the real callback.
      
      Include directives are turned on automatically for "regular"
      git config parsing. This includes calls to git_config, as
      well as calls to the "git config" program that do not
      specify a single file (e.g., using "-f", "--global", etc).
      They are not turned on in other cases, including:
      
        1. Parsing of other config-like files, like .gitmodules.
           There isn't a real need, and I'd rather be conservative
           and avoid unnecessary incompatibility or confusion.
      
        2. Reading single files via "git config". This is for two
           reasons:
      
             a. backwards compatibility with scripts looking at
                config-like files.
      
             b. inspection of a specific file probably means you
      	  care about just what's in that file, not a general
                lookup for "do we have this value anywhere at
      	  all". If that is not the case, the caller can
      	  always specify "--includes".
      
        3. Writing files via "git config"; we want to treat
           include.* variables as literal items to be copied (or
           modified), and not expand them. So "git config
           --unset-all foo.bar" would operate _only_ on
           .git/config, not any of its included files (just as it
           also does not operate on ~/.gitconfig).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9b25a0b5
    • J
      config: eliminate config_exclusive_filename · 4a7bb5ba
      Jeff King 提交于
      This is a magic global variable that was intended as an
      override to the usual git-config lookup process. Once upon a
      time, you could specify GIT_CONFIG to any git program, and
      it would look only at that file. This turned out to be
      confusing and cause a lot of bugs for little gain. As a
      result, dc871831 (Only use GIT_CONFIG in "git config", not
      other programs, 2008-06-30) took this away for all callers
      except git-config.
      
      Since git-config no longer uses it either, the variable can
      just go away. As the diff shows, nobody was setting to
      anything except NULL, so we can just replace any sites where
      it was read with NULL.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4a7bb5ba
    • 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
  28. 02 12月, 2011 1 次提交