1. 29 4月, 2011 2 次提交
    • S
      completion: remove unnecessary _get_comp_words_by_ref() invocations · da4902a7
      SZEDER Gábor 提交于
      In v1.7.4-rc0~11^2~2 (bash: get --pretty=m<tab> completion to work
      with bash v4, 2010-12-02) we started to use _get_comp_words_by_ref()
      to access completion-related variables.  That was large change, and to
      make it easily reviewable, we invoked _get_comp_words_by_ref() in each
      completion function and systematically replaced every occurance of
      bash's completion-related variables ($COMP_WORDS and $COMP_CWORD) with
      variables set by _get_comp_words_by_ref().
      
      This has the downside that _get_comp_words_by_ref() is invoked several
      times during a single completion.  The worst offender is perhaps 'git
      log mas<TAB>': during the completion of 'master'
      _get_comp_words_by_ref() is invoked no less than six times.
      
      However, the variables $prev, $cword, and $words provided by
      _get_comp_words_by_ref() are not modified in any of the completion
      functions, and the previous commit ensures that the $cur variable is
      not modified as well.  This makes it possible to invoke
      _get_comp_words_by_ref() to get those variables only once in our
      toplevel completion functions _git() and _gitk(), and all other
      completion functions will inherit them.
      Signed-off-by: NSZEDER Gábor <szeder@ira.uka.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      da4902a7
    • S
      completion: don't modify the $cur variable in completion functions · 9244d69b
      SZEDER Gábor 提交于
      Since v1.7.4-rc0~11^2~2 (bash: get --pretty=m<tab> completion to work
      with bash v4, 2010-12-02) we use _get_comp_words_by_ref() to access
      completion-related variables, and the $cur variable holds the word
      containing the current cursor position in all completion functions.
      This $cur variable is left unchanged in most completion functions;
      there are only four functions modifying its value, namely __gitcomp(),
      __git_complete_revlist_file(), __git_complete_remote_or_refspec(), and
      _git_config().
      
      If this variable were never modified, then it would allow us a nice
      optimisation and cleanup.  Therefore, this patch assigns $cur to an
      other local variable and uses that for later modifications in those
      four functions.
      Signed-off-by: NSZEDER Gábor <szeder@ira.uka.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9244d69b
  2. 28 4月, 2011 19 次提交
  3. 24 4月, 2011 1 次提交
  4. 23 4月, 2011 2 次提交
    • R
      sparse: Fix some "symbol not declared" warnings · c5147722
      Ramsay Jones 提交于
      In particular, sparse issues the "symbol 'a_symbol' was not declared.
      Should it be static?" warnings for the following symbols:
      
          attr.c:468:12: 'git_etc_gitattributes'
          attr.c:476:5:  'git_attr_system'
          vcs-svn/svndump.c:282:6: 'svndump_read'
          vcs-svn/svndump.c:417:5: 'svndump_init'
          vcs-svn/svndump.c:432:6: 'svndump_deinit'
          vcs-svn/svndump.c:445:6: 'svndump_reset'
      
      The symbols in attr.c only require file scope, so we add the static
      modifier to their declaration.
      
      The symbols in vcs-svn/svndump.c are external symbols, and they
      already have extern declarations in the "svndump.h" header file,
      so we simply include the header in svndump.c.
      Signed-off-by: NRamsay Jones <ramsay@ramsay1.demon.co.uk>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c5147722
    • R
      sparse: Fix errors due to missing target-specific variables · 0bcd9ae8
      Ramsay Jones 提交于
      In particular, sparse issues the following errors:
      
          attr.c:472:43: error: undefined identifier 'ETC_GITATTRIBUTES'
          config.c:821:43: error: undefined identifier 'ETC_GITCONFIG'
          exec_cmd.c:14:37: error: undefined identifier 'PREFIX'
          exec_cmd.c:83:28: error: undefined identifier 'GIT_EXEC_PATH'
          builtin/help.c:328:46: error: undefined identifier 'GIT_MAN_PATH'
          builtin/help.c:374:40: error: undefined identifier 'GIT_INFO_PATH'
          builtin/help.c:382:45: error: undefined identifier 'GIT_HTML_PATH'
          git.c:96:42: error: undefined identifier 'GIT_HTML_PATH'
          git.c:241:35: error: invalid initializer
          http.c:293:43: error: undefined identifier 'GIT_HTTP_USER_AGENT'
      
      which is caused by not passing the target-specific additions to
      the EXTRA_CPPFLAGS variable to cgcc.
      
      In order to fix the problem, we define a new sparse target which
      depends on a set of non-existent "sparse object" files (*.sp)
      which correspond to the set of C source files. In addition to the
      new target, we also provide a new pattern rule for "creating" the
      sparse object files from the source files by running cgcc.  This
      allows us to add '*.sp' to the rules setting the target-specific
      EXTRA_CPPFLAGS variable, which is then included in the new pattern
      rule to run cgcc.
      
      Also, we change the 'check' target to re-direct the user to the
      new sparse target.
      Signed-off-by: NRamsay Jones <ramsay@ramsay1.demon.co.uk>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0bcd9ae8
  5. 21 4月, 2011 1 次提交
    • M
      date: avoid "X years, 12 months" in relative dates · f1e9c548
      Michael J Gruber 提交于
      When relative dates are more than about a year ago, we start
      writing them as "Y years, M months".  At the point where we
      calculate Y and M, we have the time delta specified as a
      number of days. We calculate these integers as:
      
        Y = days / 365
        M = (days % 365 + 15) / 30
      
      This rounds days in the latter half of a month up to the
      nearest month, so that day 16 is "1 month" (or day 381 is "1
      year, 1 month").
      
      We don't round the year at all, though, meaning we can end
      up with "1 year, 12 months", which is silly; it should just
      be "2 years".
      
      Implement this differently with months of size
      
        onemonth = 365/12
      
      so that
      
        totalmonths = (long)( (days + onemonth/2)/onemonth )
        years = totalmonths / 12
        months = totalmonths % 12
      
      In order to do this without floats, we write the first formula as
      
        totalmonths = (days*12*2 + 365) / (365*2)
      
      Tests and inspiration by Jeff King.
      Helped-by: NJeff King <peff@peff.net>
      Signed-off-by: NMichael J Gruber <git@drmicha.warpmail.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f1e9c548
  6. 20 4月, 2011 4 次提交
  7. 19 4月, 2011 1 次提交
  8. 15 4月, 2011 4 次提交
  9. 14 4月, 2011 6 次提交