1. 18 1月, 2009 3 次提交
    • R
      Change NUL char handling of isspecial() · 8cc32992
      René Scharfe 提交于
      Replace isspecial() by the new macro is_glob_special(), which is more,
      well, specialized.  The former included the NUL char in its character
      class, while the letter only included characters that are special to
      file name globbing.
      
      The new name contains underscores because they enhance readability
      considerably now that it's made up of three words.  Renaming the
      function is necessary to document its changed scope.
      
      The call sites of isspecial() are updated to check explicitly for NUL.
      Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8cc32992
    • R
      Reformat ctype.c · c841aa8b
      René Scharfe 提交于
      Enhance the readability of ctype.c by using an enum instead of macros
      to initialize the character class table.  This allows the use of a single
      letter to mark a char, making the table fit within 80 columns.
      
      Also list the index of the last entry in each row in the following comment.
      Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c841aa8b
    • R
      Add ctype test · b4285c71
      René Scharfe 提交于
      Manipulating the character class table in ctype.c by hand is error prone.
      To ensure that typos are found quickly, add a test program and script.
      
      test-ctype checks the output of the character class macros isspace() et.
      al. by applying them on all possible char values and consulting a list of
      all characters in the particular class.  It doesn't check tolower() and
      toupper(); this could be added later.
      
      The test script t0070-fundamental.sh is created because there is no good
      place for the ctype test, yet -- except for t0000-basic.sh perhaps, but
      it doesn't run well on Windows, yet.
      Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b4285c71
  2. 10 1月, 2009 2 次提交
    • R
      grep: don't call regexec() for fixed strings · c822255c
      René Scharfe 提交于
      Add the new flag "fixed" to struct grep_pat and set it if the pattern
      is doesn't contain any regex control characters in addition to if the
      flag -F/--fixed-strings was specified.
      
      This gives a nice speed up on msysgit, where regexec() seems to be
      extra slow.  Before (best of five runs):
      
      	$ time git grep grep v1.6.1 >/dev/null
      
      	real    0m0.552s
      	user    0m0.000s
      	sys     0m0.000s
      
      	$ time git grep -F grep v1.6.1 >/dev/null
      
      	real    0m0.170s
      	user    0m0.000s
      	sys     0m0.015s
      
      With the patch:
      
      	$ time git grep grep v1.6.1 >/dev/null
      
      	real    0m0.173s
      	user    0m0.000s
      	sys     0m0.000s
      
      The difference is much smaller on Linux, but still measurable.
      Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c822255c
    • R
      grep -w: forward to next possible position after rejected match · fb62eb7f
      René Scharfe 提交于
      grep -w accepts matches between non-word characters, only.  If a match
      from regexec() doesn't meet this criteria, grep continues its search
      after the first character of that match.
      
      We can be a bit smarter here and skip all positions that follow a word
      character first, as they can't match our criteria.  This way we can
      consume characters quite cheaply and don't need to special-case the
      handling of the beginning of a line.
      
      Here's a contrived example command on msysgit (best of five runs):
      
      	$ time git grep -w ...... v1.6.1 >/dev/null
      
      	real    0m1.611s
      	user    0m0.000s
      	sys     0m0.015s
      
      With the patch it's quite a bit faster:
      
      	$ time git grep -w ...... v1.6.1 >/dev/null
      
      	real    0m1.179s
      	user    0m0.000s
      	sys     0m0.015s
      
      More common search patterns will gain a lot less, but it's a nice clean
      up anyway.
      Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fb62eb7f
  3. 07 1月, 2009 14 次提交
  4. 06 1月, 2009 7 次提交
  5. 04 1月, 2009 4 次提交
  6. 03 1月, 2009 2 次提交
    • J
      builtin-apply: prevent non-explicit permission changes · 1f7903a3
      Junio C Hamano 提交于
      A git patch that does not change the executable bit records the mode bits
      on its "index" line.  "git apply" used to interpret this mode exactly the
      same way as it interprets the mode recorded on "new mode" line, as the
      wish by the patch submitter to set the mode to the one recorded on the
      line.
      
      The reason the mode does not agree between the submitter and the receiver
      in the first place is because there is _another_ commit that only appears
      on one side but not the other since their histories diverged, and that
      commit changes the mode.  The patch has "index" line but not "new mode"
      line because its change is about updating the contents without affecting
      the mode.  The application of such a patch is an explicit wish by the
      submitter to only cherry-pick the commit that updates the contents without
      cherry-picking the commit that modifies the mode.  Viewed this way, the
      current behaviour is problematic, even though the command does warn when
      the mode of the path being patched does not match this mode, and a careful
      user could detect this inconsistencies between the patch submitter and the
      patch receiver.
      
      This changes the semantics of the mode recorded on the "index" line;
      instead of interpreting it as the submitter's wish to set the mode to the
      recorded value, it merely informs what the mode submitter happened to
      have, and the presense of the "index" line is taken as submitter's wish to
      keep whatever the mode is on the receiving end.
      
      This is based on the patch originally done by Alexander Potashev with a
      minor fix; the tests are mine.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1f7903a3
    • J
      git wrapper: Make while loop more reader-friendly · cca17048
      Johannes Schindelin 提交于
      It is not a good practice to prefer performance over readability in
      something as performance uncritical as finding the trailing slash
      of argv[0].
      
      So avoid head-scratching by making the loop user-readable, and not
      hyper-performance-optimized.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cca17048
  7. 01 1月, 2009 3 次提交
  8. 29 12月, 2008 5 次提交