1. 16 12月, 2012 3 次提交
    • J
      silence some -Wuninitialized false positives · a469a101
      Jeff King 提交于
      There are a few error functions that simply wrap error() and
      provide a standardized message text. Like error(), they
      always return -1; knowing that can help the compiler silence
      some false positive -Wuninitialized warnings.
      
      One strategy would be to just declare these as inline in the
      header file so that the compiler can see that they always
      return -1. However, gcc does not always inline them (e.g.,
      it will not inline opterror, even with -O3), which renders
      our change pointless.
      
      Instead, let's follow the same route we did with error() in
      the last patch, and define a macro that makes the constant
      return value obvious to the compiler.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a469a101
    • J
      make error()'s constant return value more visible · e208f9cc
      Jeff King 提交于
      When git is compiled with "gcc -Wuninitialized -O3", some
      inlined calls provide an additional opportunity for the
      compiler to do static analysis on variable initialization.
      For example, with two functions like this:
      
        int get_foo(int *foo)
        {
      	if (something_that_might_fail() < 0)
      		return error("unable to get foo");
      	*foo = 0;
      	return 0;
        }
      
        void some_fun(void)
        {
      	  int foo;
      	  if (get_foo(&foo) < 0)
      		  return -1;
      	  printf("foo is %d\n", foo);
        }
      
      If get_foo() is not inlined, then when compiling some_fun,
      gcc sees only that a pointer to the local variable is
      passed, and must assume that it is an out parameter that
      is initialized after get_foo returns.
      
      However, when get_foo() is inlined, the compiler may look at
      all of the code together and see that some code paths in
      get_foo() do not initialize the variable. As a result, it
      prints a warning. But what the compiler can't see is that
      error() always returns -1, and therefore we know that either
      we return early from some_fun, or foo ends up initialized,
      and the code is safe.  The warning is a false positive.
      
      If we can make the compiler aware that error() will always
      return -1, it can do a better job of analysis. The simplest
      method would be to inline the error() function. However,
      this doesn't work, because gcc will not inline a variadc
      function. We can work around this by defining a macro. This
      relies on two gcc extensions:
      
        1. Variadic macros (these are present in C99, but we do
           not rely on that).
      
        2. Gcc treats the "##" paste operator specially between a
           comma and __VA_ARGS__, which lets our variadic macro
           work even if no format parameters are passed to
           error().
      
      Since we are using these extra features, we hide the macro
      behind an #ifdef. This is OK, though, because our goal was
      just to help gcc.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e208f9cc
    • J
      remote-testsvn: fix unitialized variable · bfae342c
      Jeff King 提交于
      In remote-test-svn, there is a parse_rev_note function to
      parse lines of the form "Revision-number" from notes. If it
      finds such a line and parses it, it returns 0, copying the
      value into a "struct rev_note". If it finds an entry that is
      garbled or out of range, it returns -1 to signal an error.
      
      However, if it does not find any "Revision-number" line at
      all, it returns success but does not put anything into the
      rev_note. So upon a successful return, the rev_note may or
      may not be initialized, and the caller has no way of
      knowing.
      
      gcc does not usually catch the use of the unitialized
      variable because the conditional assignment happens in a
      separate function from the point of use. However, when
      compiling with -O3, gcc will inline parse_rev_note and
      notice the problem.
      
      We can fix it by returning "-1" when no note is found (so on
      a zero return, we always found a valid value).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bfae342c
  2. 14 12月, 2012 4 次提交
  3. 13 12月, 2012 3 次提交
  4. 12 12月, 2012 5 次提交
    • M
      Add file completion to tcsh git completion. · 75ed918b
      Marc Khouzam 提交于
      For bash completion, the option '-o bashdefault' is used to indicate
      that when no other choices are available, file completion should be
      performed.  Since this option is not available in tcsh, no file
      completion is ever performed.  Therefore, commands like 'git add ',
      'git send-email ', etc, require the user to manually type out
      the file name.  This can be quite annoying.
      
      To improve the user experience we try to simulate file completion
      directly in this script (although not perfectly).
      
      The known issues with the file completion simulation are:
      - Possible completions are shown with their directory prefix.
      - Completions containing shell variables are not handled.
      - Completions with ~ as the first character are not handled.
      Signed-off-by: NMarc Khouzam <marc.khouzam@ericsson.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      75ed918b
    • J
      Merge branch 'ef/mingw-rmdir' · 73481593
      Junio C Hamano 提交于
      MinGW has a workaround when rmdir unnecessarily fails to retry with
      a prompt, but the logic was kicking in when the rmdir failed with
      ENOTEMPTY, i.e. was expected to fail and there is no point retrying.
      
      * ef/mingw-rmdir:
        mingw_rmdir: do not prompt for retry when non-empty
      73481593
    • J
      Merge branch 'ef/mingw-tty-getpass' · 1bfe99ed
      Junio C Hamano 提交于
      Update getpass() emulation for MinGW.
      
      * ef/mingw-tty-getpass:
        mingw: get rid of getpass implementation
        mingw: reuse tty-version of git_terminal_prompt
        compat/terminal: separate input and output handles
        compat/terminal: factor out echo-disabling
        mingw: make fgetc raise SIGINT if apropriate
        mingw: correct exit-code for SIGALRM's SIG_DFL
      1bfe99ed
    • J
      Merge branch 'maint' · f993e2e1
      Junio C Hamano 提交于
      * maint:
        git-prompt: Document GIT_PS1_DESCRIBE_STYLE
      f993e2e1
    • A
      git-prompt: Document GIT_PS1_DESCRIBE_STYLE · 50b03b04
      Anders Kaseorg 提交于
      GIT_PS1_DESCRIBE_STYLE was introduced in v1.6.3.2~35.  Document it in the
      header comments.
      Signed-off-by: NAnders Kaseorg <andersk@mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      50b03b04
  5. 11 12月, 2012 5 次提交
  6. 09 12月, 2012 1 次提交
  7. 08 12月, 2012 15 次提交
  8. 07 12月, 2012 1 次提交
  9. 06 12月, 2012 2 次提交
  10. 05 12月, 2012 1 次提交