1. 16 10月, 2012 4 次提交
  2. 08 6月, 2012 2 次提交
  3. 06 6月, 2012 2 次提交
  4. 04 6月, 2012 2 次提交
    • J
      ls-files -i: micro-optimize path_excluded() · 93921b07
      Junio C Hamano 提交于
      As we know a caller that does not recurse is calling us in the index
      order, we can remember the last directory we found to be excluded
      and see if the path we are looking at is still inside it, in which
      case we can just answer that it is excluded.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      93921b07
    • J
      ls-files -i: pay attention to exclusion of leading paths · eb41775e
      Junio C Hamano 提交于
      "git ls-files --exclude=t/ -i" does not show paths in directory t/
      that have been added to the index, but it should.
      
      The excluded() API was designed for callers who walk the tree from
      the top, checking each level of the directory hierarchy as it
      descends if it is excluded, and not even bothering to recurse into
      an excluded directory.  This would allow us optimize for a common
      case by not having to check if the exclude pattern "foo/" matches
      when looking at "foo/bar", because the caller should have noticed
      that "foo" is excluded and did not even bother to read "foo/bar"
      out of opendir()/readdir() to call it.
      
      The code for "ls-files -i" however walks the index linearly, feeding
      paths without checking if the leading directory is already excluded.
      
      Introduce a helper function path_excluded() to let this caller
      properly call excluded() check for higher hierarchies as necessary.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      eb41775e
  5. 30 5月, 2012 1 次提交
  6. 12 5月, 2012 2 次提交
  7. 09 5月, 2012 1 次提交
    • R
      dir: convert to strbuf · 49dc2cc2
      René Scharfe 提交于
      The functions read_directory_recursive() and treat_leading_path() both
      use buffers sized to fit PATH_MAX characters.  The latter can be made to
      overrun its buffer, e.g. like this:
      
      	$ a=0123456789abcdef
      	$ a=$a$a$a$a$a$a$a$a
      	$ a=$a$a$a$a$a$a$a$a
      	$ a=$a$a$a$a$a$a$a$a
      	$ git add $a/a
      
      Instead of trying to add a check and potentionally forgetting to address
      similar cases, convert the involved functions and their helpers to use
      struct strbuf.  The patch is suprisingly large because the helpers
      treat_path() and treat_one_path() modify the buffer as well and thus need
      to be converted, too.
      Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      49dc2cc2
  8. 16 3月, 2012 2 次提交
    • J
      clean: preserve nested git worktree in subdirectories · ae2f203e
      Junio C Hamano 提交于
      remove_dir_recursively() has a check to avoid removing the directory it
      was asked to remove without recursing into it and report success when the
      directory is the top level of a working tree of a nested git repository,
      to protect such a repository from "clean -f" (without double -f). If a
      working tree of a nested git repository is in a subdirectory of a toplevel
      project, however, this protection did not apply by mistake; we forgot to
      pass the REMOVE_DIR_KEEP_NESTED_GIT down to the recursive removal
      codepath.
      
      This requires us to also teach the higher level not to remove the
      directory it is asked to remove, when the recursed invocation did not
      remove the directory it was asked to remove due to a nested git
      repository, as it is not an error to leave the parent directories of such
      a nested repository.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ae2f203e
    • J
      remove_dir_recursively(): Add flag for skipping removal of toplevel dir · c844a803
      Junio C Hamano 提交于
      Add the REMOVE_DIR_KEEP_TOPLEVEL flag to remove_dir_recursively() for
      deleting everything inside the given directory, but _not_ the given
      directory itself.
      
      Note that this does not pass the REMOVE_DIR_KEEP_NESTED_GIT flag, if set,
      to the recursive invocations of remove_dir_recursively().  It is likely to
      be a a bug that has been present since REMOVE_DIR_KEEP_NESTED_GIT was
      introduced (a0f4afbe), but this commit keeps the same behaviour for now.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c844a803
  9. 28 10月, 2011 1 次提交
  10. 13 9月, 2011 1 次提交
  11. 07 9月, 2011 1 次提交
  12. 06 4月, 2011 1 次提交
  13. 02 4月, 2011 1 次提交
  14. 29 3月, 2011 2 次提交
  15. 18 3月, 2011 1 次提交
  16. 04 2月, 2011 5 次提交
  17. 01 12月, 2010 1 次提交
  18. 30 11月, 2010 1 次提交
  19. 24 11月, 2010 1 次提交
  20. 09 11月, 2010 1 次提交
  21. 07 10月, 2010 4 次提交
    • J
      Add case insensitivity support when using git ls-files · 21444f18
      Joshua Jensen 提交于
      When mydir/filea.txt is added, mydir/ is renamed to MyDir/, and
      MyDir/fileb.txt is added, running git ls-files mydir only shows
      mydir/filea.txt. Running git ls-files MyDir shows MyDir/fileb.txt.
      Running git ls-files mYdIR shows nothing.
      
      With this patch running git ls-files for mydir, MyDir, and mYdIR shows
      mydir/filea.txt and MyDir/fileb.txt.
      
      Wildcards are not handled case insensitively in this patch. Example:
      MyDir/aBc/file.txt is added. git ls-files MyDir/a* works fine, but git
      ls-files mydir/a* does not.
      Signed-off-by: NJoshua Jensen <jjensen@workspacewhiz.com>
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      21444f18
    • J
      Add case insensitivity support for directories when using git status · 5102c617
      Joshua Jensen 提交于
      When using a case preserving but case insensitive file system, directory
      case can differ but still refer to the same physical directory.  git
      status reports the directory with the alternate case as an Untracked
      file.  (That is, when mydir/filea.txt is added to the repository and
      then the directory on disk is renamed from mydir/ to MyDir/, git status
      shows MyDir/ as being untracked.)
      
      Support has been added in name-hash.c for hashing directories with a
      terminating slash into the name hash. When index_name_exists() is called
      with a directory (a name with a terminating slash), the name is not
      found via the normal cache_name_compare() call, but it is found in the
      slow_same_name() function.
      
      Additionally, in dir.c, directory_exists_in_index_icase() allows newly
      added directories deeper in the directory chain to be identified.
      
      Ultimately, it would be better if the file list was read in case
      insensitive alphabetical order from disk, but this change seems to
      suffice for now.
      
      The end result is the directory is looked up in a case insensitive
      manner and does not show in the Untracked files list.
      Signed-off-by: NJoshua Jensen <jjensen@workspacewhiz.com>
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5102c617
    • J
      Case insensitivity support for .gitignore via core.ignorecase · 10d4b02b
      Joshua Jensen 提交于
      This is especially beneficial when using Windows and Perforce and the
      git-p4 bridge. Internally, Perforce preserves a given file's full path
      including its case at the time it was added to the Perforce repository.
      When syncing a file down via Perforce, missing directories are created,
      if necessary, using the case as stored with the filename. Unfortunately,
      two files in the same directory can have differing cases for their
      respective paths, such as /diRa/file1.c and /DirA/file2.c. Depending on
      sync order, DirA/ may get created instead of diRa/.
      
      It is possible to handle directory names in a case insensitive manner
      without this patch, but it is highly inconvenient, requiring each
      character to be specified like so: [Bb][Uu][Ii][Ll][Dd]. With this patch, the
      gitignore exclusions honor the core.ignorecase=true configuration
      setting and make the process less error prone. The above is specified
      like so: Build
      Signed-off-by: NJoshua Jensen <jjensen@workspacewhiz.com>
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      10d4b02b
    • J
      Add string comparison functions that respect the ignore_case variable. · 8cf2a84e
      Joshua Jensen 提交于
      Multiple locations within this patch series alter a case sensitive
      string comparison call such as strcmp() to be a call to a string
      comparison call that selects case comparison based on the global
      ignore_case variable. Behaviorally, when core.ignorecase=false, the
      *_icase() versions are functionally equivalent to their C runtime
      counterparts.  When core.ignorecase=true, the *_icase() versions perform
      a case insensitive comparison.
      
      Like Linus' earlier ignorecase patch, these may ignore filename
      conventions on certain file systems. By isolating filename comparisons
      to certain functions, support for those filename conventions may be more
      easily met.
      Signed-off-by: NJoshua Jensen <jjensen@workspacewhiz.com>
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8cf2a84e
  22. 28 9月, 2010 1 次提交
  23. 13 7月, 2010 1 次提交
  24. 17 6月, 2010 1 次提交
    • J
      common_prefix: simplify and fix scanning for prefixes · 42f9852f
      Junio C Hamano 提交于
      common_prefix() scans backwards from the far end of each 'next'
      pathspec, starting from 'len', shortening the 'prefix' using 'path' as
      a reference.
      
      However, there is a small opportunity for an out-of-bounds access
      because len is unconditionally set to prefix-1 after a "direct match"
      test failed.  This means that if 'next' is shorter than prefix+2, we
      read past it.
      
      Instead of a minimal fix, simplify the loop: scan *forward* over the
      'next' entry, remembering the last '/' where it matched the prefix
      known so far.  This is far easier to read and also has the advantage
      that we only scan over each entry once.
      Acked-by: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      42f9852f