1. 29 3月, 2013 2 次提交
    • J
      dir.c::match_basename(): pay attention to the length of string parameters · 0b6e56df
      Junio C Hamano 提交于
      The function takes two counted strings (<basename, basenamelen> and
      <pattern, patternlen>) as parameters, together with prefix (the
      length of the prefix in pattern that is to be matched literally
      without globbing against the basename) and EXC_* flags that tells it
      how to match the pattern against the basename.
      
      However, it did not pay attention to the length of these counted
      strings.  Update them to do the following:
      
       * When the entire pattern is to be matched literally, the pattern
         matches the basename only when the lengths of them are the same,
         and they match up to that length.
      
       * When the pattern is "*" followed by a string to be matched
         literally, make sure that the basenamelen is equal or longer than
         the "literal" part of the pattern, and the tail of the basename
         string matches that literal part.
      
       * Otherwise, use the new fnmatch_icase_mem helper to make
         sure we only lookmake sure we use only look at the
         counted part of the strings.  Because these counted strings are
         full strings most of the time, we check for termination
         to avoid unnecessary allocation.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0b6e56df
    • J
      attr.c::path_matches(): special case paths that end with a slash · dc09e9ec
      Junio C Hamano 提交于
      The function is given a string that ends with a slash to signal that
      the path is a directory to make sure that a pattern that ends with a
      slash (i.e. MUSTBEDIR) can tell directories and non-directories
      apart.  However, the pattern itself (pat->pattern and
      pat->patternlen) that came from such a MUSTBEDIR pattern is
      represented as a string that ends with a slash, but patternlen does
      not count that trailing slash. A MUSTBEDIR pattern "element/" is
      represented as a counted string <"element/", 7> and this must match
      match pathname "element/".
      
      Because match_basename() and match_pathname() want to see pathname
      "element" to match against the pattern <"element/", 7>, reduce the
      length of the path to exclude the trailing slash when calling
      these functions.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dc09e9ec
  2. 27 3月, 2013 1 次提交
  3. 17 1月, 2013 1 次提交
  4. 16 1月, 2013 1 次提交
    • N
      attr: fix off-by-one directory component length calculation · 711536bd
      Nguyễn Thái Ngọc Duy 提交于
      94bc671a (Add directory pattern matching to attributes - 2012-12-08)
      uses find_basename() to calculate the length of directory part in
      prepare_attr_stack. This function expects the directory without the
      trailing slash (as "origin" field in match_attr struct is without the
      trailing slash). find_basename() includes the trailing slash and
      confuses push/pop algorithm.
      
      Consider path = "abc/def" and the push down code:
      
      	while (1) {
      		len = strlen(attr_stack->origin);
      		if (dirlen <= len)
      			break;
      		cp = memchr(path + len + 1, '/', dirlen - len - 1);
      		if (!cp)
      			cp = path + dirlen;
      
      dirlen is 4, not 3, without this patch. So when attr_stack->origin is
      "abc", it'll miss the exit condition because 4 <= 3 is wrong. It'll
      then try to push "abc/" down the attr stack (because "cp" would be
      NULL). So we have both "abc" and "abc/" in the stack.
      
      Next time when "abc/ghi" is checked, "abc/" is popped out because of
      the off-by-one dirlen, only to be pushed back in again by the above
      code. This repeats for all files in the same directory. Which means
      at least one failed open syscall per file, or more if .gitattributes
      exists.
      
      This is the perf result with 10 runs on git.git:
      
      Test                                     94bc671a^          94bc671a                   HEAD
      ----------------------------------------------------------------------------------------------------------
      7810.1: grep worktree, cheap regex       0.02(0.01+0.04)   0.05(0.03+0.05) +150.0%   0.02(0.01+0.04) +0.0%
      7810.2: grep worktree, expensive regex   0.25(0.94+0.01)   0.26(0.94+0.02) +4.0%     0.25(0.93+0.02) +0.0%
      7810.3: grep --cached, cheap regex       0.11(0.10+0.00)   0.12(0.10+0.02) +9.1%     0.10(0.10+0.00) -9.1%
      7810.4: grep --cached, expensive regex   0.61(0.60+0.01)   0.62(0.61+0.01) +1.6%     0.61(0.60+0.00) +0.0%
      Reported-by: NRoss Lagerwall <rosslagerwall@gmail.com>
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      711536bd
  5. 18 12月, 2012 1 次提交
  6. 13 12月, 2012 3 次提交
  7. 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
  8. 11 12月, 2012 5 次提交
  9. 09 12月, 2012 1 次提交
  10. 08 12月, 2012 9 次提交
  11. 07 12月, 2012 1 次提交
  12. 06 12月, 2012 2 次提交
  13. 05 12月, 2012 7 次提交
  14. 04 12月, 2012 1 次提交