1. 11 4月, 2016 18 次提交
  2. 12 3月, 2016 10 次提交
    • J
      verify_repository_format: mark messages for translation · 274db840
      Jeff King 提交于
      These messages are human-readable and should be translated.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      274db840
    • J
      setup: drop repository_format_version global · c90e5293
      Jeff King 提交于
      Nobody reads this anymore, and they're not likely to; the
      interesting thing is whether or not we passed
      check_repository_format(), and possibly the individual
      "extension" variables.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c90e5293
    • J
      setup: unify repository version callbacks · 652f18ee
      Jeff King 提交于
      Once upon a time, check_repository_format_gently would parse
      the config with a single callback, and that callback would
      set up a bunch of global variables. But now that we have
      separate workdirs, we have to be more careful. Commit
      31e26ebc (setup.c: support multi-checkout repo setup,
      2014-11-30) introduced a reduced callback which omits some
      values like core.worktree. In the "main" callback we call
      the reduced one, and then add back in the missing variables.
      
      Now that we have split the config-parsing from the munging
      of the global variables, we can do it all with a single
      callback, and keep all of the "are we in a separate workdir"
      logic together.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      652f18ee
    • J
      init: use setup.c's repo version verification · 94ce1672
      Jeff King 提交于
      We check our templates to make sure they are from a
      version of git we understand (otherwise we would init a
      repository we cannot ourselves run in!). But our simple
      integer check has fallen behind the times. Let's use the
      helpers that setup.c provides to do it right.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      94ce1672
    • J
      setup: refactor repo format reading and verification · 2cc7c2c7
      Jeff King 提交于
      When we want to know if we're in a git repository of
      reasonable vintage, we can call check_repository_format_gently(),
      which does three things:
      
        1. Reads the config from the .git/config file.
      
        2. Verifies that the version info we read is sane.
      
        3. Writes some global variables based on this.
      
      There are a few things we could improve here.
      
      One is that steps 1 and 3 happen together. So if the
      verification in step 2 fails, we still clobber the global
      variables. This is especially bad if we go on to try another
      repository directory; we may end up with a state of mixed
      config variables.
      
      The second is there's no way to ask about the repository
      version for anything besides the main repository we're in.
      git-init wants to do this, and it's possible that we would
      want to start doing so for submodules (e.g., to find out
      which ref backend they're using).
      
      We can improve both by splitting the first two steps into
      separate functions. Now check_repository_format_gently()
      calls out to steps 1 and 2, and does 3 only if step 2
      succeeds.
      
      Note that the public interface for read_repository_format()
      and what check_repository_format_gently() needs from it are
      not quite the same, leading us to have an extra
      read_repository_format_1() helper. The extra needs from
      check_repository_format_gently() will go away in a future
      patch, and we can simplify this then to just the public
      interface.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2cc7c2c7
    • J
      config: drop git_config_early · 80181868
      Jeff King 提交于
      There are no more callers, and it's a rather confusing
      interface. This could just be folded into
      git_config_with_options(), but for the sake of readability,
      we'll leave it as a separate (static) helper function.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      80181868
    • J
      check_repository_format_gently: stop using git_config_early · 21627f9b
      Jeff King 提交于
      There's a chicken-and-egg problem with using the regular
      git_config during the repository setup process. We get
      around it here by using a special interface that lets us
      specify the per-repo config, and avoid calling
      git_pathdup().
      
      But this interface doesn't actually make sense. It will look
      in the system and per-user config, too; we definitely would
      not want to accept a core.repositoryformatversion from
      there.
      
      The git_config_from_file interface is a better match, as it
      lets us look at a single file.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      21627f9b
    • J
      lazily load core.sharedrepository · ae5f6776
      Jeff King 提交于
      The "shared_repository" config is loaded as part of
      check_repository_format_version, but it's not quite like the
      other values we check there. Something like
      core.repositoryformatversion only makes sense in per-repo
      config, but core.sharedrepository can be set in a per-user
      config (e.g., to make all "git init" invocations shared by
      default).
      
      So it would make more sense as part of git_default_config.
      Commit 457f06d6 (Introduce core.sharedrepository, 2005-12-22)
      says:
      
        [...]the config variable is set in the function which
        checks the repository format. If this were done in
        git_default_config instead, a lot of programs would need
        to be modified to call git_config(git_default_config)
        first.
      
      This is still the case today, but we have one extra trick up
      our sleeve. Now that we have the git_configset
      infrastructure, it's not so expensive for us to ask for a
      single value. So we can simply lazy-load it on demand.
      
      This should be OK to do in general. There are some problems
      with loading config before setup_git_directory() is called,
      but we shouldn't be accessing the value before then (if we
      were, then it would already be broken, as the variable would
      not have been set by check_repository_format_version!). The
      trickiest caller is git-init, but it handles the values
      manually itself.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ae5f6776
    • J
      wrap shared_repository global in get/set accessors · 7875acb6
      Jeff King 提交于
      It would be useful to control access to the global
      shared_repository, so that we can lazily load its config.
      The first step to doing so is to make sure all access
      goes through a set of functions.
      
      This step is purely mechanical, and should result in no
      change of behavior.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7875acb6
    • J
      setup: document check_repository_format() · 4b0d1eeb
      Jeff King 提交于
      This function's interface is rather enigmatic, so let's
      document it further.
      
      While we're here, let's also drop the return value. It will
      always either be "0" or the function will die (consequently,
      neither of its two callers bothered to check the return).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4b0d1eeb
  3. 05 3月, 2016 11 次提交
  4. 04 3月, 2016 1 次提交