aboutsummaryrefslogtreecommitdiff
path: root/dir.c
Commit message (Collapse)AuthorAge
* Merge branch 'mm/config-xdg'Junio C Hamano2012-07-25
|\ | | | | | | | | | | | | | | | | | | | | Finishing touches to the XDG support (new feature for 1.7.12) and tests. * mm/config-xdg: t1306: check that XDG_CONFIG_HOME works ignore: make sure we have an xdg path before using it attr: make sure we have an xdg path before using it test-lib.sh: unset XDG_CONFIG_HOME
| * ignore: make sure we have an xdg path before using itMatthieu Moy2012-07-24
| | | | | | | | | | | | | | | | | | | | Commit e3ebc35 (config: fix several access(NULL) calls, 2012-07-12) was fixing access(NULL) calls when trying to access $HOME/.config/git/config, but missed the ones when trying to access $HOME/.config/git/ignore. Fix and test this. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'mm/config-xdg'Junio C Hamano2012-07-09
|\ \ | |/ | | | | | | | | | | | | | | | | | | Teach git to read various information from $XDG_CONFIG_HOME/git/ to allow the user to avoid cluttering $HOME. * mm/config-xdg: config: write to $XDG_CONFIG_HOME/git/config file when appropriate Let core.attributesfile default to $XDG_CONFIG_HOME/git/attributes Let core.excludesfile default to $XDG_CONFIG_HOME/git/ignore config: read (but not write) from $XDG_CONFIG_HOME/git/config file
| * Let core.excludesfile default to $XDG_CONFIG_HOME/git/ignoreHuynh Khoi Nguyen Nguyen2012-06-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To use the feature of core.excludesfile, the user needs: 1. to create such a file, 2. and add configuration variable to point at it. Instead, we can make this a one-step process by choosing a default value which points to a filename in the user's $HOME, that is unlikely to already exist on the system, and only use the presence of the file as a cue that the user wants to use that feature. And we use "${XDG_CONFIG_HOME:-$HOME/.config/git}/ignore" as such a file, in the same directory as the newly added configuration file ("${XDG_CONFIG_HOME:-$HOME/.config/git}/config). The use of this directory is in line with XDG specification as a location to store such application specific files. Signed-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr> Signed-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr> Signed-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr> Signed-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr> Signed-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'nd/exclude-workaround-top-heavy'Junio C Hamano2012-06-28
|\ \ | |/ |/| | | | | | | Attempt to optimize matching with an exclude pattern with a deep directory hierarchy by taking the part that specifies leading path without wildcard literally.
| * exclude: do strcmp as much as possible before fnmatchNguyễn Thái Ngọc Duy2012-06-07
| | | | | | | | | | | | | | | | this also avoids calling fnmatch() if the non-wildcard prefix is longer than basename Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * dir.c: get rid of the wildcard symbol set in no_wildcard()Nguyễn Thái Ngọc Duy2012-06-07
| | | | | | | | | | | | | | | | | | Elsewhere in this file is_glob_special() is also used to check for wildcards, which is defined in ctype. Make no_wildcard() also use this function (indirectly via simple_length()) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Unindent excluded_from_list()Nguyễn Thái Ngọc Duy2012-05-29
| | | | | | | | | | | | | | | | | | Return early if el->nr == 0. Unindent one more level for FNM_PATHNAME code block as this block is getting complex and may need more indentation. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jc/ls-files-i-dir'Junio C Hamano2012-06-21
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | "git ls-files --exclude=t -i" did not consider anything under t/ as excluded, as it did not pay attention to exclusion of leading paths while walking the index. Other two users of excluded() are also updated. * jc/ls-files-i-dir: dir.c: make excluded() file scope static unpack-trees.c: use path_excluded() in check_ok_to_remove() builtin/add.c: use path_excluded() path_excluded(): update API to less cache-entry centric ls-files -i: micro-optimize path_excluded() ls-files -i: pay attention to exclusion of leading paths
| * dir.c: make excluded() file scope staticJunio C Hamano2012-06-05
| | | | | | | | | | | | | | Now there no longer is external callers of this interface, so we can make it static. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * path_excluded(): update API to less cache-entry centricJunio C Hamano2012-06-05
| | | | | | | | | | | | | | | | It was stupid of me to make the API too much cache-entry specific; the caller may want to check arbitrary pathname without having a corresponding cache-entry to see if a path is ignored. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * ls-files -i: micro-optimize path_excluded()Junio C Hamano2012-06-03
| | | | | | | | | | | | | | | | | | 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: Junio C Hamano <gitster@pobox.com>
| * ls-files -i: pay attention to exclusion of leading pathsJunio C Hamano2012-06-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "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: Junio C Hamano <gitster@pobox.com>
* | dir: simplify fill_directory()René Scharfe2012-05-11
| | | | | | | | | | | | | | | | | | Now that read_directory_recursive() (reached through read_directory()) respects the string length limit we provide, we don't need to create a NUL-limited copy of the common prefix anymore. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | dir: respect string length argument of read_directory_recursive()René Scharfe2012-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | A directory name is passed to read_directory_recursive() as a length-limited string, through the parameters base and baselen. Suprisingly, base must be a NUL-terminated string as well, as it is passed to opendir(), ignoring baselen. Fix this by postponing the call to opendir() until the length-limted string is added to a strbuf, which provides a NUL in the right place. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'rs/maint-dir-strbuf' into rs/dir-strbufJunio C Hamano2012-05-08
|\ \ | | | | | | | | | | | | | | | By René Scharfe * rs/maint-dir-strbuf: dir: convert to strbuf
| * | dir: convert to strbufRené Scharfe2012-05-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | clean: preserve nested git worktree in subdirectoriesJunio C Hamano2012-03-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Junio C Hamano <gitster@pobox.com>
* | | remove_dir_recursively(): Add flag for skipping removal of toplevel dirJunio C Hamano2012-03-15
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | 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 (a0f4afb), but this commit keeps the same behaviour for now. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | read_directory_recursive: reduce one indentation levelNguyễn Thái Ngọc Duy2011-10-27
| | | | | | | | | | Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | rename pathspec_prefix() to common_prefix() and move to dir.[ch]Clemens Buchacher2011-09-12
| | | | | | | | | | | | | | | | Also make common_prefix_len() static as this refactoring makes dir.c itself the only caller of this helper function. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | consolidate pathspec_prefix and common_prefixJunio C Hamano2011-09-06
|/ | | | | | | | | The implementation from pathspec_prefix (slightly modified) replaces the current common_prefix, because it also respects glob characters. Based on a patch by Clemens Buchacher. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'nd/struct-pathspec'Junio C Hamano2011-05-06
|\ | | | | | | | | | | | | | | * nd/struct-pathspec: pathspec: rename per-item field has_wildcard to use_wildcard Improve tree_entry_interesting() handling code Convert read_tree{,_recursive} to support struct pathspec Reimplement read_tree_recursive() using tree_entry_interesting()
| * pathspec: rename per-item field has_wildcard to use_wildcardJunio C Hamano2011-04-05
| | | | | | | | | | | | | | | | | | | | | | As the point of the last change is to allow use of strings as literals no matter what characters are in them, "has_wildcard" does not match what we use this field for anymore. It is used to decide if the wildcard matching should be used, so rename it to match the usage better. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'nd/maint-setup'Junio C Hamano2011-05-02
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | * nd/maint-setup: Kill off get_relative_cwd() setup: return correct prefix if worktree is '/' Conflicts: dir.c setup.c
| * | Kill off get_relative_cwd()Nguyễn Thái Ngọc Duy2011-03-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Function dir_inside_of() does something similar (correctly), but looks easier to understand and does not bundle cwd to its business. Given get_relative_cwd's only user is is_inside_dir, we can kill it for good. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | setup: return correct prefix if worktree is '/'Nguyễn Thái Ngọc Duy2011-03-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The same old problem reappears after setup code is reworked. We tend to assume there is at least one path component in a path and forget that path can be simply '/'. Reported-by: Matthijs Kooijman <matthijs@stdin.nl> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'ar/clean-rmdir-empty'Junio C Hamano2011-04-27
|\ \ \ | | | | | | | | | | | | | | | | * ar/clean-rmdir-empty: clean: unreadable directory may still be rmdir-able if it is empty
| * | | clean: unreadable directory may still be rmdir-able if it is emptyAlex Riesen2011-04-01
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a last ditch effort, try rmdir(2) when we cannot read the directory to be removed. It may be an empty directory that we can remove without any permission, as long as we can modify its parent directory. Noticed by Linus. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Name make_*_path functions more accuratelyCarlos Martín Nieto2011-03-17
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | Rename the make_*_path functions so it's clearer what they do, in particlar make clear what the differnce between make_absolute_path and make_nonrelative_path is by renaming them real_path and absolute_path respectively. make_relative_path has an understandable name and is renamed to relative_path to maintain the name convention. The function calls have been replaced 1-to-1 in their usage. Signed-off-by: Carlos Martín Nieto <cmn@elego.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | pathspec: add match_pathspec_depth()Nguyễn Thái Ngọc Duy2011-02-03
| | | | | | | | | | | | | | | | | | | | | | | | | | match_pathspec_depth() is a clone of match_pathspec() except that it can take depth limit. Computation is a bit lighter compared to match_pathspec() because it's usually precomputed and stored in struct pathspec. In long term, match_pathspec() and match_one() should be removed in favor of this function. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | tree_entry_interesting(): support wildcard matchingNguyễn Thái Ngọc Duy2011-02-03
| | | | | | | | | | | | | | | | never_interesting optimization is disabled if there is any wildcard pathspec, even if it only matches exactly on trees. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | tree_entry_interesting(): fix depth limit with overlapping pathspecsNguyễn Thái Ngọc Duy2011-02-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose we have two pathspecs 'a' and 'a/b' (both are dirs) and depth limit 1. In current code, pathspecs are checked in input order. When 'a/b' is checked against pathspec 'a', it fails depth limit and therefore is excluded, although it should match 'a/b' pathspec. This patch reorders all pathspecs alphabetically, then teaches tree_entry_interesting() to check against the deepest pathspec first, so depth limit of a shallower pathspec won't affect a deeper one. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | tree_entry_interesting(): support depth limitNguyễn Thái Ngọc Duy2011-02-03
| | | | | | | | | | | | | | | | | | | | | | | | This is needed to replace pathspec_matches() in builtin/grep.c. max_depth == -1 means infinite depth. Depth limit is only effective when pathspec.recursive == 1. When pathspec.recursive == 0, the behavior depends on match functions: non-recursive for tree_entry_interesting() and recursive for match_pathspec{,_depth} Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Add struct pathspecNguyễn Thái Ngọc Duy2011-02-03
|/ | | | | | | | | | | | | The old pathspec structure remains as pathspec.raw[]. New things are stored in pathspec.items[]. There's no guarantee that the pathspec order in raw[] is exactly as in items[]. raw[] is external (source) data and is untouched by pathspec manipulation functions. It eases migration from old const char ** to this new struct. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'nd/maint-fix-add-typo-detection'Junio C Hamano2010-12-22
|\ | | | | | | | | | | | | | | | | * nd/maint-fix-add-typo-detection: Revert "excluded_1(): support exclude files in index" unpack-trees: fix sparse checkout's "unable to match directories" unpack-trees: move all skip-worktree checks back to unpack_trees() dir.c: add free_excludes() cache.h: realign and use (1 << x) form for CE_* constants
| * Revert "excluded_1(): support exclude files in index"Nguyễn Thái Ngọc Duy2010-11-30
| | | | | | | | | | | | | | | | | | This reverts commit c84de70781674a35b9bfd20aa5bc8c47582615df. The commit provided a workaround for matching directories in index. But it is no longer needed. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * dir.c: add free_excludes()Nguyễn Thái Ngọc Duy2010-11-29
| | | | | | | | | | Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'nd/maint-relative'Junio C Hamano2010-12-16
|\ \ | | | | | | | | | | | | * nd/maint-relative: get_cwd_relative(): do not misinterpret root path
| * | get_cwd_relative(): do not misinterpret root pathNguyễn Thái Ngọc Duy2010-11-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 490544b (get_cwd_relative(): do not misinterpret suffix as subdirectory) handles case where: dir = "/path/work"; cwd = "/path/work-xyz"; When it comes to the end of get_cwd_relative(), dir is at '\0' and cwd is at '-'. The rest of cwd, "-xyz", clearly cannot be the relative path from dir to cwd. However there is another case where: dir = "/"; /* or even "c:/" */ cwd = "/path/to/here"; In this special case, while *cwd == 'p', which is not a path separator, the rest of cwd, "path/to/here", can be returned as a relative path from dir to cwd. Handle this case and make t1509 pass again. Reported-by: Albert Strasheim <fullung@gmail.com> Reported-by: Matthijs Kooijman <matthijs@stdin.nl> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jj/icase-directory'Junio C Hamano2010-12-03
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jj/icase-directory: Support case folding in git fast-import when core.ignorecase=true Support case folding for git add when core.ignorecase=true Add case insensitivity support when using git ls-files Add case insensitivity support for directories when using git status Case insensitivity support for .gitignore via core.ignorecase Add string comparison functions that respect the ignore_case variable. Makefile & configure: add a NO_FNMATCH_CASEFOLD flag Makefile & configure: add a NO_FNMATCH flag Conflicts: Makefile config.mak.in configure.ac fast-import.c
| * | Add case insensitivity support when using git ls-filesJoshua Jensen2010-10-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Joshua Jensen <jjensen@workspacewhiz.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Add case insensitivity support for directories when using git statusJoshua Jensen2010-10-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Joshua Jensen <jjensen@workspacewhiz.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Case insensitivity support for .gitignore via core.ignorecaseJoshua Jensen2010-10-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Joshua Jensen <jjensen@workspacewhiz.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Add string comparison functions that respect the ignore_case variable.Joshua Jensen2010-10-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Joshua Jensen <jjensen@workspacewhiz.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | dir.c: fix EXC_FLAG_MUSTBEDIR match in sparse checkoutNguyễn Thái Ngọc Duy2010-11-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit c84de70 (excluded_1(): support exclude files in index - 2009-08-20) tries to work around the fact that there is no directory/file information in index entries, therefore EXC_FLAG_MUSTBEDIR match would fail. Unfortunately the workaround is flawed. This fixes it. Reported-by: Thomas Rinderknecht <thomasr@sailguy.org> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | dir.c: squelch false uninitialized memory warningPat Notz2010-09-27
|/ / | | | | | | | | | | | | GCC 4.4.4 on MacOS incorrectly warns about potential use of uninitialized memory. Signed-off-by: Pat Notz <patnotz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git add: Add the "--ignore-missing" option for the dry runJens Lehmann2010-07-12
| | | | | | | | | | | | | | | | | | | | Sometimes it is useful to know if a file or directory will be ignored before it is added to the work tree. An example is "git submodule add", where it would be really nice to be able to fail with an appropriate error message before the submodule is cloned and checked out. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jc/maint-simpler-common-prefix'Junio C Hamano2010-06-22
|\ \ | |/ | | | | | | * jc/maint-simpler-common-prefix: common_prefix: simplify and fix scanning for prefixes
| * common_prefix: simplify and fix scanning for prefixesJunio C Hamano2010-06-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>