1. 06 9月, 2017 1 次提交
    • J
      config: use a static lock_file struct · f991761e
      Jeff King 提交于
      When modifying git config, we xcalloc() a struct lock_file
      but never free it. This is necessary because the tempfile
      code (upon which the locking code is built) requires that
      the resulting struct remain valid through the life of the
      program. However, it also confuses leak-checkers like
      valgrind because only the inner "struct tempfile" is still
      reachable; no pointer to the outer lock_file is kept.
      
      Other code paths solve this by using a single static lock
      struct. We can do the same here, because we know that we'll
      only lock and modify one config file at a time (and
      assertions within the lockfile code will ensure that this
      remains the case).
      
      That removes a real leak (when we fail to free the struct
      after locking fails) as well as removes the valgrind false
      positive. It also means that doing N sequential
      config-writes will use a constant amount of memory, rather
      than leaving stale lock_files for each.
      
      Note that since "lock" is no longer a pointer, it can't be
      NULL anymore. But that's OK. We used that feature only to
      avoid calling rollback_lock_file() on an already-committed
      lock. Since the lockfile code keeps its own "active" flag,
      it's a noop to rollback an inactive lock, and we don't have
      to worry about this ourselves.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f991761e
  2. 25 2月, 2017 2 次提交
    • J
      parse_config_key: allow matching single-level config · 48f8d9f7
      Jeff King 提交于
      The parse_config_key() function was introduced to make it
      easier to match "section.subsection.key" variables. It also
      handles the simpler "section.key", and the caller is
      responsible for distinguishing the two from its
      out-parameters.
      
      Most callers who _only_ want "section.key" would just use a
      strcmp(var, "section.key"), since there is no parsing
      required. However, they may still use parse_config_key() if
      their "section" variable isn't a constant (an example of
      this is in parse_hide_refs_config).
      
      Using the parse_config_key is a bit clunky, though:
      
        const char *subsection;
        int subsection_len;
        const char *key;
      
        if (!parse_config_key(var, section, &subsection, &subsection_len, &key) &&
            !subsection) {
      	  /* matched! */
        }
      
      Instead, let's treat a NULL subsection as an indication that
      the caller does not expect one. That lets us write:
      
        const char *key;
      
        if (!parse_config_key(var, section, NULL, NULL, &key)) {
      	  /* matched! */
        }
      
      Existing callers should be unaffected, as passing a NULL
      subsection would currently segfault.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      48f8d9f7
    • J
      parse_config_key: use skip_prefix instead of starts_with · e3394fdc
      Jeff King 提交于
      This saves us having to repeatedly add in "section_len" (and
      also avoids walking over the first part of the string
      multiple times for a strlen() and strrchr()).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e3394fdc
  3. 24 2月, 2017 2 次提交
    • J
      config: use git_config_parse_key() in git_config_parse_parameter() · 1274a155
      Junio C Hamano 提交于
      The parsing of one-shot assignments of configuration variables that
      come from the command line historically was quite loose and allowed
      anything to pass.  It also downcased everything in the variable name,
      even a three-level <section>.<subsection>.<variable> name in which
      the <subsection> part must be treated in a case sensitive manner.
      
      Existing git_config_parse_key() helper is used to parse the variable
      name that comes from the command line, i.e. "git config VAR VAL",
      and handles these details correctly.  Replace the strbuf_tolower()
      call in git_config_parse_parameter() with a call to it to correct
      both issues.  git_config_parse_key() does a bit more things that are
      not necessary for the purpose of this codepath (e.g. it allocates a
      separate buffer to return the canonicalized variable name because it
      takes a "const char *" input), but we are not in a performance-critical
      codepath here.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1274a155
    • J
      config: move a few helper functions up · ee98df3f
      Junio C Hamano 提交于
      git_config_parse_key() implements the validation and downcasing of
      <section> and <variable> in "<section>[.<subsection>].<variable>"
      configuration variable name.  Move it (and helpers it uses) a bit up
      so that it can be used by git_config_parse_parameter(), which is
      used to check configuration settings that are given on the command
      line (i.e. "git -c VAR=VAL cmd"), in a later patch.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ee98df3f
  4. 01 2月, 2017 1 次提交
    • C
      refs: add option core.logAllRefUpdates = always · 341fb286
      Cornelius Weig 提交于
      When core.logallrefupdates is true, we only create a new reflog for refs
      that are under certain well-known hierarchies. The reason is that we
      know that some hierarchies (like refs/tags) are not meant to change, and
      that unknown hierarchies might not want reflogs at all (e.g., a
      hypothetical refs/foo might be meant to change often and drop old
      history immediately).
      
      However, sometimes it is useful to override this decision and simply log
      for all refs, because the safety and audit trail is more important than
      the performance implications of keeping the log around.
      
      This patch introduces a new "always" mode for the core.logallrefupdates
      option which will log updates to everything under refs/, regardless
      where in the hierarchy it is (we still will not log things like
      ORIG_HEAD and FETCH_HEAD, which are known to be transient).
      Based-on-patch-by: NJeff King <peff@peff.net>
      Signed-off-by: NCornelius Weig <cornelius.weig@tngtech.com>
      Reviewed-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      341fb286
  5. 23 12月, 2016 3 次提交
  6. 21 12月, 2016 2 次提交
  7. 16 11月, 2016 1 次提交
    • J
      compression: unify pack.compression configuration parsing · 8de7eeb5
      Junio C Hamano 提交于
      There are three codepaths that use a variable whose name is
      pack_compression_level to affect how objects and deltas sent to a
      packfile is compressed.  Unlike zlib_compression_level that controls
      the loose object compression, however, this variable was static to
      each of these codepaths.  Two of them read the pack.compression
      configuration variable, using core.compression as the default, and
      one of them also allowed overriding it from the command line.
      
      The other codepath in bulk-checkin did not pay any attention to the
      configuration.
      
      Unify the configuration parsing to git_default_config(), where we
      implement the parsing of core.loosecompression and core.compression
      and make the former override the latter, by moving code to parse
      pack.compression and also allow core.compression to give default to
      this variable.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8de7eeb5
  8. 28 9月, 2016 1 次提交
    • J
      get_short_sha1: make default disambiguation configurable · 5b33cb1f
      Jeff King 提交于
      When we find ambiguous short sha1s, we may get a
      disambiguation rule from our caller's context. But if we
      don't, we fall back to treating all sha1s the same, even
      though most projects will tend to refer only to commits by
      their short sha1s.
      
      This patch introduces a configuration option that lets the
      user pick a different fallback (e.g., only commits). It's
      possible that we may want to make this the default, but it's
      a good idea to start as a config option for two reasons:
      
        1. It lets people experiment with this and see if it's a
           good idea (i.e., the "tend to" above is an assumption;
           we don't really know if this will break some obscure
           cases).
      
        2. Even if we do flip the default, it gives people an
           escape hatch if it causes problems (you can sometimes
           override it by asking for "1234^{tree}", but not all
           combinations are possible).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5b33cb1f
  9. 14 9月, 2016 2 次提交
    • J
      config: only read .git/config from configured repos · b9605bc4
      Jeff King 提交于
      When git_config() runs, it looks in the system, user-wide,
      and repo-level config files. It gets the latter by calling
      git_pathdup(), which in turn calls get_git_dir(). If we
      haven't set up the git repository yet, this may simply
      return ".git", and we will look at ".git/config".  This
      seems like it would be helpful (presumably we haven't set up
      the repository yet, so it tries to find it), but it turns
      out to be a bad idea for a few reasons:
      
        - it's not sufficient, and therefore hides bugs in a
          confusing way. Config will be respected if commands are
          run from the top-level of the working tree, but not from
          a subdirectory.
      
        - it's not always true that we haven't set up the
          repository _yet_; we may not want to do it at all. For
          instance, if you run "git init /some/path" from inside
          another repository, it should not load config from the
          existing repository.
      
        - there might be a path ".git/config", but it is not the
          actual repository we would find via setup_git_directory().
          This may happen, e.g., if you are storing a git
          repository inside another git repository, but have
          munged one of the files in such a way that the
          inner repository is not valid (e.g., by removing HEAD).
      
      We have at least two bugs of the second type in git-init,
      introduced by ae5f6776 (lazily load core.sharedrepository,
      2016-03-11). It causes init to use git_configset(), which
      loads all of the config, including values from the current
      repo (if any).  This shows up in two ways:
      
        1. If we happen to be in an existing repository directory,
           we'll read and respect core.sharedrepository from it,
           even though it should have no bearing on the new
           repository. A new test in t1301 covers this.
      
        2. Similarly, if we're in an existing repo that sets
           core.logallrefupdates, that will cause init to fail to
           set it in a newly created repository (because it thinks
           that the user's templates already did so). A new test
           in t0001 covers this.
      
      We also need to adjust an existing test in t1302, which
      gives another example of why this patch is an improvement.
      
      That test creates an embedded repository with a bogus
      core.repositoryformatversion of "99". It wants to make sure
      that we actually stop at the bogus repo rather than
      continuing upward to find the outer repo. So it checks that
      "git config core.repositoryformatversion" returns 99. But
      that only works because we blindly read ".git/config", even
      though we _know_ we're in a repository whose vintage we do
      not understand.
      
      After this patch, we avoid reading config from the unknown
      vintage repository at all, which is a safer choice.  But we
      need to tweak the test, since core.repositoryformatversion
      will not return 99; it will claim that it could not find the
      variable at all.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b9605bc4
    • J
      pager: stop loading git_default_config() · 4babb839
      Jeff King 提交于
      In git_pager(), we really only care about getting the value
      of core.pager. But to do so, we use the git_default_config()
      callback, which loads many other values. Ordinarily it
      isn't a big deal to load this config an extra time, as it
      simply overwrites the values from the previous run. But it's
      a bad idea here, for two reasons:
      
        1. The pager setup may be called very early in the
           program, before we have found the git repository. As a
           result, we may fail to read the correct repo-level
           config file.  This is a problem for core.pager, too,
           but we should at least try to minimize the pollution to
           other configured values.
      
        2. Because we call setup_pager() from git.c, basically
           every builtin command _may_ end up reading this config
           and getting an implicit git_default_config() setup.
      
           Which doesn't sound like a terrible thing, except that
           we don't do it consistently; it triggers only when
           stdout is a tty. So if a command forgets to load the
           default config itself (but depends on it anyway), it
           may appear to work, and then mysteriously fail when the
           pager is not in use.
      
      We can improve this by loading _just_ the core.pager config
      from git_pager().
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4babb839
  10. 24 8月, 2016 1 次提交
  11. 29 7月, 2016 1 次提交
    • V
      i18n: config: unfold error messages marked for translation · 1b8132d9
      Vasco Almeida 提交于
      Introduced in 473166b9 ("config: add 'origin_type' to config_source
      struct", 2016-02-19), Git can inform the user about the origin of a
      config error, but the implementation does not allow translators to
      translate the keywords 'file', 'blob, 'standard input', and
      'submodule-blob'. Moreover, for the second message, a reason for the
      error is appended to the message, not allowing translators to translate
      that reason either.
      
      Unfold the message into several templates for each known origin_type.
      That would result in better translation at the expense of code
      verbosity.
      
      Add enum config_oringin_type to ease management of the various
      configuration origin types (blob, file, etc).  Previously origin type
      was considered from command line if cf->origin_type == NULL, i.e.,
      uninitialized. Now we set origin_type to CONFIG_ORIGIN_CMDLINE in
      git_config_from_parameters() and configset_add_value().
      
      For error message in git_parse_source(), use xstrfmt() function to
      prepare the message string, instead of doing something like it's done
      for die_bad_number(), because intelligibility and code conciseness are
      improved for that instance.
      Signed-off-by: NVasco Almeida <vascomalmeida@sapo.pt>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1b8132d9
  12. 11 6月, 2016 1 次提交
  13. 28 5月, 2016 2 次提交
    • J
      config: add a notion of "scope" · 9acc5911
      Jeff King 提交于
      A config callback passed to git_config() doesn't know very
      much about the context in which it sees a variable. It can
      ask whether the variable comes from a file, and get the file
      name. But without analyzing the filename (which is hard to
      do accurately), it cannot tell whether it is in system-level
      config, user-level config, or repo-specific config.
      
      Generally this doesn't matter; the point of not passing this
      to the callback is that it should treat the config the same
      no matter where it comes from. But some programs, like
      upload-pack, are a special case: we should be able to run
      them in an untrusted repository, which means we cannot use
      any "dangerous" config from the repository config file (but
      it is OK to use it from system or user config).
      
      This patch teaches the config code to record the "scope" of
      each variable, and make it available inside config
      callbacks, similar to how we give access to the filename.
      The scope is the starting source for a particular parsing
      operation, and remains the same even if we include other
      files (so a .git/config which includes another file will
      remain CONFIG_SCOPE_REPO, as it would be similarly
      untrusted).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9acc5911
    • J
      config: return configset value for current_config_ functions · 0d44a2da
      Jeff King 提交于
      When 473166b9 (config: add 'origin_type' to config_source
      struct, 2016-02-19) added accessor functions for the origin
      type and name, it taught them only to look at the "cf"
      struct that is filled in while we are parsing the config.
      This is sufficient to make it work with git-config, which
      uses git_config_with_options() under the hood. That function
      freshly parses the config files and triggers the callback
      when it parses each key.
      
      Most git programs, however, use git_config(). This interface
      will populate a cache during the actual parse, and then
      serve values from the cache. Calling current_config_filename()
      in a callback here will find a NULL cf and produce an error.
      There are no such callers right now, but let's prepare for
      adding some by making this work.
      
      We already record source information in a struct attached to
      each value. We just need to make it globally available and
      then consult it from the accessor functions.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0d44a2da
  14. 25 5月, 2016 3 次提交
    • J
      config: set up config_source for command-line config · 3258258f
      Jeff King 提交于
      When we parse a config file, we set up the global "cf"
      variable as a pointer to a "struct config_source" describing
      the file we are parsing. This is used for error messages, as
      well as for lookup functions like current_config_name().
      
      The "cf" variable is NULL in two cases:
      
        1. When we are parsing command-line config, in which case
           there is no source file.
      
        2. When we are not parsing any config at all.
      
      Callers like current_config_name() must assume we are in
      case 1 if they see a NULL "cf". However, this means that if
      they are accidentally used outside of a config parsing
      callback, they will quietly return a bogus answer.
      
      This might seem like an unlikely accident (why would you ask
      for the current config file if you are not parsing config?),
      but it's actually an easy mistake to make due to the
      configset caching. git_config() serves the answers from a
      configset cache, and any calls to current_config_name() will
      claim that we are parsing command-line config, no matter
      what the original source.
      
      So let's distinguish these cases by having the command-line
      config parser set up a config_source with a NULL name (which
      callers already handle properly). We can use this to catch
      programming errors in some cases, and to give better
      messages to the user in others.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3258258f
    • J
      git_config_parse_parameter: refactor cleanup code · a77d6db6
      Jeff King 提交于
      We have several exits from the function, each of which has
      to do some cleanup. Let's consolidate these in an "out"
      label we can jump to. This doesn't save us much now, but it
      will help as we add more things that need cleanup.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a77d6db6
    • J
      git_config_with_options: drop "found" counting · c72ee44b
      Jeff King 提交于
      Prior to 1f2baa78 (config: treat non-existent config files as
      empty, 2010-10-21), we returned an error if any config files
      were missing. That commit made this a non-error, but
      returned the number of sources found, in case any caller
      wanted to distinguish this case.
      
      In the past 5+ years, no caller has; the only two places
      which bother to check the return value care only about the
      error case.  Let's drop this code, which complicates the
      function. Similarly, let's drop the "found anything" return
      from git_config_from_parameters, which was present only to
      support this (and similarly has never had other callers care
      for the past 5+ years).
      
      Note that we do need to update a comment in one of the
      callers, even though the code immediately below it doesn't
      care about this case.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c72ee44b
  15. 12 5月, 2016 1 次提交
    • J
      mingw: introduce the 'core.hideDotFiles' setting · f30afdab
      Johannes Schindelin 提交于
      On Unix (and Linux), files and directories whose names start with a dot
      are usually not shown by default. This convention is used by Git: the
      .git/ directory should be left alone by regular users, and only accessed
      through Git itself.
      
      On Windows, no such convention exists. Instead, there is an explicit flag
      to mark files or directories as hidden.
      
      In the early days, Git for Windows did not mark the .git/ directory (or
      for that matter, any file or directory whose name starts with a dot)
      hidden. This lead to quite a bit of confusion, and even loss of data.
      
      Consequently, Git for Windows introduced the core.hideDotFiles setting,
      with three possible values: true, false, and dotGitOnly, defaulting to
      marking only the .git/ directory as hidden.
      
      The rationale: users do not need to access .git/ directly, and indeed (as
      was demonstrated) should not really see that directory, either. However,
      not all dot files should be hidden by default, as e.g. Eclipse does not
      show them (and the user would therefore be unable to see, say, a
      .gitattributes file).
      
      In over five years since the last attempt to bring this patch into core
      Git, a slightly buggy version of this patch has served Git for Windows'
      users well: no single report indicated problems with the hidden .git/
      directory, and the stream of problems caused by the previously non-hidden
      .git/ directory simply stopped. The bugs have been fixed during the
      process of getting this patch upstream.
      
      Note that there is a funny quirk we have to pay attention to when
      creating hidden files: we use Win32's _wopen() function which
      transmogrifies its arguments and hands off to Win32's CreateFile()
      function. That latter function errors out with ERROR_ACCESS_DENIED (the
      equivalent of EACCES) when the equivalent of the O_CREAT flag was passed
      and the file attributes (including the hidden flag) do not match an
      existing file's. And _wopen() accepts no parameter that would be
      transmogrified into said hidden flag. Therefore, we simply try again
      without O_CREAT.
      
      A slightly different method is required for our fopen()/freopen()
      function as we cannot even *remove* the implicit O_CREAT flag.
      Therefore, we briefly mark existing files as unhidden when opening them
      via fopen()/freopen().
      
      The ERROR_ACCESS_DENIED error can also be triggered by opening a file
      that is marked as a system file (which is unlikely to be tracked in
      Git), and by trying to create a file that has *just* been deleted and is
      awaiting the last open handles to be released (which would be handled
      better by the "Try again?" logic, a story for a different patch series,
      though). In both cases, it does not matter much if we try again without
      the O_CREAT flag, read: it does not hurt, either.
      
      For details how ERROR_ACCESS_DENIED can be triggered, see
      https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858Original-patch-by: NErik Faye-Lund <kusmabite@gmail.com>
      Initial-Test-By: NPat Thoyts <patthoyts@users.sourceforge.net>
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f30afdab
  16. 10 5月, 2016 1 次提交
  17. 05 5月, 2016 1 次提交
    • Æ
      hooks: allow customizing where the hook directory is · 867ad08a
      Ævar Arnfjörð Bjarmason 提交于
      Change the hardcoded lookup for .git/hooks/* to optionally lookup in
      $(git config core.hooksPath)/* instead.
      
      This is essentially a more intrusive version of the git-init ability to
      specify hooks on init time via init templates.
      
      The difference between that facility and this feature is that this can
      be set up after the fact via e.g. ~/.gitconfig or /etc/gitconfig to
      apply for all your personal repositories, or all repositories on the
      system.
      
      I plan on using this on a centralized Git server where users can create
      arbitrary repositories under /gitroot, but I'd like to manage all the
      hooks that should be run centrally via a unified dispatch mechanism.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      867ad08a
  18. 29 4月, 2016 1 次提交
  19. 26 4月, 2016 1 次提交
  20. 11 4月, 2016 3 次提交
    • J
      git_config_set_multivar_in_file: handle "unset" errors · 1cae428e
      Jeff King 提交于
      We pass off to the "_gently" form to do the real work, and
      just die() if it returned an error. However, our die message
      de-references "value", which may be NULL if the request was
      to unset a variable. Nobody using glibc noticed, because it
      simply prints "(null)", which is good enough for the test
      suite (and presumably very few people run across this in
      practice). But other libc implementations (like Solaris) may
      segfault.
      
      Let's not only fix that, but let's make the message more
      clear about what is going on in the "unset" case.
      Reported-by: N"Tom G. Christensen" <tgc@jupiterrise.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1cae428e
    • J
      git_config_set_multivar_in_file: all non-zero returns are errors · 9c14bb08
      Jeff King 提交于
      This function is just a thin wrapper for the "_gently" form
      of the function. But the gently form is designed to feed
      builtin/config.c, which passes our return code directly to
      its exit status, and thus uses positive error values for
      some cases. We check only negative values, meaning we would
      fail to die in some cases (e.g., a malformed key).
      
      This may or may not be triggerable in practice; we tend to
      use this non-gentle form only when setting internal
      variables, which would not have malformed keys.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9c14bb08
    • J
      config: lower-case first word of error strings · 8c3ca351
      Jeff King 提交于
      This follows our usual style (both throughout git, and
      throughout the rest of this file).
      
      This covers the whole file, but note that I left the capitalization in
      the multi-sentence:
      
        error: malformed value...
        error: Must be one of ...
      
      because it helps make it clear that we are starting a new sentence in
      the second one.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8c3ca351
  21. 24 3月, 2016 1 次提交
    • J
      git_config_push_parameter: handle empty GIT_CONFIG_PARAMETERS · d1f88498
      Jeff King 提交于
      The "git -c var=value" option stuffs the config value into
      $GIT_CONFIG_PARAMETERS, so that sub-processes can see it.
      When the config is later read via git_config() or similar,
      we parse it back out of that variable.  The parsing end is a
      little bit picky; it assumes that each entry was generated
      with sq_quote_buf(), and that there is no extraneous
      whitespace.
      
      On the generating end, we are careful to append to an
      existing $GIT_CONFIG_PARAMETERS variable if it exists.
      However, our test for "should we add a space separator" is
      too liberal: it will add one even if the environment
      variable exists but is empty. As a result, you might end up
      with:
      
         GIT_CONFIG_PARAMETERS=" 'core.foo=bar'"
      
      which the parser will choke on.
      
      This was hard to trigger in older versions of git, since we
      only set the variable when we had something to put into it
      (though you could certainly trigger it manually). But since
      14111fc4 (git: submodule honor -c credential.* from command
      line, 2016-02-29), the submodule code will unconditionally
      put the $GIT_CONFIG_PARAMETERS variable into the environment
      of any operation in the submodule, whether it is empty or
      not. So any of those operations which themselves use "git
      -c" will generate the unparseable value and fail.
      
      We can easily fix it by catching this case on the generating
      side. While we're adding a test, let's also check that
      multiple layers of "git -c" work, which was previously not
      tested at all.
      Reported-by: NShin Fan <shinfan@google.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Reviewed-by: NJonathan Nieder <jrnieder@gmail.com>
      Tested-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d1f88498
  22. 12 3月, 2016 1 次提交
  23. 23 2月, 2016 4 次提交
  24. 20 2月, 2016 1 次提交
  25. 17 2月, 2016 1 次提交
    • P
      config: introduce set_or_die wrappers · b4c8aba6
      Patrick Steinhardt 提交于
      A lot of call-sites for the existing family of `git_config_set`
      functions do not check for errors that may occur, e.g. when the
      configuration file is locked. In many cases we simply want to die
      when such a situation arises.
      
      Introduce wrappers that will cause the program to die in those
      cases. These wrappers are temporary only to ease the transition
      to let `git_config_set` die by default. They will be removed
      later on when `git_config_set` itself has been replaced by
      `git_config_set_gently`.
      Signed-off-by: NPatrick Steinhardt <ps@pks.im>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b4c8aba6
  26. 28 1月, 2016 1 次提交