1. 21 Mar, 2019 1 commit
    • Jeff King's avatar
      git: read local config in --list-cmds · 83b0ecf3
      Jeff King authored
      Normally code that is checking config before we've decided to do
      setup_git_directory() would use read_early_config(), which uses
      discover_git_directory() to tentatively see if we're in a repo,
      and if so to add it to the config sequence.
      But list_cmds() uses the caching configset mechanism which
      rightly does not use read_early_config(), because it has no
      idea if it's being called early.
      Call setup_git_directory_gently() so we can pick up repo-level
      config (like completion.commands).
      Signed-off-by: 's avatarJeff King <peff@peff.net>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  2. 18 Mar, 2019 1 commit
  3. 07 Mar, 2019 3 commits
  4. 22 Feb, 2019 1 commit
    • Jeff Hostetler's avatar
      trace2: create new combined trace facility · ee4512ed
      Jeff Hostetler authored
      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
      * 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*
      Signed-off-by: 's avatarJeff Hostetler <jeffhost@microsoft.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  5. 24 Jan, 2019 1 commit
  6. 10 Dec, 2018 1 commit
  7. 12 Nov, 2018 2 commits
  8. 11 Oct, 2018 1 commit
    • Rasmus Villemoes's avatar
      git.c: handle_alias: prepend alias info when first argument is -h · a9a60b94
      Rasmus Villemoes authored
      Most git commands respond to -h anywhere in the command line, or at
      least as a first and lone argument, by printing the usage
      information. For aliases, we can provide a little more information that
      might be useful in interpreting/understanding the following output by
      prepending a line telling that the command is an alias, and for what.
      When one invokes a simple alias, such as "cp = cherry-pick"
      with -h, this results in
      $ git cp -h
      'cp' is aliased to 'cherry-pick'
      usage: git cherry-pick [<options>] <commit-ish>...
      When the alias consists of more than one word, this provides the
      additional benefit of informing the user which options are implicit in
      using the alias, e.g. with "cp = cherry-pick -n":
      $ git cp -h
      'cp' is aliased to 'cherry-pick -n'
      usage: git cherry-pick [<options>] <commit-ish>...
      For shell commands, we cannot know how it responds to -h, but printing
      this line to stderr should not hurt, and can help in figuring out what
      is happening in a case like
      $ git sc -h
      'sc' is aliased to '!somecommand'
      somecommand: invalid option '-h'
      Suggested-by: 's avatarJeff King <peff@peff.net>
      Signed-off-by: Rasmus Villemoes's avatarRasmus Villemoes <rv@rasmusvillemoes.dk>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  9. 09 Oct, 2018 3 commits
  10. 17 Sep, 2018 2 commits
    • Tim Schumacher's avatar
      alias: show the call history when an alias is looping · 82f71d9a
      Tim Schumacher authored
      Just printing the command that the user entered is not particularly
      helpful when trying to find the alias that causes the loop.
      Print the history of substituted commands to help the user find the
      offending alias. Mark the entrypoint of the loop with "<==" and the
      last command (which looped back to the entrypoint) with "==>".
      Signed-off-by: Tim Schumacher's avatarTim Schumacher <timschumi@gmx.de>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
    • Tim Schumacher's avatar
      alias: add support for aliases of an alias · c6d75bc1
      Tim Schumacher authored
      Aliases can only contain non-alias git commands and their arguments,
      not other user-defined aliases.  Resolving further (nested) aliases
      is prevented by breaking the loop after the first alias was
      processed.  Git then fails with a command-not-found error.
      Allow resolving nested aliases by not breaking the loop in
      run_argv() after the first alias was processed.  Instead, continue
      the loop until `handle_alias()` fails, which means that there are no
      further aliases that can be processed.  Prevent looping aliases by
      storing substituted commands in `cmd_list` and checking if a command
      has been substituted previously.
      While we're at it, fix a styling issue just below the added code.
      Signed-off-by: Tim Schumacher's avatarTim Schumacher <timschumi@gmx.de>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  11. 13 Aug, 2018 1 commit
  12. 06 Aug, 2018 1 commit
    • yohoho hahhahah's avatar
      rebase: start implementing it as a builtin · 55071ea2
      yohoho hahhahah authored
      This commit imitates the strategy that was used to convert the
      difftool to a builtin. We start by renaming the shell script
      `git-rebase.sh` to `git-legacy-rebase.sh` and introduce a
      `builtin/rebase.c` that simply executes the shell script version,
      unless the config setting `rebase.useBuiltin` is set to `true`.
      The motivation behind this is to rewrite all the functionality of the
      shell script version in the aforementioned `rebase.c`, one by one and
      be able to conveniently test new features by configuring
      In the original difftool conversion, if sane_execvp() that attempts to
      run the legacy scripted version returned with non-negative status, the
      command silently exited without doing anything with success, but
      sane_execvp() should not return with non-negative status in the first
      place, so we use die() to notice such an abnormal case.
      We intentionally avoid reading the config directly to avoid
      messing up the GIT_* environment variables when we need to fall back to
      exec()ing the shell script. The test of builtin rebase can be done by
      `git -c rebase.useBuiltin=true rebase ...`
      Signed-off-by: yohoho hahhahah's avatarPratik Karki <predatoramigo@gmail.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  13. 20 Jul, 2018 1 commit
  14. 18 Jul, 2018 1 commit
  15. 03 Jul, 2018 1 commit
    • Jameson Miller's avatar
      block alloc: add validations around cache_entry lifecyle · 8616a2d0
      Jameson Miller authored
      Add an option (controlled by an environment variable) perform extra
      validations on mem_pool allocated cache entries. When set:
        1) Invalidate cache_entry memory when discarding cache_entry.
        2) When discarding index_state struct, verify that all cache_entries
           were allocated from expected mem_pool.
        3) When discarding mem_pools, invalidate mem_pool memory.
      This should provide extra checks that mem_pools and their allocated
      cache_entries are being used as expected.
      Signed-off-by: 's avatarJameson Miller <jamill@microsoft.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  16. 28 May, 2018 1 commit
    • Jeff King's avatar
      make show-index a builtin · ff417260
      Jeff King authored
      The git-show-index command is built as its own separate
      program. There's really no good reason for this, and it
      means we waste extra space on disk (and CPU time running the
      linker). Let's fold it in to the main binary as a builtin.
      The history here is actually a bit amusing. The program
      itself is mostly self-contained, and doesn't even use our
      normal pack index code. In a5031214 (slim down "git
      show-index", 2010-01-21), we even stopped using xmalloc() so
      that it could avoid libgit.a entirely. But then 040a6551
      (cleanup: use internal memory allocation wrapper functions
      everywhere, 2011-10-06) switched that back to xmalloc, which
      later become ALLOC_ARRAY().
      Making it a builtin should give us the best of both worlds:
      no wasted space and no need to avoid the usual patterns.
      Signed-off-by: 's avatarJeff King <peff@peff.net>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  17. 21 May, 2018 8 commits
  18. 17 May, 2018 1 commit
  19. 04 May, 2018 1 commit
    • Johannes Sixt's avatar
      git: add -P as a short option for --no-pager · 7213c288
      Johannes Sixt authored
      It is possible to configure 'less', the pager, to use an alternate
      screen to show the content, for example, by setting LESS=RS in the
      environment. When it is closed in this configuration, it switches
      back to the original screen, and all content is gone.
      It is not uncommon to request that the output remains visible in
      the terminal. For this, the option --no-pager can be used. But
      it is a bit cumbersome to type, even when command completion is
      available. Provide a short option, -P, to make the option more
      easily accessible.
      Signed-off-by: 's avatarJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  20. 11 Apr, 2018 2 commits
    • Stefan Beller's avatar
      exec_cmd: rename to use dash in file name · d807c4a0
      Stefan Beller authored
      This is more consistent with the project style. The majority of Git's
      source files use dashes in preference to underscores in their file names.
      Signed-off-by: Stefan Beller's avatarStefan Beller <sbeller@google.com>
    • Dan Jacques's avatar
      exec_cmd: RUNTIME_PREFIX on some POSIX systems · 226c0ddd
      Dan Jacques authored
      Enable Git to resolve its own binary location using a variety of
      OS-specific and generic methods, including:
      - procfs via "/proc/self/exe" (Linux)
      - _NSGetExecutablePath (Darwin)
      - KERN_PROC_PATHNAME sysctl on BSDs.
      - argv0, if absolute (all, including Windows).
      This is used to enable RUNTIME_PREFIX support for non-Windows systems,
      notably Linux and Darwin. When configured with RUNTIME_PREFIX, Git will
      do a best-effort resolution of its executable path and automatically use
      this as its "exec_path" for relative helper and data lookups, unless
      explicitly overridden.
      Small incidental formatting cleanup of "exec_cmd.c".
      Signed-off-by: 's avatarDan Jacques <dnj@google.com>
      Thanks-to: Robbie Iannucci <iannucci@google.com>
      Thanks-to: Junio C Hamano <gitster@pobox.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  21. 02 Apr, 2018 1 commit
  22. 25 Mar, 2018 2 commits
  23. 15 Mar, 2018 1 commit
    • Brandon Williams's avatar
      serve: introduce git-serve · ed10cb95
      Brandon Williams authored
      Introduce git-serve, the base server for protocol version 2.
      Protocol version 2 is intended to be a replacement for Git's current
      wire protocol.  The intention is that it will be a simpler, less
      wasteful protocol which can evolve over time.
      Protocol version 2 improves upon version 1 by eliminating the initial
      ref advertisement.  In its place a server will export a list of
      capabilities and commands which it supports in a capability
      advertisement.  A client can then request that a particular command be
      executed by providing a number of capabilities and command specific
      parameters.  At the completion of a command, a client can request that
      another command be executed or can terminate the connection by sending a
      flush packet.
      Signed-off-by: 's avatarBrandon Williams <bmwill@google.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  24. 14 Mar, 2018 1 commit
  25. 21 Feb, 2018 1 commit
    • Martin Ågren's avatar
      config: respect `pager.config` in list/get-mode only · 32888b8f
      Martin Ågren authored
      Similar to de121ffe (tag: respect `pager.tag` in list-mode only,
      2017-08-02), use the DELAY_PAGER_CONFIG-mechanism to only respect
      `pager.config` when we are listing or "get"ing config.
      We have several getters and some are guaranteed to give at most one line
      of output. Paging all getters including those could be convenient from a
      documentation point-of-view. The downside would be that a misconfigured
      or not so modern pager might wait for user interaction before
      terminating. Let's instead respect the config for precisely those
      getters which may produce more than one line of output.
      `--get-urlmatch` may or may not produce multiple lines of output,
      depending on the exact usage. Let's not try to recognize the two modes,
      but instead make `--get-urlmatch` always respect the config. Analyzing
      the detailed usage might be trivial enough here, but could establish a
      precedent that we will never be able to enforce throughout the codebase
      and that will just open a can of worms.
      This fixes the failing test added in the previous commit. Also adapt the
      test for whether `git config foo.bar bar` and `git config --get foo.bar`
      respects `pager.config`.
      Signed-off-by: 's avatarMartin Ågren <martin.agren@gmail.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>