1. 14 7月, 2017 2 次提交
    • J
      ref-filter: abstract ref format into its own struct · 4a68e36d
      Jeff King 提交于
      The ref-filter module provides routines for formatting a ref
      for output. The fundamental interface for the format is a
      "const char *" containing the format, and any additional
      options need to be passed to each invocation of
      show_ref_array_item.
      
      Instead, let's make a ref_format struct that holds the
      format, along with any associated format options. That will
      make some enhancements easier in the future:
      
        1. new formatting options can be added without disrupting
           existing callers
      
        2. some state can be carried in the struct rather than as
           global variables
      
      For now this just has the text format itself along with the
      quote_style option, but we'll add more fields in future patches.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4a68e36d
    • J
      check return value of verify_ref_format() · 2eda0102
      Jeff King 提交于
      Users of the ref-filter code must call verify_ref_format()
      before formatting any refs, but most ignore its return
      value. This means we may print an error on a syntactically
      bogus pattern, but keep going anyway.
      
      In most cases this results in a fatal error when we actually
      try to format a ref. But if you have no refs to show at all,
      then the behavior is confusing: git prints the error from
      verify_ref_format(), then exits with code 0 without showing
      any output.  Let's instead abort immediately if we know we
      have a bogus format.
      
      We'll output the usage information if we have it handy (just
      like the existing call in cmd_for_each_ref() does), and
      otherwise just die().
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2eda0102
  2. 16 6月, 2017 1 次提交
  3. 18 1月, 2017 1 次提交
  4. 23 4月, 2016 2 次提交
  5. 20 4月, 2016 1 次提交
  6. 07 4月, 2016 1 次提交
    • S
      builtin/verify-tag.c: ignore SIGPIPE in gpg-interface · d281b45d
      Santiago Torres 提交于
      The verify_signed_buffer() function may trigger a SIGPIPE when the
      GPG child process terminates early (due to a bad keyid, for example)
      and Git tries to write to it afterwards.  Previously, ignoring
      SIGPIPE was done in builtin/verify-tag.c to avoid this issue.
      
      However, any other caller who wants to call verify_signed_buffer()
      would have to do the same.
      
      Use sigchain_push(SIGPIPE, SIG_IGN) in verify_signed_buffer(),
      pretty much like in sign_buffer(), so that any caller is not
      required to perform this task.
      
      This will avoid possible mistakes by further developers using
      verify_signed_buffer().
      Signed-off-by: NSantiago Torres <santiago@nyu.edu>
      Reviewed-by: NEric Sunshine <sunshine@sunshineco.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d281b45d
  7. 23 6月, 2015 4 次提交
  8. 15 1月, 2015 1 次提交
  9. 15 2月, 2013 1 次提交
  10. 23 8月, 2012 1 次提交
  11. 09 3月, 2012 1 次提交
  12. 05 11月, 2011 1 次提交
    • J
      Split GPG interface into its own helper library · 2f47eae2
      Junio C Hamano 提交于
      This mostly moves existing code from builtin/tag.c (for signing)
      and builtin/verify-tag.c (for verifying) to a new gpg-interface.c
      file to provide a more generic library interface.
      
       - sign_buffer() takes a payload strbuf, a signature strbuf, and a signing
         key, runs "gpg" to produce a detached signature for the payload, and
         appends it to the signature strbuf. The contents of a signed tag that
         concatenates the payload and the detached signature can be produced by
         giving the same strbuf as payload and signature strbuf.
      
       - verify_signed_buffer() takes a payload and a detached signature as
         <ptr, len> pairs, and runs "gpg --verify" to see if the payload matches
         the signature. It can optionally capture the output from GPG to allow
         the callers to pretty-print it in a way more suitable for their
         contexts.
      
      "verify-tag" (aka "tag -v") used to save the whole tag contents as if it
      is a detached signature, and fed gpg the payload part of the tag. It
      relied on gpg to fail when the given tag is not signed but just is
      annotated.  The updated run_gpg_verify() function detects the lack of
      detached signature in the input, and errors out without bothering "gpg".
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2f47eae2
  13. 16 11月, 2010 2 次提交
  14. 11 11月, 2010 1 次提交
  15. 23 2月, 2010 1 次提交
    • L
      Move 'builtin-*' into a 'builtin/' subdirectory · 81b50f3c
      Linus Torvalds 提交于
      This shrinks the top-level directory a bit, and makes it much more
      pleasant to use auto-completion on the thing. Instead of
      
      	[torvalds@nehalem git]$ em buil<tab>
      	Display all 180 possibilities? (y or n)
      	[torvalds@nehalem git]$ em builtin-sh
      	builtin-shortlog.c     builtin-show-branch.c  builtin-show-ref.c
      	builtin-shortlog.o     builtin-show-branch.o  builtin-show-ref.o
      	[torvalds@nehalem git]$ em builtin-shor<tab>
      	builtin-shortlog.c  builtin-shortlog.o
      	[torvalds@nehalem git]$ em builtin-shortlog.c
      
      you get
      
      	[torvalds@nehalem git]$ em buil<tab>		[type]
      	builtin/   builtin.h
      	[torvalds@nehalem git]$ em builtin		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/sh<tab>	[type]
      	shortlog.c     shortlog.o     show-branch.c  show-branch.o  show-ref.c     show-ref.o
      	[torvalds@nehalem git]$ em builtin/sho		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/shor<tab>	[type]
      	shortlog.c  shortlog.o
      	[torvalds@nehalem git]$ em builtin/shortlog.c
      
      which doesn't seem all that different, but not having that annoying
      break in "Display all 180 possibilities?" is quite a relief.
      
      NOTE! If you do this in a clean tree (no object files etc), or using an
      editor that has auto-completion rules that ignores '*.o' files, you
      won't see that annoying 'Display all 180 possibilities?' message - it
      will just show the choices instead.  I think bash has some cut-off
      around 100 choices or something.
      
      So the reason I see this is that I'm using an odd editory, and thus
      don't have the rules to cut down on auto-completion.  But you can
      simulate that by using 'ls' instead, or something similar.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      81b50f3c
  16. 11 7月, 2009 1 次提交
  17. 30 4月, 2009 1 次提交
    • A
      replace direct calls to unlink(2) with unlink_or_warn · 691f1a28
      Alex Riesen 提交于
      This helps to notice when something's going wrong, especially on
      systems which lock open files.
      
      I used the following criteria when selecting the code for replacement:
      - it was already printing a warning for the unlink failures
      - it is in a function which already printing something or is
        called from such a function
      - it is in a static function, returning void and the function is only
        called from a builtin main function (cmd_)
      - it is in a function which handles emergency exit (signal handlers)
      - it is in a function which is obvously cleaning up the lockfiles
      Signed-off-by: NAlex Riesen <raa.lkml@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      691f1a28
  18. 29 7月, 2008 1 次提交
  19. 14 7月, 2008 1 次提交
    • S
      Make usage strings dash-less · 1b1dd23f
      Stephan Beyer 提交于
      When you misuse a git command, you are shown the usage string.
      But this is currently shown in the dashed form.  So if you just
      copy what you see, it will not work, when the dashed form
      is no longer supported.
      
      This patch makes git commands show the dash-less version.
      
      For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh
      generates a dash-less usage string now.
      Signed-off-by: NStephan Beyer <s-beyer@gmx.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1b1dd23f
  20. 15 5月, 2008 1 次提交
  21. 02 4月, 2008 1 次提交
  22. 24 2月, 2008 2 次提交
    • J
      start_command(), if .in/.out > 0, closes file descriptors, not the callers · c20181e3
      Johannes Sixt 提交于
      Callers of start_command() can set the members .in and .out of struct
      child_process to a value > 0 to specify that this descriptor is used as
      the stdin or stdout of the child process.
      
      Previously, if start_command() was successful, this descriptor was closed
      upon return. Here we now make sure that the descriptor is also closed in
      case of failures. All callers are updated not to close the file descriptor
      themselves after start_command() was called.
      
      Note that earlier run_gpg_verify() of git-verify-tag set .out = 1, which
      worked because start_command() treated this as a special case, but now
      this is incorrect because it closes the descriptor. The intent here is to
      inherit stdout to the child, which is achieved by .out = 0.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c20181e3
    • J
      start_command(), .in/.out/.err = -1: Callers must close the file descriptor · e72ae288
      Johannes Sixt 提交于
      By setting .in, .out, or .err members of struct child_process to -1, the
      callers of start_command() can request that a pipe is allocated that talks
      to the child process and one end is returned by replacing -1 with the
      file descriptor.
      
      Previously, a flag was set (for .in and .out, but not .err) to signal
      finish_command() to close the pipe end that start_command() had handed out,
      so it was optional for callers to close the pipe, and many already do so.
      Now we make it mandatory to close the pipe.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e72ae288
  23. 04 9月, 2007 1 次提交
  24. 27 7月, 2007 1 次提交
    • C
      Make verify-tag a builtin. · 2ae68fcb
      Carlos Rica 提交于
      This replaces "git-verify-tag.sh" with "builtin-verify-tag.c".
      
      Testing relies on the "git tag -v" tests calling this command.
      
      A temporary file is needed when calling to gpg, because git is
      already creating detached signatures (gpg option -b) to sign tags
      (instead of leaving gpg to add the signature to the file by itself),
      and those signatures need to be supplied in a separate file to be
      verified by gpg.
      
      The program uses git_mkstemp to create that temporary file needed by
      gpg, instead of the previously used "$GIT_DIR/.tmp-vtag", in order to
      allow the command to be used in read-only repositories, and also
      prevent other instances of git to read or remove the same file.
      
      Signal SIGPIPE is ignored because the program sometimes was
      terminated because that signal when writing the input for gpg.
      
      The command now can receive many tag names to be verified.
      Documentation is also updated here to reflect this new behaviour.
      Signed-off-by: NCarlos Rica <jasampler@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2ae68fcb