summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-01-06dir.c: use a single struct exclude_list per source of excludesLibravatar Adam Spiers6-39/+86
Previously each exclude_list could potentially contain patterns from multiple sources. For example dir->exclude_list[EXC_FILE] would typically contain patterns from .git/info/exclude and core.excludesfile, and dir->exclude_list[EXC_DIRS] could contain patterns from multiple per-directory .gitignore files during directory traversal (i.e. when dir->exclude_stack was more than one item deep). We split these composite exclude_lists up into three groups of exclude_lists (EXC_CMDL / EXC_DIRS / EXC_FILE as before), so that each exclude_list now contains patterns from a single source. This will allow us to cleanly track the origin of each pattern simply by adding a src field to struct exclude_list, rather than to struct exclude, which would make memory management of the source string tricky in the EXC_DIRS case where its contents are dynamically generated. Similarly, by moving the filebuf member from struct exclude_stack to struct exclude_list, it allows us to track and subsequently free memory buffers allocated during the parsing of all exclude files, rather than only tracking buffers allocated for files in the EXC_DIRS group. Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28dir.c: rename free_excludes() to clear_exclude_list()Libravatar Adam Spiers3-3/+7
It is clearer to use a 'clear_' prefix for functions which empty and deallocate the contents of a data structure without freeing the structure itself, and a 'free_' prefix for functions which also free the structure itself. http://article.gmane.org/gmane.comp.version-control.git/206128 Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28dir.c: refactor is_path_excluded()Libravatar Adam Spiers2-9/+41
In a similar way to the previous commit, this extracts a new helper function last_exclude_matching_path() which return the last exclude_list element which matched, or NULL if no match was found. is_path_excluded() becomes a wrapper around this, and just returns 0 or 1 depending on whether any matching exclude_list element was found. This allows callers to find out _why_ a given path was excluded, rather than just whether it was or not, paving the way for a new git sub-command which allows users to test their exclude lists from the command line. Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28dir.c: refactor is_excluded()Libravatar Adam Spiers1-9/+29
In a similar way to the previous commit, this extracts a new helper function last_exclude_matching() which returns the last exclude_list element which matched, or NULL if no match was found. is_excluded() becomes a wrapper around this, and just returns 0 or 1 depending on whether any matching exclude_list element was found. This allows callers to find out _why_ a given path was excluded, rather than just whether it was or not, paving the way for a new git sub-command which allows users to test their exclude lists from the command line. Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28dir.c: refactor is_excluded_from_list()Libravatar Adam Spiers1-9/+28
The excluded function uses a new helper function called last_exclude_matching_from_list() to perform the inner loop over all of the exclude patterns. The helper just tells us whether the path is included, excluded, or undecided. However, it may be useful to know _which_ pattern was triggered. So let's pass out the entire exclude match, which contains the status information we were already passing out. Further patches can make use of this. This is a modified forward port of a patch from 2009 by Jeff King: http://article.gmane.org/gmane.comp.version-control.git/108815 Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28dir.c: rename excluded() to is_excluded()Libravatar Adam Spiers3-8/+8
Continue adopting clearer names for exclude functions. This is_* naming pattern for functions returning booleans was discussed here: http://thread.gmane.org/gmane.comp.version-control.git/204661/focus=204924 Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28dir.c: rename excluded_from_list() to is_excluded_from_list()Libravatar Adam Spiers3-10/+13
Continue adopting clearer names for exclude functions. This 'is_*' naming pattern for functions returning booleans was discussed here: http://thread.gmane.org/gmane.comp.version-control.git/204661/focus=204924 Also adjust their callers as necessary. Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28dir.c: rename path_excluded() to is_path_excluded()Libravatar Adam Spiers5-6/+6
Start adopting clearer names for exclude functions. This 'is_*' naming pattern for functions returning booleans was agreed here: http://thread.gmane.org/gmane.comp.version-control.git/204661/focus=204924 Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28dir.c: rename cryptic 'which' variable to more consistent nameLibravatar Adam Spiers2-7/+7
'el' is only *slightly* less cryptic, but is already used as the variable name for a struct exclude_list pointer in numerous other places, so this reduces the number of cryptic variable names in use by one :-) Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28Improve documentation and comments regarding directory traversal APILibravatar Adam Spiers3-6/+37
traversal API has a few potentially confusing properties. These comments clarify a few key aspects and will hopefully make it easier to understand for other newcomers in the future. Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28api-directory-listing.txt: update to match codeLibravatar Adam Spiers1-6/+6
7c4c97c0ac turned the flags in struct dir_struct into a single bitfield variable, but forgot to update this document. Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-15attr: more matching optimizations from .gitignoreLibravatar Nguyễn Thái Ngọc Duy5-32/+64
.gitattributes and .gitignore share the same pattern syntax but has separate matching implementation. Over the years, ignore's implementation accumulates more optimizations while attr's stays the same. This patch reuses the core matching functions that are also used by excluded_from_list. excluded_from_list and path_matches can't be merged due to differences in exclude and attr, for example: * "!pattern" syntax is forbidden in .gitattributes. As an attribute can be unset (i.e. set to a special value "false") or made back to unspecified (i.e. not even set to "false"), "!pattern attr" is unclear which one it means. * we support attaching attributes to directories, but git-core internally does not currently make use of attributes on directories. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-15gitignore: make pattern parsing code a separate functionLibravatar Nguyễn Thái Ngọc Duy2-23/+50
This function can later be reused by attr.c. Also turn to_exclude field into a flag. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-15exclude: split pathname matching code into a separate functionLibravatar Nguyễn Thái Ngọc Duy1-32/+53
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-15exclude: fix a bug in prefix compare optimizationLibravatar Nguyễn Thái Ngọc Duy2-1/+7
When "namelen" becomes zero at this stage, we have matched the fixed part, but whether it actually matches the pattern still depends on the pattern in "exclude". As demonstrated in t3001, path "three/a.3" exists and it matches the "three/a.3" part in pattern "three/a.3[abc]", but that does not mean a true match. Don't be too optimistic and let fnmatch() do the job. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-15exclude: split basename matching code into a separate functionLibravatar Nguyễn Thái Ngọc Duy1-13/+24
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-15exclude: stricten a length check in EXC_FLAG_ENDSWITH caseLibravatar Nguyễn Thái Ngọc Duy1-2/+3
This block of code deals with the "basename" part only, which has the length of "pathlen - (basename - pathname)". Stricten the length check and remove "pathname" from the main expression to avoid confusion. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-05Merge commit 'f9f6e2c' into nd/attr-match-optim-moreLibravatar Junio C Hamano2-67/+78
* commit 'f9f6e2c': exclude: do strcmp as much as possible before fnmatch dir.c: get rid of the wildcard symbol set in no_wildcard() Unindent excluded_from_list()
2012-10-05attr: avoid searching for basename on every matchLibravatar Nguyễn Thái Ngọc Duy1-6/+9
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-05attr: avoid strlen() on every matchLibravatar Nguyễn Thái Ngọc Duy1-2/+4
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-14Git 1.7.11.7Libravatar Junio C Hamano4-3/+50
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-14Merge branch 'jk/maint-quiet-is-synonym-to-s-in-log' into maint-1.7.11Libravatar Junio C Hamano2-1/+13
* jk/maint-quiet-is-synonym-to-s-in-log: log: fix --quiet synonym for -s
2012-09-14Merge branch 'jc/maint-ident-missing-human-name' into maint-1.7.11Libravatar Junio C Hamano2-3/+20
* jc/maint-ident-missing-human-name: split_ident_line(): make best effort when parsing author/committer line
2012-09-14Merge branch 'rj/test-regex' into maint-1.7.11Libravatar Junio C Hamano4-0/+27
* rj/test-regex: test-regex: Add a test to check for a bug in the regex routines
2012-09-14Merge branch 'da/gitk-reload-tag-contents' into maint-1.7.11Libravatar Junio C Hamano1-8/+9
* da/gitk-reload-tag-contents: gitk: Rename 'tagcontents' to 'cached_tagcontent' gitk: Teach "Reread references" to reload tags gitk: Avoid Meta1-F5
2012-09-14Merge branch 'jc/maint-checkout-fileglob-doc' into maint-1.7.11Libravatar Junio C Hamano2-1/+30
* jc/maint-checkout-fileglob-doc: gitcli: contrast wildcard given to shell and to git gitcli: formatting fix Document file-glob for "git checkout -- '*.c'"
2012-09-12Merge branch 'jc/apply-binary-p0' into maint-1.7.11Libravatar Junio C Hamano2-46/+76
"git apply -p0" did not parse pathnames on "diff --git" line correctly. This caused patches that had pathnames in no other places to be mistakenly rejected (most notably, binary patch that does not rename nor change mode). Textual patches, renames or mode changes have preimage and postimage pathnames in different places in a form that can be parsed unambiguously and did not suffer from this problem. * jc/apply-binary-p0: apply: compute patch->def_name correctly under -p0
2012-09-12Merge branch 'jc/dotdot-is-parent-directory' into maint-1.7.11Libravatar Junio C Hamano5-4/+56
"git log .." errored out saying it is both rev range and a path when there is no disambiguating "--" is on the command line. Update the command line parser to interpret ".." as a path in such a case. * jc/dotdot-is-parent-directory: specifying ranges: we did not mean to make ".." an empty set
2012-09-12Merge branch 'jc/maint-doc-checkout-b-always-takes-branch-name' into ↵Libravatar Junio C Hamano1-3/+3
maint-1.7.11 The synopsis said "checkout [-B branch]" to make it clear the branch name is a parameter to the option, but the heading for the option description was "-B::", not "-B branch::", making the documentation misleading. * jc/maint-doc-checkout-b-always-takes-branch-name: doc: "git checkout -b/-B/--orphan" always takes a branch name
2012-09-12Merge branch 'jk/maint-http-half-auth-push' into maint-1.7.11Libravatar Junio C Hamano9-106/+171
Pushing to smart HTTP server with recent Git fails without having the username in the URL to force authentication, if the server is configured to allow GET anonymously, while requiring authentication for POST. * jk/maint-http-half-auth-push: http: prompt for credentials on failed POST http: factor out http error code handling t: test http access to "half-auth" repositories t: test basic smart-http authentication t/lib-httpd: recognize */smart/* repos as smart-http t/lib-httpd: only route auth/dumb to dumb repos t5550: factor out http auth setup t5550: put auth-required repo in auth/dumb
2012-09-12Merge branch 'kk/maint-for-each-ref-multi-sort' into maint-1.7.11Libravatar Junio C Hamano2-1/+13
"git for-each-ref" did not honor multiple "--sort=<key>" arguments correctly. * kk/maint-for-each-ref-multi-sort: for-each-ref: Fix sort with multiple keys t6300: test sort with multiple keys
2012-09-11Git 1.7.11.6Libravatar Junio C Hamano3-35/+58
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-11Merge branch 'jc/maint-mergetool-style-fix' into maint-1.7.11Libravatar Junio C Hamano1-273/+308
* jc/maint-mergetool-style-fix: mergetool: style fixes
2012-09-11Merge branch 'sz/submodule-force-update' into maint-1.7.11Libravatar Junio C Hamano3-2/+21
* sz/submodule-force-update: Make 'git submodule update --force' always check out submodules.
2012-09-11Merge branch 'ph/stash-rerere' into maint-1.7.11Libravatar Junio C Hamano2-0/+39
* ph/stash-rerere: stash: invoke rerere in case of conflict test: git-stash conflict sets up rerere
2012-09-11Merge branch 'jc/maint-sane-execvp-notdir' into maint-1.7.11Libravatar Junio C Hamano1-0/+2
* jc/maint-sane-execvp-notdir: sane_execvp(): ignore non-directory on $PATH
2012-09-11Merge branch 'jc/maint-config-exit-status' into maint-1.7.11Libravatar Junio C Hamano3-6/+11
* jc/maint-config-exit-status: config: "git config baa" should exit with status 1
2012-09-11Merge branch 'mh/maint-config-doc-proxy-command' into maint-1.7.11Libravatar Junio C Hamano1-2/+2
* mh/maint-config-doc-proxy-command: git-config doc: unconfuse an example git-config.txt: fix example
2012-09-11Merge branch 'hv/submodule-path-unmatch' into maint-1.7.11Libravatar Junio C Hamano2-7/+52
* hv/submodule-path-unmatch: Let submodule command exit with error status if path does not exist
2012-09-11Merge branch 'mz/empty-rebase-test' into maint-1.7.11Libravatar Junio C Hamano1-1/+17
* mz/empty-rebase-test: add tests for 'git rebase --keep-empty'
2012-09-11Merge branch 'jk/docs-docbook-monospace-display' into maint-1.7.11Libravatar Junio C Hamano2-3/+3
* jk/docs-docbook-monospace-display: docs: monospace listings in docbook output
2012-09-11Merge branch 'ab/diff-write-incomplete-line' into maint-1.7.11Libravatar Junio C Hamano2-0/+31
* ab/diff-write-incomplete-line: Fix '\ No newline...' annotation in rewrite diffs
2012-09-11Merge branch 'jc/maint-t7406-rev-parse-max-count-huh' into maint-1.7.11Libravatar Junio C Hamano1-8/+8
* jc/maint-t7406-rev-parse-max-count-huh: t7406: fix misleading "rev-parse --max-count=1 HEAD"
2012-09-11Merge branch 'tr/void-diff-setup-done' into maint-1.7.11Libravatar Junio C Hamano13-32/+16
* tr/void-diff-setup-done: diff_setup_done(): return void
2012-09-11Merge branch 'tr/merge-recursive-flush' into maint-1.7.11Libravatar Junio C Hamano1-18/+1
* tr/merge-recursive-flush: merge-recursive: eliminate flush_buffer() in favor of write_in_full()
2012-09-11Merge branch 'nd/index-errno' into maint-1.7.11Libravatar Junio C Hamano1-5/+1
* nd/index-errno: read_index_from: remove bogus errno assignments
2012-09-11Merge branch 'pg/maint-apply-remove-unused-variable' into maint-1.7.11Libravatar Junio C Hamano1-1/+0
* pg/maint-apply-remove-unused-variable: apply: delete unused deflate_origlen from patch struct
2012-09-10Almost 1.7.11.6Libravatar Junio C Hamano1-1/+29
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-10Merge branch 'mg/rebase-i-onto-reflog-in-full' into maint-1.7.11Libravatar Junio C Hamano1-2/+1
The reflog entries left by "git rebase" and "git rebase -i" were inconsistent (the interactive one gave an abbreviated object name). * mg/rebase-i-onto-reflog-in-full: rebase -i: use full onto sha1 in reflog
2012-09-10Merge branch 'jc/maint-protect-sh-from-ifs' into maint-1.7.11Libravatar Junio C Hamano1-0/+4
When the user exports a non-default IFS without HT, scripts that rely on being able to parse "ls-files -s | while read a b c..." start to fail. Protect them from such a misconfiguration. * jc/maint-protect-sh-from-ifs: sh-setup: protect from exported IFS