1. 11 1月, 2012 3 次提交
    • J
      attr.c: make bootstrap_attr_stack() leave early · 909ca7b9
      Junio C Hamano 提交于
      Thas would de-dent the body of a function that has grown rather large over
      time, making it a bit easier to read.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      909ca7b9
    • J
      attr: drop misguided defensive coding · 77f7f822
      Jeff King 提交于
      In prepare_attr_stack, we pop the old elements of the stack
      (which were left from a previous lookup and may or may not
      be useful to us). Our loop to do so checks that we never
      reach the top of the stack. However, the code immediately
      afterwards will segfault if we did actually reach the top of
      the stack.
      
      Fortunately, this is not an actual bug, since we will never
      pop all of the stack elements (we will always keep the root
      gitattributes, as well as the builtin ones). So the extra
      check in the loop condition simply clutters the code and
      makes the intent less clear. Let's get rid of it.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      77f7f822
    • J
      attr: don't confuse prefixes with leading directories · 1afca444
      Jeff King 提交于
      When we prepare the attribute stack for a lookup on a path,
      we start with the cached stack from the previous lookup
      (because it is common to do several lookups in the same
      directory hierarchy). So the first thing we must do in
      preparing the stack is to pop any entries that point to
      directories we are no longer interested in.
      
      For example, if our stack contains gitattributes for:
      
        foo/bar/baz
        foo/bar
        foo
      
      but we want to do a lookup in "foo/bar/bleep", then we want
      to pop the top element, but retain the others.
      
      To do this we walk down the stack from the top, popping
      elements that do not match our lookup directory. However,
      the test do this simply checked strncmp, meaning we would
      mistake "foo/bar/baz" as a leading directory of
      "foo/bar/baz_plus". We must also check that the character
      after our match is '/', meaning we matched the whole path
      component.
      
      There are two special cases to consider:
      
        1. The top of our attr stack has the empty path. So we
           must not check for '/', but rather special-case the
           empty path, which always matches.
      
        2. Typically when matching paths in this way, you would
           also need to check for a full string match (i.e., the
           character after is '\0'). We don't need to do so in
           this case, though, because our path string is actually
           just the directory component of the path to a file
           (i.e., we know that it terminates with "/", because the
           filename comes after that).
      Helped-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1afca444
  2. 07 1月, 2012 1 次提交
  3. 01 1月, 2012 1 次提交
  4. 30 12月, 2011 1 次提交
  5. 14 12月, 2011 5 次提交
  6. 10 12月, 2011 1 次提交
  7. 06 12月, 2011 2 次提交
  8. 17 11月, 2011 1 次提交
  9. 16 11月, 2011 1 次提交
  10. 27 10月, 2011 14 次提交
  11. 24 10月, 2011 1 次提交
  12. 28 9月, 2011 2 次提交
  13. 27 9月, 2011 3 次提交
    • N
      git-read-tree.txt: update sparse checkout examples · 5e821231
      Nguyễn Thái Ngọc Duy 提交于
      The negation example uses '*' to match everything. This used to work
      before 9037026d (unpack-trees: fix sparse checkout's "unable to match
      directories") because back then, the list of paths is used to match
      sparse patterns, so with the patterns
      
          *
          !subdir/
      
      subdir/ always matches any path that start with subdir/ and "*" has no
      chance to get tested. The result is subdir is excluded.
      
      After the said commit, a tree structure is dynamically created and
      sparse pattern matching now follows closely how read_directory()
      applies .gitignore. This solves one problem, but reveals another one.
      
      With this new strategy, "!subdir/" rule will be only tested once when
      "subdir" directory is examined. Entries inside subdir, when examined,
      will match "*" and are (correctly) re-added again because any rules
      without a slash will match at every directory level. In the end, "*"
      can revert every negation rules.
      
      In order to correctly exclude subdir, we must use
      
          /*
          !subdir
      
      to limit "match all" rule at top level only.
      
      "*" rule has no actual use in sparse checkout and can be confusing to
      users. While we can automatically turn "*" to "/*", this violates
      .gitignore definition. Instead, discourage "*" in favor of "/*" (in
      the second example).
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5e821231
    • J
      mergetool: no longer need to save standard input · 6d9990a9
      Junio C Hamano 提交于
      Earlier code wanted to run merge_file and prompt_after_failed_merge
      both of which wanted to read from the standard input of the entire
      script inside a while loop, which read from a pipe, and in order to
      do so, it redirected the original standard input to another file
      descriptor. We no longer need to do so after the previous change.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6d9990a9
    • J
      mergetool: Use args as pathspec to unmerged files · 3e8e691a
      Jonathon Mah 提交于
      Mergetool now treats its path arguments as a pathspec (like other git
      subcommands), restricting action to the given files and directories.
      Files matching the pathspec are filtered so mergetool only acts on
      unmerged paths; previously it would assume each path argument was in an
      unresolved state, and get confused when it couldn't check out their
      other stages.
      
      Running "git mergetool subdir" will prompt to resolve all conflicted
      blobs under subdir.
      Signed-off-by: NJonathon Mah <me@JonathonMah.com>
      Acked-by: NDavid Aguilar <davvid@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3e8e691a
  14. 24 9月, 2011 4 次提交