1. 31 10月, 2018 1 次提交
  2. 11 10月, 2018 1 次提交
    • B
      config: add new index.threads config setting · c780b9cf
      Ben Peart 提交于
      Add support for a new index.threads config setting which will be used to
      control the threading code in do_read_index().  A value of 0 will tell the
      index code to automatically determine the correct number of threads to use.
      A value of 1 will make the code single threaded.  A value greater than 1
      will set the maximum number of threads to use.
      
      For testing purposes, this setting can be overwritten by setting the
      GIT_TEST_INDEX_THREADS=<n> environment variable to a value greater than 0.
      Signed-off-by: NBen Peart <benpeart@microsoft.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c780b9cf
  3. 29 9月, 2018 1 次提交
    • B
      fsmonitor: update GIT_TEST_FSMONITOR support · 4cb54d0a
      Ben Peart 提交于
      Rename GIT_FSMONITOR_TEST to GIT_TEST_FSMONITOR for consistency with the
      other GIT_TEST_ special setups and properly document its use.
      
      Add logic in t/test-lib.sh to give a warning when the old variable is set to
      let people know they need to update their environment to use the new
      variable.
      
      Remove the outdated instructions on how to run the test suite utilizing
      fsmonitor now that it is properly documented in t/README.
      Signed-off-by: NBen Peart <Ben.Peart@microsoft.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4cb54d0a
  4. 24 8月, 2018 1 次提交
  5. 16 8月, 2018 1 次提交
  6. 09 8月, 2018 1 次提交
    • S
      config: fix case sensitive subsection names on writing · 2d84f13d
      Stefan Beller 提交于
      A user reported a submodule issue regarding a section mix-up,
      but it could be boiled down to the following test case:
      
        $ git init test  && cd test
        $ git config foo."Bar".key test
        $ git config foo."bar".key test
        $ tail -n 3 .git/config
        [foo "Bar"]
              key = test
              key = test
      
      Sub sections are case sensitive and we have a test for correctly reading
      them. However we do not have a test for writing out config correctly with
      case sensitive subsection names, which is why this went unnoticed in
      6ae996f2 (git_config_set: make use of the config parser's event
      stream, 2018-04-09)
      
      Unfortunately we have to make a distinction between old style configuration
      that looks like
      
        [foo.Bar]
              key = test
      
      and the new quoted style as seen above. The old style is documented as
      case-agnostic, hence we need to keep 'strncasecmp'; although the
      resulting setting for the old style config differs from the configuration.
      That will be fixed in a follow up patch.
      Reported-by: NJP Sugarbroad <jpsugar@google.com>
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2d84f13d
  7. 24 7月, 2018 2 次提交
  8. 19 7月, 2018 1 次提交
    • J
      add core.usereplacerefs config option · da4398d6
      Jeff King 提交于
      We can already disable replace refs using a command line
      option or environment variable, but those are awkward to
      apply universally. Let's add a config option to do the same
      thing.
      
      That raises the question of why one might want to do so
      universally. The answer is that replace refs violate the
      immutability of objects. For instance, if you wanted to
      cache the diff between commit XYZ and its parent, then in
      theory that never changes; the hash XYZ represents the total
      state. But replace refs violate that; pushing up a new ref
      may create a completely new diff.
      
      The obvious "if it hurts, don't do it" answer is not to
      create replace refs if you're doing this kind of caching.
      But for a site hosting arbitrary repositories, they may want
      to allow users to share replace refs with each other, but
      not actually respect them on the site (because the caching
      is more important than the replace feature).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      da4398d6
  9. 18 7月, 2018 1 次提交
    • J
      commit-graph: add repo arg to graph readers · dade47c0
      Jonathan Tan 提交于
      Add a struct repository argument to the functions in commit-graph.h that
      read the commit graph. (This commit does not affect functions that write
      commit graphs.)
      
      Because the commit graph functions can now read the commit graph of any
      repository, the global variable core_commit_graph has been removed.
      Instead, the config option core.commitGraph is now read on the first
      time in a repository that a commit is attempted to be parsed using its
      commit graph.
      
      This commit includes a test that exercises the functionality on an
      arbitrary repository that is not the_repository.
      Signed-off-by: NJonathan Tan <jonathantanmy@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dade47c0
  10. 04 7月, 2018 3 次提交
  11. 27 6月, 2018 1 次提交
  12. 12 6月, 2018 2 次提交
  13. 29 5月, 2018 1 次提交
  14. 21 5月, 2018 3 次提交
  15. 18 5月, 2018 1 次提交
  16. 16 5月, 2018 1 次提交
    • S
      object-store: move object access functions to object-store.h · cbd53a21
      Stefan Beller 提交于
      This should make these functions easier to find and cache.h less
      overwhelming to read.
      
      In particular, this moves:
      - read_object_file
      - oid_object_info
      - write_object_file
      
      As a result, most of the codebase needs to #include object-store.h.
      In this patch the #include is only added to files that would fail to
      compile otherwise.  It would be better to #include wherever
      identifiers from the header are used.  That can happen later
      when we have better tooling for it.
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cbd53a21
  17. 06 5月, 2018 1 次提交
    • J
      Replace all die("BUG: ...") calls by BUG() ones · 033abf97
      Johannes Schindelin 提交于
      In d8193743 (usage.c: add BUG() function, 2017-05-12), a new macro
      was introduced to use for reporting bugs instead of die(). It was then
      subsequently used to convert one single caller in 588a538a
      (setup_git_env: convert die("BUG") to BUG(), 2017-05-12).
      
      The cover letter of the patch series containing this patch
      (cf 20170513032414.mfrwabt4hovujde2@sigill.intra.peff.net) is not
      terribly clear why only one call site was converted, or what the plan
      is for other, similar calls to die() to report bugs.
      
      Let's just convert all remaining ones in one fell swoop.
      
      This trick was performed by this invocation:
      
      	sed -i 's/die("BUG: /BUG("/g' $(git grep -l 'die("BUG' \*.c)
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      033abf97
  18. 24 4月, 2018 1 次提交
    • R
      push: colorize errors · 960786e7
      Ryan Dammrose 提交于
      This is an attempt to resolve an issue I experience with people that are
      new to Git -- especially colleagues in a team setting -- where they miss
      that their push to a remote location failed because the failure and
      success both return a block of white text.
      
      An example is if I push something to a remote repository and then a
      colleague attempts to push to the same remote repository and the push
      fails because it requires them to pull first, but they don't notice
      because a success and failure both return a block of white text. They
      then continue about their business, thinking it has been successfully
      pushed.
      
      This patch colorizes the errors and hints (in red and yellow,
      respectively) so whenever there is a failure when pushing to a remote
      repository that fails, it is more noticeable.
      
      [jes: fixed a couple bugs, added the color.{advice,push,transport}
      settings, refactored to use want_color_stderr().]
      
      Signed-off-by: Ryan Dammrose ryandammrose@gmail.com
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      960786e7
  19. 23 4月, 2018 1 次提交
  20. 16 4月, 2018 1 次提交
  21. 11 4月, 2018 2 次提交
  22. 09 4月, 2018 7 次提交
    • J
      git_config_set: reuse empty sections · c71d8bb3
      Johannes Schindelin 提交于
      It can happen quite easily that the last setting in a config section is
      removed, and to avoid confusion when there are comments in the config
      about that section, we keep a lone section header, i.e. an empty
      section.
      
      Now that we use the `event_fn` callback, it is easy to add support for
      re-using empty sections, so let's do that.
      
      Note: t5512-ls-remote requires that this change is applied *after* the
      patch "git config --unset: remove empty sections (in the common case)":
      without that patch, there would be empty `transfer` and `uploadpack`
      sections ready for reuse, but in the *wrong* order (and sconsequently,
      t5512's "overrides work between mixed transfer/upload-pack hideRefs"
      would fail).
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c71d8bb3
    • J
      git config --unset: remove empty sections (in the common case) · 22aedfcc
      Johannes Schindelin 提交于
      The original reasoning for not removing section headers upon removal of
      the last entry went like this: the user could have added comments about
      the section, or about the entries therein, and if there were other
      comments there, we would not know whether we should remove them.
      
      In particular, a concocted example was presented that looked like this
      (and was added to t1300):
      
      	# some generic comment on the configuration file itself
      	# a comment specific to this "section" section.
      	[section]
      	# some intervening lines
      	# that should also be dropped
      
      	key = value
      	# please be careful when you update the above variable
      
      The ideal thing for `git config --unset section.key` in this case would
      be to leave only the first line behind, because all the other comments
      are now obsolete.
      
      However, this is unfeasible, short of adding a complete Natural Language
      Processing module to Git, which seems not only a lot of work, but a
      totally unreasonable feature (for little benefit to most users).
      
      Now, the real kicker about this problem is: most users do not edit their
      config files at all! In their use case, the config looks like this
      instead:
      
      	[section]
      		key = value
      
      ... and it is totally obvious what should happen if the entry is
      removed: the entire section should vanish.
      
      Let's generalize this observation to this conservative strategy: if we
      are removing the last entry from a section, and there are no comments
      inside that section nor surrounding it, then remove the entire section.
      Otherwise behave as before: leave the now-empty section (including those
      comments, even ones about the now-deleted entry).
      
      We have to be extra careful to handle the case where more than one entry
      is removed: any subset of them might be the last entries of their
      respective sections (and if there are no comments in or around that
      section, the section should be removed, too).
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      22aedfcc
    • J
      git_config_set: make use of the config parser's event stream · 6ae996f2
      Johannes Schindelin 提交于
      In the recent commit with the title "config: introduce an optional event
      stream while parsing", we introduced an optional callback to keep track
      of the config parser's events "comment", "white-space", "section header"
      and "entry".
      
      One motivation for this feature was to make use of it in the code that
      edits the config. And this commit makes it so.
      
      Note: this patch changes the meaning of the `seen` array that records
      whether we saw the config entry that is to be edited: previously, it
      contained the end offset of the found entry. Now, we introduce a new
      array `parsed` that keeps a record of *all* config parser events (with
      begin/end offsets), and the items in the `seen` array now point into the
      `parsed` array.
      
      There are two reasons why we do it this way:
      
      1. To keep the implementation simple, the config parser's event stream
         reports the event only after the config callback was called, so we
         would not receive the begin offset otherwise.
      
      2. In the following patches, we will re-use the `parsed` array to fix two
         long-standing bugs related to empty sections.
      
      Note that this also makes the code more robust with respect to finding the
      begin offset of the part(s) of the config file to be edited, as we no
      longer back-track to find the beginning of the line.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6ae996f2
    • J
      git_config_set: do not use a state machine · 5221c315
      Johannes Schindelin 提交于
      While a neat theoretical construct, state machines are hard to read. In
      this instance, it does not even make a whole lot of sense because we are
      more interested in flags, anyway: has the section been seen? Has the key
      been seen? Does the current section match the key we are looking for?
      
      Besides, the state `SECTION_SEEN` was named in a misleading way: it did
      not indicate that we saw the section matching the key we are looking
      for, but it instead indicated that we are *currently* in that section.
      
      Let's just replace the state machine logic by clear and obvious flags.
      
      This will also make it easier to review the upcoming patches to use the
      newly-introduced `event_fn` callback of the config parser.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5221c315
    • J
      config_set_store: rename some fields for consistency · 668b9ade
      Johannes Schindelin 提交于
      The `seen` field is the actual length of the `offset` array, and the
      `offset_alloc` field records what was allocated (to avoid resizing
      wherever `seen` has to be incremented).
      
      Elsewhere, we use the convention `name` for the array, where `name` is
      descriptive enough to guess its purpose, `name_nr` for the actual length
      and `name_alloc` to record the maximum length without needing to resize.
      
      Let's make the names of the fields in question consistent with that
      convention.
      
      This will also help with the next steps where we will let the
      git_config_set() machinery use the config event stream that we just
      introduced.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      668b9ade
    • J
      config: avoid using the global variable `store` · fee8572c
      Johannes Schindelin 提交于
      It is much easier to reason about, when the config code to set/unset
      variables or to remove/rename sections does not rely on a global (or
      file-local) variable.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fee8572c
    • J
      config: introduce an optional event stream while parsing · 8032cc44
      Johannes Schindelin 提交于
      This extends our config parser so that it can optionally produce an event
      stream via callback function, where it reports e.g. when a comment was
      parsed, or a section header, etc.
      
      This parser will be used subsequently to handle the scenarios better where
      removing config entries would make sections empty, or where a new entry
      could be added to an already-existing, empty section.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8032cc44
  23. 06 4月, 2018 2 次提交
  24. 31 3月, 2018 1 次提交
    • J
      config: move flockfile() closer to unlocked functions · 05e293c1
      Jeff King 提交于
      Commit 260d408e (config: use getc_unlocked when reading
      from file, 2015-04-16) taught git_config_from_file() to lock
      the filehandle so that we could safely use the faster
      unlocked functions to access the handle.
      
      However, it split the logic into two places:
      
        1. The master lock/unlock happens in git_config_from_file().
      
        2. The decision to use the unlocked functions happens in
           do_config_from_file().
      
      That means that if anybody calls the latter function, they
      will accidentally use the unlocked functions without holding
      the lock. And indeed, git_config_from_stdin() does so.
      
      In practice, this hasn't been a problem since this code
      isn't generally multi-threaded (and even if some Git program
      happened to have another thread running, it's unlikely to be
      reading from stdin). But it's a good practice to make sure
      we're always holding the lock before using the unlocked
      functions.
      Helped-by: NJohannes Schindelin <Johannes.Schindelin@gmx.de>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      05e293c1
  25. 15 3月, 2018 1 次提交
    • B
      sha1_file: convert read_sha1_file to struct object_id · b4f5aca4
      brian m. carlson 提交于
      Convert read_sha1_file to take a pointer to struct object_id and rename
      it read_object_file.  Do the same for read_sha1_file_extended.
      
      Convert one use in grep.c to use the new function without any other code
      change, since the pointer being passed is a void pointer that is already
      initialized with a pointer to struct object_id.  Update the declaration
      and definitions of the modified functions, and apply the following
      semantic patch to convert the remaining callers:
      
      @@
      expression E1, E2, E3;
      @@
      - read_sha1_file(E1.hash, E2, E3)
      + read_object_file(&E1, E2, E3)
      
      @@
      expression E1, E2, E3;
      @@
      - read_sha1_file(E1->hash, E2, E3)
      + read_object_file(E1, E2, E3)
      
      @@
      expression E1, E2, E3, E4;
      @@
      - read_sha1_file_extended(E1.hash, E2, E3, E4)
      + read_object_file_extended(&E1, E2, E3, E4)
      
      @@
      expression E1, E2, E3, E4;
      @@
      - read_sha1_file_extended(E1->hash, E2, E3, E4)
      + read_object_file_extended(E1, E2, E3, E4)
      Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b4f5aca4
  26. 17 1月, 2018 1 次提交
    • T
      convert_to_git(): safe_crlf/checksafe becomes int conv_flags · 8462ff43
      Torsten Bögershausen 提交于
      When calling convert_to_git(), the checksafe parameter defined what
      should happen if the EOL conversion (CRLF --> LF --> CRLF) does not
      roundtrip cleanly. In addition, it also defined if line endings should
      be renormalized (CRLF --> LF) or kept as they are.
      
      checksafe was an safe_crlf enum with these values:
      SAFE_CRLF_FALSE:       do nothing in case of EOL roundtrip errors
      SAFE_CRLF_FAIL:        die in case of EOL roundtrip errors
      SAFE_CRLF_WARN:        print a warning in case of EOL roundtrip errors
      SAFE_CRLF_RENORMALIZE: change CRLF to LF
      SAFE_CRLF_KEEP_CRLF:   keep all line endings as they are
      
      In some cases the integer value 0 was passed as checksafe parameter
      instead of the correct enum value SAFE_CRLF_FALSE. That was no problem
      because SAFE_CRLF_FALSE is defined as 0.
      
      FALSE/FAIL/WARN are different from RENORMALIZE and KEEP_CRLF. Therefore,
      an enum is not ideal. Let's use a integer bit pattern instead and rename
      the parameter to conv_flags to make it more generically usable. This
      allows us to extend the bit pattern in a subsequent commit.
      Reported-By: NRandall S. Becker <rsbecker@nexbridge.com>
      Helped-By: NLars Schneider <larsxschneider@gmail.com>
      Signed-off-by: NTorsten Bögershausen <tboegi@web.de>
      Signed-off-by: NLars Schneider <larsxschneider@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8462ff43