1. 10 11月, 2009 1 次提交
  2. 13 10月, 2009 1 次提交
    • C
      git: add --no-replace-objects option to disable replacing · b0fa7ab5
      Christian Couder 提交于
      Commit dae556bd (environment: add global variable to disable replacement)
      adds a variable to enable/disable replacement, and it is enabled by
      default for most commands.
      
      So there is no way to disable it for some commands, which is annoying
      when we want to get information about a commit that has been replaced.
      
      For example:
      
      $ git cat-file -p N
      
      would output information about the replacement commit if commit N is
      replaced.
      
      With the "--no-replace-objects" option that this patch adds it is
      possible to get information about the original commit using:
      
      $ git --no-replace-objects cat-file -p N
      
      While at it, let's add some documentation about this new option in the
      "git replace" man page too.
      Signed-off-by: NChristian Couder <chriscool@tuxfamily.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b0fa7ab5
  3. 13 9月, 2009 1 次提交
  4. 30 8月, 2009 1 次提交
  5. 06 8月, 2009 1 次提交
  6. 06 7月, 2009 4 次提交
    • J
      run_command: report failure to execute the program, but optionally don't · c024beb5
      Johannes Sixt 提交于
      In the case where a program was not found, it was still the task of the
      caller to report an error to the user. Usually, this is an interesting case
      but only few callers actually reported a specific error (though many call
      sites report a generic error message regardless of the cause).
      
      With this change the error is reported by run_command, but since there is
      one call site in git.c that does not want that, an option is added to
      struct child_process, which is used to turn the error off.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c024beb5
    • J
      run_command: report system call errors instead of returning error codes · 0ac77ec3
      Johannes Sixt 提交于
      The motivation for this change is that system call failures are serious
      errors that should be reported to the user, but only few callers took the
      burden to decode the error codes that the functions returned into error
      messages.
      
      If at all, then only an unspecific error message was given. A prominent
      example is this:
      
         $ git upload-pack . | :
         fatal: unable to run 'git-upload-pack'
      
      In this example, git-upload-pack, the external command invoked through the
      git wrapper, dies due to SIGPIPE, but the git wrapper does not bother to
      report the real cause. In fact, this very error message is copied to the
      syslog if git-daemon's client aborts the connection early.
      
      With this change, system call failures are reported immediately after the
      failure and only a generic failure code is returned to the caller. In the
      above example the error is now to the point:
      
         $ git upload-pack . | :
         error: git-upload-pack died of signal
      
      Note that there is no error report if the invoked program terminated with
      a non-zero exit code, because it is reasonable to expect that the invoked
      program has already reported an error. (But many run_command call sites
      nevertheless write a generic error message.)
      
      There was one special return code that was used to identify the case where
      run_command failed because the requested program could not be exec'd. This
      special case is now treated like a system call failure with errno set to
      ENOENT. No error is reported in this case, because the call site in git.c
      expects this as a normal result. Therefore, the callers that carefully
      decoded the return value still check for this condition.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0ac77ec3
    • J
      run_command: return exit code as positive value · 5709e036
      Johannes Sixt 提交于
      As a general guideline, functions in git's code return zero to indicate
      success and negative values to indicate failure. The run_command family of
      functions followed this guideline. But there are actually two different
      kinds of failure:
      
      - failures of system calls;
      
      - non-zero exit code of the program that was run.
      
      Usually, a non-zero exit code of the program is a failure and means a
      failure to the caller. Except that sometimes it does not. For example, the
      exit code of merge programs (e.g. external merge drivers) conveys
      information about how the merge failed, and not all exit calls are
      actually failures.
      
      Furthermore, the return value of run_command is sometimes used as exit
      code by the caller.
      
      This change arranges that the exit code of the program is returned as a
      positive value, which can now be regarded as the "result" of the function.
      System call failures continue to be reported as negative values.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5709e036
    • J
      MinGW: truncate exit()'s argument to lowest 8 bits · 47e3de0e
      Johannes Sixt 提交于
      For some reason, MinGW's bash cannot reliably detect failure of the child
      process if a negative value is passed to exit(). This fixes it by
      truncating the exit code in all calls of exit().
      
      This issue was worked around in run_builtin() of git.c (2488df84 builtin
      run_command: do not exit with -1, 2007-11-15). This workaround is no longer
      necessary and is reverted.
      Suggested-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      47e3de0e
  7. 01 7月, 2009 1 次提交
    • B
      git.c: avoid allocating one-too-many elements for new argv array · 6167c136
      Brandon Casey 提交于
      When creating a new argv array from a configured alias and the supplied
      command line arguments, the new argv was allocated with one element too
      many.  Since the first element of the original argv array is skipped when
      copying it to the new_argv, the number of elements that are allocated
      should be reduced by one.  'count' is the number of elements that new_argv
      contains, and *argcp is the number of elements in the original argv array.
      So the total allocation (including the terminating NULL entry) for the
      new_argv array should be:
      
        count + (*argcp - 1) + 1
      
      Also, the explicit assignment of the NULL terminating entry can be avoided
      by just copying it over from the original argv array.
      Signed-off-by: NBrandon Casey <drafnel@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6167c136
  8. 28 6月, 2009 1 次提交
  9. 01 6月, 2009 1 次提交
    • C
      Add new "git replace" command · 54b0c1e0
      Christian Couder 提交于
      This command can only be used now to list replace refs in
      "refs/replace/" and to delete them.
      
      The option to list replace refs is "-l".
      The option to delete replace refs is "-d".
      
      The behavior should be consistent with how "git tag" and "git branch"
      are working.
      
      The code has been copied from "builtin-tag.c" by Kristian Høgsberg
      <krh@redhat.com> and Carlos Rica <jasampler@gmail.com> that was itself
      based on git-tag.sh and mktag.c by Linus Torvalds.
      Signed-off-by: NChristian Couder <chriscool@tuxfamily.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      54b0c1e0
  10. 11 5月, 2009 1 次提交
  11. 02 5月, 2009 1 次提交
  12. 23 4月, 2009 1 次提交
  13. 05 4月, 2009 2 次提交
  14. 29 1月, 2009 2 次提交
    • J
      git: use run_command() to execute dashed externals · d8e96fd8
      Jeff King 提交于
      We used to simply try calling execvp(); if it succeeded, then we were done
      and the new program was running. If it didn't, then we knew that it wasn't
      a valid command.
      
      Unfortunately, this interacted badly with the new pager handling. Now that
      git remains the parent process and the pager is spawned, git has to hang
      around until the pager is finished. We install an atexit handler to do
      this, but that handler never gets called if we successfully run execvp.
      
      You could see this behavior by running any dashed external using a pager
      (e.g., "git -p stash list"). The command finishes running, but the pager
      is still going. In the case of less, it then gets an error reading from
      the terminal and exits, potentially leaving the terminal in a broken state
      (and not showing the output).
      
      This patch just uses run_command() to try running the dashed external. The
      parent git process then waits for the external process to complete and
      then handles the pager cleanup as it would for an internal command.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d8e96fd8
    • J
      git: s/run_command/run_builtin/ · f172f334
      Jeff King 提交于
      There is a static function called run_command which
      conflicts with the library function in run-command.c; this
      isn't a problem currently, but prevents including
      run-command.h in git.c.
      
      This patch just renames the static function to something
      more specific and non-conflicting.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f172f334
  15. 26 1月, 2009 2 次提交
  16. 06 1月, 2009 2 次提交
  17. 03 1月, 2009 1 次提交
  18. 05 12月, 2008 1 次提交
  19. 03 12月, 2008 1 次提交
  20. 13 10月, 2008 1 次提交
  21. 24 9月, 2008 1 次提交
  22. 10 9月, 2008 2 次提交
  23. 01 9月, 2008 1 次提交
    • J
      git wrapper: DWIM mistyped commands · 8af84dad
      Johannes Schindelin 提交于
      This patch introduces a modified Damerau-Levenshtein algorithm into
      Git's code base, and uses it with the following penalties to show some
      similar commands when an unknown command was encountered:
      
      	swap = 0, insertion = 1, substitution = 2, deletion = 4
      
      A typical output would now look like this:
      
      	$ git sm
      	git: 'sm' is not a git-command. See 'git --help'.
      
      	Did you mean one of these?
      		am
      		rm
      
      The cut-off is at similarity rating 6, which was empirically determined
      to give sensible results.
      
      As a convenience, if there is only one candidate, Git continues under
      the assumption that the user mistyped it.  Example:
      
      	$ git reabse
      	WARNING: You called a Git program named 'reabse', which does
      	not exist.
      	Continuing under the assumption that you meant 'rebase'
      	[...]
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NAlex Riesen <raa.lkml@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8af84dad
  24. 29 8月, 2008 1 次提交
    • N
      diff*: fix worktree setup · 4f38f6b5
      Nguyễn Thái Ngọc Duy 提交于
      This fixes "git diff", "git diff-files" and "git diff-index" to work
      correctly under worktree setup. Because diff* family works in many modes
      and not all of them require worktree, Junio made a nice summary
      (with a little modification from me):
      
       * diff-files is about comparing with work tree, so it obviously needs a
        work tree;
      
       * diff-index also does, except "diff-index --cached" or "diff --cached TREE"
      
       * no-index is about random files outside git context, so it obviously
         doesn't need any work tree;
      
       * comparing two (or more) trees doesn't;
      
       * comparing two blobs doesn't;
      
       * comparing a blob with a random file doesn't;
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4f38f6b5
  25. 26 8月, 2008 1 次提交
    • J
      Revert "Build-in "git-shell"" · 1e7abc59
      Junio C Hamano 提交于
      This reverts commit daa0cc9a.
      It was a stupid idea to do this; when run as a log-in shell,
      it is spawned with argv[0] set to "-git-shell", so the usual
      name-based dispatch would not work to begin with.
      1e7abc59
  26. 20 8月, 2008 1 次提交
  27. 26 7月, 2008 1 次提交
  28. 22 7月, 2008 1 次提交
  29. 08 7月, 2008 1 次提交
  30. 06 7月, 2008 1 次提交
    • J
      Allow per-command pager config · 4e10738a
      Jeff King 提交于
      There is great debate over whether some commands should set
      up a pager automatically. This patch allows individuals to
      set their own pager preferences for each command, overriding
      the default. For example, to disable the pager for git
      status:
      
        git config pager.status false
      
      If "--pager" or "--no-pager" is specified on the command
      line, it takes precedence over the config option.
      
      There are two caveats:
      
        - you can turn on the pager for plumbing commands.
          Combined with "core.pager = always", this will probably
          break a lot of things. Don't do it.
      
        - This only works for builtin commands. The reason is
          somewhat complex:
      
          Calling git_config before we do setup_git_directory
          has bad side effects, because it wants to know where
          the git_dir is to find ".git/config". Unfortunately,
          we cannot call setup_git_directory indiscriminately,
          because some builtins (like "init") break if we do.
      
          For builtins, this is OK, since we can just wait until
          after we call setup_git_directory. But for aliases, we
          don't know until we expand (recursively) which command
          we're doing. This should not be a huge problem for
          aliases, which can simply use "--pager" or "--no-pager"
          in the alias as appropriate.
      
          For external commands, however, we don't know we even
          have an external command until we exec it, and by then
          it is too late to check the config.
      
          An alternative approach would be to have a config mode
          where we don't bother looking at .git/config, but only
          at the user and system config files. This would make the
          behavior consistent across builtins, aliases, and
          external commands, at the cost of not allowing per-repo
          pager config for at all.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4e10738a
  31. 01 7月, 2008 1 次提交
  32. 24 6月, 2008 1 次提交