1. 25 4月, 2019 1 次提交
    • C
      git-compat-util: work around for access(X_OK) under root · 400caafb
      Clément Chigot 提交于
      On AIX, access(X_OK) may succeed when run as root even if the
      execution isn't possible. This behavior is allowed by POSIX
      which says:
      
        ... for a process with appropriate privileges, an implementation
        may indicate success for X_OK even if execute permission is not
        granted to any user.
      
      It can lead hook programs to have their execution refused:
      
         git commit -m content
         fatal: cannot exec '.git/hooks/pre-commit': Permission denied
      
      Add NEED_ACCESS_ROOT_HANDLER in order to use an access helper function.
      It checks with stat if any executable flags is set when the current user
      is root.
      Signed-off-by: NClément Chigot <clement.chigot@atos.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      400caafb
  2. 22 4月, 2019 1 次提交
    • J
      Makefile: dedup list of files obtained from ls-files · 604a6464
      Junio C Hamano 提交于
      Since 33533975 ("Makefile: ask "ls-files" to list source files if
      available", 2011-10-18), we optionally asked "ls-files" to list the
      source files that ought to exist, as a faster approximation for
      "find" on working tree files.
      
      This works reasonably well, except that it ends up listing the same
      path multiple times if the index is unmerged.  Because the original
      use of this construct was to name files to run etags over, and the
      etags command happily takes the same filename multiple times without
      causing any harm, there was no problem (other than perhaps spending
      slightly more cycles, but who cares how fast the TAGS file gets
      updated).
      
      We however recently added a similar call to "ls-files" to list *.h
      files, instead of using "find", in 92b88eba ("Makefile: use `git
      ls-files` to list header files, if possible", 2019-03-04).  In this
      new use of "ls-files", the resulting list $(LIB_H) is used for,
      among other things, generating the header files to run hdr-check
      target, and the duplicate unfortunately becomes a true problem.  It
      causes $(MAKE) to notice that there are multiple %.hco targets and
      complain.
      
      Let the resulting list consumed by $(sort), which deduplicates,
      to fix this.
      Helped-by: NEric Sunshine <sunshine@sunshineco.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      604a6464
  3. 19 4月, 2019 7 次提交
  4. 16 4月, 2019 1 次提交
    • J
      trace2: use system/global config for default trace2 settings · bce9db6d
      Jeff Hostetler 提交于
      Teach git to read the system and global config files for
      default Trace2 settings.  This allows system-wide Trace2 settings to
      be installed and inherited to make it easier to manage a collection of
      systems.
      
      The original GIT_TR2* environment variables are loaded afterwards and
      can be used to override the system settings.
      
      Only the system and global config files are used.  Repo and worktree
      local config files are ignored.  Likewise, the "-c" command line
      arguments are also ignored.  These limits are for performance reasons.
      
      (1) For users not using Trace2, there should be minimal overhead to
      detect that Trace2 is not enabled.  In particular, Trace2 should not
      allocate lots of otherwise unused data strucutres.
      
      (2) For accurate performance measurements, Trace2 should be initialized
      as early in the git process as possible, and before most of the normal
      git process initialization (which involves discovering the .git directory
      and reading a hierarchy of config files).
      Signed-off-by: NJeff Hostetler <jeffhost@microsoft.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bce9db6d
  5. 15 4月, 2019 1 次提交
  6. 01 4月, 2019 3 次提交
  7. 20 3月, 2019 1 次提交
    • Æ
      rebase: remove the rebase.useBuiltin setting · d03ebd41
      Ævar Arnfjörð Bjarmason 提交于
      Remove the rebase.useBuiltin setting, which was added as an escape
      hatch to disable the builtin version of rebase first released with Git
      2.20.
      
      See [1] for the initial implementation of rebase.useBuiltin, and [2]
      and [3] for the documentation and corresponding
      GIT_TEST_REBASE_USE_BUILTIN option.
      
      Carrying the legacy version is a maintenance burden as seen in
      7e097e27 ("legacy-rebase: backport -C<n> and --whitespace=<option>
      checks", 2018-11-20) and 9aea5e92 ("rebase: fix regression in
      rebase.useBuiltin=false test mode", 2019-02-13). Since the built-in
      version has been shown to be stable enough let's remove the legacy
      version.
      
      As noted in [3] having use_builtin_rebase() shell out to get its
      config doesn't make any sense anymore, that was done for the purposes
      of spawning the legacy rebase without having modified any global
      state. Let's instead handle this case in rebase_config().
      
      There's still a bunch of references to git-legacy-rebase in po/*.po,
      but those will be dealt with in time by the i18n effort.
      
      Even though this configuration variable only existed two releases
      let's not entirely delete the entry from the docs, but note its
      absence. Individual versions of git tend to be around for a while due
      to distro packaging timelines, so e.g. if we're "lucky" a given
      version like 2.21 might be installed on say OSX for half a decade.
      
      That'll mean some people probably setting this in config, and then
      when they later wonder if it's needed they can Google search the
      config option name or check it in git-config. It also allows us to
      refer to the docs from the warning for details.
      
      1. 55071ea2 ("rebase: start implementing it as a builtin",
         2018-08-07)
      2. d8d0a546 ("rebase doc: document rebase.useBuiltin", 2018-11-14)
      3. 62c23938 ("tests: add a special setup where rebase.useBuiltin is
         off", 2018-11-14)
      3. https://public-inbox.org/git/nycvar.QRO.7.76.6.1903141544110.41@tvgsbejvaqbjf.bet/Acked-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d03ebd41
  8. 13 3月, 2019 1 次提交
    • J
      Makefile: fix unaligned loads in sha1dc with UBSan · 07a20f56
      Jeff King 提交于
      The sha1dc library uses unaligned loads on platforms that support them.
      This is normally what you'd want for performance, but it does cause
      UBSan to complain when we compile with SANITIZE=undefined. Just like we
      set -DNO_UNALIGNED_LOADS for our own code in that case, we should set
      -DSHA1DC_FORCE_ALIGNED_ACCESS.
      
      Of course that does nothing without pulling in the patches from sha1dc
      to respect that define. So let's do that, too, updating both the
      submodule link and our in-tree copy (from the same commit).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      07a20f56
  9. 07 3月, 2019 3 次提交
  10. 06 3月, 2019 1 次提交
  11. 05 3月, 2019 1 次提交
    • J
      Makefile: use `git ls-files` to list header files, if possible · 92b88eba
      Johannes Schindelin 提交于
      In d85b0dff (Makefile: use `find` to determine static header
      dependencies, 2014-08-25), we switched from a static list of header
      files to a dynamically-generated one, asking `find` to enumerate them.
      
      Back in those days, we did not use `$(LIB_H)` by default, and many a
      `make` implementation seems smart enough not to run that `find` command
      in that case, so it was deemed okay to run `find` for special targets
      requiring this macro.
      
      However, as of ebb7baf0 (Makefile: add a hdr-check target,
      2018-09-19), $(LIB_H) is part of a global rule and therefore must be
      expanded. Meaning: this `find` command has to be run upon every
      `make` invocation. In the presence of many a worktree, this can tax the
      developers' patience quite a bit.
      
      Even in the absence of worktrees or other untracked files and
      directories, the cost of I/O to generate that list of header files is
      simply a lot larger than a simple `git ls-files` call.
      
      Therefore, just like in 33533975 (Makefile: ask "ls-files" to list
      source files if available, 2011-10-18), we now prefer to use `git
      ls-files` to enumerate the header files to enumerating them via `find`,
      falling back to the latter if the former failed (which would be the case
      e.g. in a worktree that was extracted from a source .tar file rather
      than from a clone of Git's sources).
      
      This has one notable consequence: we no longer include `command-list.h`
      in `LIB_H`, as it is a generated file, not a tracked one, but that is
      easily worked around. Of the three sites that use `LIB_H`, two
      (`LOCALIZED_C` and `CHK_HDRS`) already handle generated headers
      separately. In the third, the computed-dependency fallback, we can just
      add in a reference to $(GENERATED_H).
      
      Likewise, we no longer include not-yet-tracked header files in `LIB_H`.
      
      Given the speed improvements, these consequences seem a comparably small
      price to pay.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Acked-by: NRamsay Jones <ramsay@ramsayjones.plus.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      92b88eba
  12. 24 2月, 2019 6 次提交
  13. 23 2月, 2019 2 次提交
    • J
      trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.sh · a15860dc
      Jeff Hostetler 提交于
      Create unit tests for Trace2.
      Signed-off-by: NJeff Hostetler <jeffhost@microsoft.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a15860dc
    • J
      trace2: create new combined trace facility · ee4512ed
      Jeff Hostetler 提交于
      Create a new unified tracing facility for git.  The eventual intent is to
      replace the current trace_printf* and trace_performance* routines with a
      unified set of git_trace2* routines.
      
      In addition to the usual printf-style API, trace2 provides higer-level
      event verbs with fixed-fields allowing structured data to be written.
      This makes post-processing and analysis easier for external tools.
      
      Trace2 defines 3 output targets.  These are set using the environment
      variables "GIT_TR2", "GIT_TR2_PERF", and "GIT_TR2_EVENT".  These may be
      set to "1" or to an absolute pathname (just like the current GIT_TRACE).
      
      * GIT_TR2 is intended to be a replacement for GIT_TRACE and logs command
        summary data.
      
      * GIT_TR2_PERF is intended as a replacement for GIT_TRACE_PERFORMANCE.
        It extends the output with columns for the command process, thread,
        repo, absolute and relative elapsed times.  It reports events for
        child process start/stop, thread start/stop, and per-thread function
        nesting.
      
      * GIT_TR2_EVENT is a new structured format. It writes event data as a
        series of JSON records.
      
      Calls to trace2 functions log to any of the 3 output targets enabled
      without the need to call different trace_printf* or trace_performance*
      routines.
      Signed-off-by: NJeff Hostetler <jeffhost@microsoft.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ee4512ed
  14. 20 2月, 2019 1 次提交
    • J
      tests: teach the test-tool to generate NUL bytes and use it · d5cfd142
      Johannes Schindelin 提交于
      In cc95bc20 (t5562: replace /dev/zero with a pipe from
      generate_zero_bytes, 2019-02-09), we replaced usage of /dev/zero (which
      is not available on NonStop, apparently) by a Perl script snippet to
      generate NUL bytes.
      
      Sadly, it does not seem to work on NonStop, as t5562 reportedly hangs.
      
      Worse, this also hangs in the Ubuntu 16.04 agents of the CI builds on
      Azure Pipelines: for some reason, the Perl script snippet that is run
      via `generate_zero_bytes` in t5562's 'CONTENT_LENGTH overflow ssite_t'
      test case tries to write out an infinite amount of NUL bytes unless a
      broken pipe is encountered, that snippet never encounters the broken
      pipe, and keeps going until the build times out.
      
      Oddly enough, this does not reproduce on the Windows and macOS agents,
      nor in a local Ubuntu 18.04.
      
      This developer tried for a day to figure out the exact circumstances
      under which this hang happens, to no avail, the details remain a
      mystery.
      
      In the end, though, what counts is that this here change incidentally
      fixes that hang (maybe also on NonStop?). Even more positively, it gets
      rid of yet another unnecessary Perl invocation.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d5cfd142
  15. 13 2月, 2019 1 次提交
  16. 12 2月, 2019 1 次提交
    • B
      utf8: handle systems that don't write BOM for UTF-16 · 79444c92
      brian m. carlson 提交于
      When serializing UTF-16 (and UTF-32), there are three possible ways to
      write the stream. One can write the data with a BOM in either big-endian
      or little-endian format, or one can write the data without a BOM in
      big-endian format.
      
      Most systems' iconv implementations choose to write it with a BOM in
      some endianness, since this is the most foolproof, and it is resistant
      to misinterpretation on Windows, where UTF-16 and the little-endian
      serialization are very common. For compatibility with Windows and to
      avoid accidental misuse there, Git always wants to write UTF-16 with a
      BOM, and will refuse to read UTF-16 without it.
      
      However, musl's iconv implementation writes UTF-16 without a BOM,
      relying on the user to interpret it as big-endian. This causes t0028 and
      the related functionality to fail, since Git won't read the file without
      a BOM.
      
      Add a Makefile and #define knob, ICONV_OMITS_BOM, that can be set if the
      iconv implementation has this behavior. When set, Git will write a BOM
      manually for UTF-16 and UTF-32 and then force the data to be written in
      UTF-16BE or UTF-32BE. We choose big-endian behavior here because the
      tests use the raw "UTF-16" encoding, which will be big-endian when the
      implementation requires this knob to be set.
      
      Update the tests to detect this case and write test data with an added
      BOM if necessary. Always write the BOM in the tests in big-endian
      format, since all iconv implementations that omit a BOM must use
      big-endian serialization according to the Unicode standard.
      
      Preserve the existing behavior for systems which do not have this knob
      enabled, since they may use optimized implementations, including
      defaulting to the native endianness, which may improve performance.
      Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      79444c92
  17. 06 2月, 2019 1 次提交
    • R
      Makefile: improve SPARSE_FLAGS customisation · 15caca28
      Ramsay Jones 提交于
      In order to enable greater user customisation of the SPARSE_FLAGS
      variable, we introduce a new SP_EXTRA_FLAGS variable to use for
      target specific settings. Without using the new variable, setting
      the SPARSE_FLAGS on the 'make' command-line would also override the
      value set by the target-specific rules in the Makefile (effectively
      making them useless). Also, this enables the SP_EXTRA_FLAGS to be
      used in the future for any other internal customisations, such as
      for some platform specific values.
      
      In addition, we initialise the SPARSE_FLAGS to the default (empty)
      value using a conditional assignment (?=). This allows SPARSE_FLAGS
      to be set from the environment as well as from the command-line.
      Signed-off-by: NRamsay Jones <ramsay@ramsayjones.plus.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      15caca28
  18. 30 1月, 2019 3 次提交
    • D
      Makefile: add coverage-prove target · 2299120f
      Derrick Stolee 提交于
      Sometimes there are test failures in the 'pu' branch. This
      is somewhat expected for a branch that takes the very latest
      topics under development, and those sometimes have semantic
      conflicts that only show up during test runs. This also can
      happen when running the test suite with different GIT_TEST_*
      environment variables that interact in unexpected ways
      
      This causes a problem for the test coverage reports, as
      the typical 'make coverage-test coverage-report' run halts
      at the first failed test. If that test is early in the
      suite, then many valuable tests are not exercising the code
      and the coverage report becomes noisy with false positives.
      
      Add a new 'coverage-prove' target to the Makefile,
      modeled after the 'coverage-test' target. This compiles
      the source using the coverage flags, then runs the test
      suite using the 'prove' tool. Since the coverage
      machinery is not thread-safe, enforce that the tests
      are run in sequence by appending '-j1' to GIT_PROVE_OPTS.
      Signed-off-by: NDerrick Stolee <dstolee@microsoft.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2299120f
    • J
      ci: parallelize testing on Windows · b819f1d2
      Johannes Schindelin 提交于
      The fact that Git's test suite is implemented in Unix shell script that
      is as portable as we can muster, combined with the fact that Unix shell
      scripting is foreign to Windows (and therefore has to be emulated),
      results in pretty abysmal speed of the test suite on that platform, for
      pretty much no other reason than that language choice.
      
      For comparison: while the Linux build & test is typically done within
      about 8 minutes, the Windows build & test typically lasts about 80
      minutes in Azure Pipelines.
      
      To help with that, let's use the Azure Pipeline feature where you can
      parallelize jobs, make jobs depend on each other, and pass artifacts
      between them.
      
      The tests are distributed using the following heuristic: listing all
      test scripts ordered by size in descending order (as a cheap way to
      estimate the overall run time), every Nth script is run (where N is the
      total number of parallel jobs), starting at the index corresponding to
      the parallel job. This slicing is performed by a new function that is
      added to the `test-tool`.
      
      To optimize the overall runtime of the entire Pipeline, we need to move
      the Windows jobs to the beginning (otherwise there would be a very
      decent chance for the Pipeline to be run only the Windows build, while
      all the parallel Windows test jobs wait for this single one).
      
      We use Azure Pipelines Artifacts for both the minimal Git for Windows
      SDK as well as the built executables, as deduplication and caching close
      to the agents makes that really fast. For comparison: while downloading
      and unpacking the minimal Git for Windows SDK via PowerShell takes only
      one minute (down from anywhere between 2.5 to 7 when using a shallow
      clone), uploading it as Pipeline Artifact takes less than 30s and
      downloading and unpacking less than 20s (sometimes even as little as
      only twelve seconds).
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b819f1d2
    • J
      tests: optionally write results as JUnit-style .xml · 22231908
      Johannes Schindelin 提交于
      This will come in handy when publishing the results of Git's test suite
      during an automated Azure DevOps run.
      
      Note: we need to make extra sure that invalid UTF-8 encoding is turned
      into valid UTF-8 (using the Replacement Character, \uFFFD) because
      t9902's trace contains such invalid byte sequences, and the task in the
      Azure Pipeline that uploads the test results would refuse to do anything
      if it was asked to parse an .xml file with invalid UTF-8 in it.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      22231908
  19. 16 1月, 2019 2 次提交
    • J
      Makefile: correct example fuzz build · 8b7c2eee
      Josh Steadmon 提交于
      The comment explaining how to build the fuzzers was broken in
      927c77e7 ("Makefile: use FUZZ_CXXFLAGS for linking fuzzers",
      2018-11-14).
      
      When building fuzzers, all .c files must be compiled with coverage
      tracing enabled. This is not possible when using only FUZZ_CXXFLAGS, as
      that flag is only applied to the fuzzers themselves. Switching back to
      CFLAGS fixes the issue.
      Signed-off-by: NJosh Steadmon <steadmon@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8b7c2eee
    • J
      commit-graph, fuzz: add fuzzer for commit-graph · aa658574
      Josh Steadmon 提交于
      Break load_commit_graph_one() into a new function, parse_commit_graph().
      The latter function operates on arbitrary buffers, which makes it
      suitable as a fuzzing target. Since parse_commit_graph() is only called
      by load_commit_graph_one() (and the fuzzer described below), we omit
      error messages that would be duplicated by the caller.
      
      Adds fuzz-commit-graph.c, which provides a fuzzing entry point
      compatible with libFuzzer (and possibly other fuzzing engines).
      Signed-off-by: NJosh Steadmon <steadmon@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      aa658574
  20. 08 1月, 2019 1 次提交
    • E
      rebase: implement --merge via the interactive machinery · 68aa495b
      Elijah Newren 提交于
      As part of an ongoing effort to make rebase have more uniform behavior,
      modify the merge backend to behave like the interactive one, by
      re-implementing it on top of the latter.
      
      Interactive rebases are implemented in terms of cherry-pick rather than
      the merge-recursive builtin, but cherry-pick also calls into the
      recursive merge machinery by default and can accept special merge
      strategies and/or special strategy options.  As such, there really is
      not any need for having both git-rebase--merge and
      git-rebase--interactive anymore.  Delete git-rebase--merge.sh and
      instead implement it in builtin/rebase.c.
      
      This results in a few deliberate but small user-visible changes:
        * The progress output is modified (see t3406 and t3420 for examples)
        * A few known test failures are now fixed (see t3421)
        * bash-prompt during a rebase --merge is now REBASE-i instead of
          REBASE-m.  Reason: The prompt is a reflection of the backend in use;
          this allows users to report an issue to the git mailing list with
          the appropriate backend information, and allows advanced users to
          know where to search for relevant control files.  (see t9903)
      
      testcase modification notes:
        t3406: --interactive and --merge had slightly different progress output
               while running; adjust a test to match the new expectation
        t3420: these test precise output while running, but rebase--am,
               rebase--merge, and rebase--interactive all were built on very
               different commands (am, merge-recursive, cherry-pick), so the
               tests expected different output for each type.  Now we expect
               --merge and --interactive to have the same output.
        t3421: --interactive fixes some bugs in --merge!  Wahoo!
        t9903: --merge uses the interactive backend so the prompt expected is
               now REBASE-i.
      Signed-off-by: NElijah Newren <newren@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      68aa495b
  21. 16 11月, 2018 1 次提交