What's cooking in git.git (Jan 2013, #02; Thu, 3)
Subsystems (2)
Here are the topics that have been cooking. Commits prefixed with '-' are only in 'pu' (proposed updates) while commits prefixed with '+' are in 'next'.
The post 1.8.1 cycle has started, and about a dozen topics (mostly fixes) have graduated to the 'master' branch. The second batch will follow shortly.
As usual, this cycle is expected to last for 8 to 10 weeks. To ensure the quality of the end result, let's merge topics in flight earlier than previous cycles to 'next' and fix issues in-tree.
You can find the changes described here in the integration branches of the repositories listed at
http://git-blame.blogspot.com/p/git-public-repositories.html
--------------------------------------------------
[New Topics]
* jn/less-reconfigure (2013-01-02) 1 commit
(merged to 'next' on 2013-01-02 at e5cd6cf)
+ build: do not automatically reconfigure unless configure.ac changed
When autoconf is used, any build on a different commit always ran "config.status --recheck" even when unnecessary.
* ap/merge-stop-at-prepare-commit-msg-failure (2013-01-03) 1 commit
- merge: Honor prepare-commit-msg return code
"git merge" started calling prepare-commit-msg hook like "git commit" does some time ago, but forgot to pay attention to the exit status of the hook. t7505 may want a general clean-up but that is a different topic.
Will merge to 'next'.
* tb/test-shell-lint (2013-01-02) 1 commit
- test: Add check-non-portable-shell.pl
Check for common mistakes in the test scripts, based on simple pattern-matching.
Will merge to 'next'.
* jk/enable-test-lint-by-default (2013-01-03) 1 commit
- tests: turn on test-lint by default
We had two simple and quick tests to catch common mistakes when writing test scripts, but they weren't run by default when running tests.
Will merge to 'next'.
--------------------------------------------------
[Graduated to "master"]
* as/test-tweaks (2012-12-20) 7 commits
(merged to 'next' on 2012-12-22 at 7312c6c)
+ tests: paint unexpectedly fixed known breakages in bold red
+ tests: test the test framework more thoroughly
+ tests: refactor mechanics of testing in a sub test-lib
+ tests: change info messages from yellow/brown to cyan
+ tests: paint skipped tests in blue
+ tests: paint known breakages in yellow
+ tests: test number comes first in 'not ok $count - $message'
Output from the tests is coloured using "green is okay, yellow is questionable, red is bad and blue is informative" scheme.
* da/p4merge-mktemp (2012-12-26) 1 commit
(merged to 'next' on 2012-12-26 at 036938a)
+ mergetools/p4merge: Honor $TMPDIR for the /dev/null placeholder
Create an empty file in $TMPDIR instead of using an empty file in the local directory.
* dm/port (2012-12-19) 4 commits
(merged to 'next' on 2012-12-22 at 8adc198)
+ git-compat-util.h: do not #include <sys/param.h> by default
+ Generalize the inclusion of strings.h
+ Detect when the passwd struct is missing pw_gecos
+ Support builds when sys/param.h is missing
(this branch is used by mk/qnx.)
Add a few more knobs for new platform ports can tweak.
* jc/maint-fbsd-sh-ifs-workaround (2012-12-10) 1 commit (merged to 'next' on 2012-12-11 at 6659fdc)
+ sh-setup: work around "unset IFS" bug in some shells
Some shells do not behave correctly when IFS is unset; work it around by explicitly setting it to the default value.
* jc/maint-fnmatch-old-style-definition (2012-12-19) 1 commit (merged to 'next' on 2012-12-22 at 540df2c)
+ compat/fnmatch: update old-style definition to ANSI
Update old-style function definition "int foo(bar) int bar; {}" to "int foo(int bar) {}".
* jc/maint-test-portability (2012-12-19) 3 commits (merged to 'next' on 2012-12-22 at daeed53)
+ t4014: fix arguments to grep
+ t9502: do not assume GNU tar
+ t0200: "locale" may not exist
(this branch is used by jc/test-portability.)
Minor test fixes noticed while running our tests on OpenBSD 5.2, applicable to 'maint'.
* jc/mkstemp-more-careful-error-reporting (2012-12-18) 1 commit (merged to 'next' on 2012-12-22 at 18cdaf0)
+ xmkstemp(): avoid showing truncated template more carefully
After failing to create a temporary file using mkstemp(), failing pathname was not reported correctly on some platforms.
* jc/same-encoding (2012-12-10) 1 commit
(merged to 'next' on 2012-12-17 at 86b41c7)
+ format_commit_message(): simplify calls to logmsg_reencode()
Finishing touches to the series to unify "Do we need to reencode between these two encodings?" logic.
* jc/test-cvs-no-init-in-existing-dir (2012-12-24) 1 commit (merged to 'next' on 2012-12-26 at 3b93f37)
+ t9200: let "cvs init" create the test repository
t9200 runs "cvs init" on a directory that already exists, but a platform can configure this fail for the current user (e.g. you need to be in the cvsadmin group on NetBSD 6.0).
* jc/test-portability (2012-12-19) 3 commits
(merged to 'next' on 2012-12-22 at 123041b)
+ t9020: use configured Python to run the test helper
+ t3600: Avoid "cp -a", which is a GNUism
+ Merge branch 'jc/maint-test-portability' into 'jc/test-portability' (this branch uses jc/maint-test-portability.)
The remainder of jc/maint-test-portability, applicable to 'master'.
* jk/repack-ref-racefix (2012-12-21) 1 commit (merged to 'next' on 2012-12-22 at 03e1ca9)
+ refs: do not use cached refs in repack_without_ref
"git pack-refs" that ran in parallel to another process that created new refs had a nasty race.
* md/gitweb-sort-by-age (2012-12-11) 1 commit
(merged to 'next' on 2012-12-13 at 9f39410)
+ gitweb: Sort projects with undefined ages last
Gitweb showed repositories without any commit at the top in its age-sorted view, in which the users are interested in looking at active projects; sorting them at the bottom makes it more useful.
* mh/ceiling (2012-10-29) 8 commits
(merged to 'next' on 2012-11-26 at d1ce76a)
+ string_list_longest_prefix(): remove function
+ setup_git_directory_gently_1(): resolve symlinks in ceiling paths
+ longest_ancestor_length(): require prefix list entries to be normalized
+ longest_ancestor_length(): take a string_list argument for prefixes
+ longest_ancestor_length(): use string_list_split()
+ Introduce new function real_path_if_valid()
+ real_path_internal(): add comment explaining use of cwd
+ Introduce new static function real_path_internal()
Elements of GIT_CEILING_DIRECTORIES list may not match the real pathname we obtain from getcwd(), leading the GIT_DIR discovery logic to escape the ceilings the user thought to have specified.
* mh/pthreads-autoconf (2012-11-27) 1 commit (merged to 'next' on 2012-11-28 at 780600e)
+ configure.ac: fix pthreads detection on Mac OS X
* mk/maint-graph-infinity-loop (2012-09-25) 1 commit (merged to 'next' on 2012-12-26 at 2ff59ab)
+ graph.c: infinite loop in git whatchanged --graph -m
The --graph code fell into infinite loop when asked to do what the code did not expect ;-)
* mk/qnx (2012-12-19) 2 commits
(merged to 'next' on 2012-12-22 at 0473197)
+ Port to QNX
+ Make lock local to fetch_pack
(this branch uses dm/port.)
Port to QNX.
* ms/subtree-fixlets (2012-12-22) 2 commits
(merged to 'next' on 2012-12-26 at 1cb26eb)
+ git-subtree: fix typo in manpage
+ git-subtree: ignore git-subtree executable
* nd/invalidate-i-t-a-cache-tree (2012-12-15) 4 commits (merged to 'next' on 2012-12-18 at 33e4488)
+ cache-tree: invalidate i-t-a paths after generating trees
+ cache-tree: fix writing cache-tree when CE_REMOVE is present
+ cache-tree: replace "for" loops in update_one with "while" loops
+ cache-tree: remove dead i-t-a code in verify_cache()
Writing out a tree object when you still have intent-to-add entries in the index left an incorrect cache-tree data there.
* pf/editor-ignore-sigint (2012-12-02) 5 commits (merged to 'next' on 2012-12-07 at 6b04419)
+ launch_editor: propagate signals from editor to git
+ run-command: do not warn about child death from terminal
+ launch_editor: ignore terminal signals while editor has control
+ launch_editor: refactor to use start/finish_command
+ run-command: drop silent_exec_failure arg from wait_or_whine
The behaviour visible to the end users was confusing, when they attempt to kill a process spawned in the editor that was in turn launched by Git with SIGINT (or SIGQUIT), as Git would catch that signal and die. We ignore these signals now.
* rb/http-cert-cred-no-username-prompt (2012-12-21) 1 commit (merged to 'next' on 2012-12-22 at 9fc28ed)
+ http.c: Avoid username prompt for certifcate credentials
It is wrong to ask for username if the authentication is done by certificate identity.
* sp/shortlog-missing-lf (2012-12-11) 2 commits (merged to 'next' on 2012-12-11 at 64b8429)
+ strbuf_add_wrapped*(): Remove unused return value
+ shortlog: fix wrapping lines of wraplen
When a line to be wrapped has a solid run of non space characters whose length exactly is the wrap width, "git shortlog -w" failed to add a newline after such a line.
* ss/nedmalloc-compilation (2012-12-11) 1 commit
(merged to 'next' on 2012-12-13 at c1f0d7f)
+ nedmalloc: Fix a compile warning (exposed as error) with GCC 4.7.2
* ss/svn-prompt (2012-12-17) 3 commits
(merged to 'next' on 2012-12-26 at 1012ae2)
+ git-svn, perl/Git.pm: extend and use Git->prompt method for querying users
+ perl/Git.pm: Honor SSH_ASKPASS as fallback if GIT_ASKPASS is not set
+ git-svn, perl/Git.pm: add central method for prompting passwords
Tweak the way "git svn" asks for password to be in line with the rest of the system, so that the same SSH/GIT_ASKPASS can be used.
--------------------------------------------------
[Stalled]
* jl/submodule-deinit (2012-12-04) 1 commit
(merged to 'next' on 2012-12-07 at ea772f0)
+ submodule: add 'deinit' command
There was no Porcelain way to say "I no longer am interested in this submodule", once you express your interest in a submodule with "submodule init". "submodule deinit" is the way to do so.
But this does not yet do so (does not remove the checkout of the submodule). The design discussion petered out.
http://thread.gmane.org/gmane.comp.version-control.git/210867/focus=211456
Will kick back to 'pu'.
* jc/doc-maintainer (2012-11-27) 1 commit
- update "howto maintain git"
An early draft that is still incomplete.
* jk/lua-hackery (2012-10-07) 6 commits
- pretty: fix up one-off format_commit_message calls
- Minimum compilation fixup
- Makefile: make "lua" a bit more configurable
- add a "lua" pretty format
- add basic lua infrastructure
- pretty: make some commit-parsing helpers more public
Interesting exercise. When we do this for real, we probably would want to wrap a commit to make it more like an "object" with methods like "parents", etc.
* rc/maint-complete-git-p4 (2012-09-24) 1 commit
(merged to 'next' on 2012-10-29 at af52cef)
+ Teach git-completion about git p4
Comment from Pete will need to be addressed ($gmane/206172).
Will kick back to 'pu'.
* jc/maint-name-rev (2012-09-17) 7 commits
- describe --contains: use "name-rev --algorithm=weight"
- name-rev --algorithm=weight: tests and documentation
- name-rev --algorithm=weight: cache the computed weight in notes
- name-rev --algorithm=weight: trivial optimization
- name-rev: --algorithm option
- name_rev: clarify the logic to assign a new tip-name to a commit
- name-rev: lose unnecessary typedef
"git name-rev" names the given revision based on a ref that can be reached in the smallest number of steps from the rev, but that is not useful when the caller wants to know which tag is the oldest one that contains the rev. This teaches a new mode to the command that uses the oldest ref among those which contain the rev.
I am not sure if this is worth it; for one thing, even with the help from notes-cache, it seems to make the "describe --contains" even slower. Also the command will be unusably slow for a user who does not have a write access (hence unable to create or update the notes-cache).
Stalled mostly due to lack of responses.
* jc/xprm-generation (2012-09-14) 1 commit
- test-generation: compute generation numbers and clock skews
A toy to analyze how bad the clock skews are in histories of real world projects.
Stalled mostly due to lack of responses.
* jc/blame-no-follow (2012-09-21) 2 commits
- blame: pay attention to --no-follow
- diff: accept --no-follow option
Teaches "--no-follow" option to "git blame" to disable its whole-file rename detection.
Stalled mostly due to lack of responses.
* jc/add-delete-default (2012-08-13) 1 commit
- git add: notice removal of tracked paths by default
"git add dir/" updated modified files and added new files, but does not notice removed files, which may be "Huh?" to some users. They can of course use "git add -A dir/", but why should they?
Resurrected from graveyard, as I thought it was a worthwhile thing to do in the longer term.
Waiting for comments.
* mb/remote-default-nn-origin (2012-07-11) 6 commits
- Teach get_default_remote to respect remote.default.
- Test that plain "git fetch" uses remote.default when on a detached HEAD.
- Teach clone to set remote.default.
- Teach "git remote" about remote.default.
- Teach remote.c about the remote.default configuration setting.
- Rename remote.c's default_remote_name static variables.
When the user does not specify what remote to interact with, we often attempt to use 'origin'. This can now be customized via a configuration variable.
Expecting a reroll.
$gmane/210151
"The first remote becomes the default" bit is better done as a separate step.
--------------------------------------------------
[Cooking]
* jc/doc-default-format (2013-01-03) 2 commits
- Allow installing a non-default set of documentation
- Allow generating a non-default set of documentation
Instead of the default of generating html/man and installing man, you can control what "make doc" and "make install-doc" do via two make variables.
Will merge to 'next'.
* fc/remote-testgit-feature-done (2012-10-29) 1 commit
- remote-testgit: properly check for errors
In the longer term, tightening rules is a good thing to do, and because nobody who has worked in the remote helper area seems to be interested in reviewing this, I would assume they do not think such a retroactive tightening will affect their remote helpers. So let's advance this topic to see what happens.
* fc/remote-bzr (2013-01-02) 9 commits
- remote-bzr: detect local repositories
- remote-bzr: add support for older versions of bzr
- remote-bzr: add support to push special modes
- remote-bzr: add support for fecthing special modes
- remote-bzr: add simple tests
- remote-bzr: update working tree upon pushing
- remote-bzr: add support for remote repositories
- remote-bzr: add support for pushing
- Add new remote-bzr transport helper
New remote helper for bzr, with minimum fix squashed in.
Will merge to 'next'.
* mo/cvs-server-updates (2012-12-09) 18 commits
- t9402: Use TABs for indentation
- t9402: Rename check.cvsCount and check.list
- t9402: Simplify git ls-tree
- t9402: Add missing &&; Code style
- t9402: No space after IO-redirection
- t9402: Dont use test_must_fail cvs
- t9402: improve check_end_tree() and check_end_full_tree()
- t9402: sed -i is not portable
- cvsserver Documentation: new cvs ... -r support
- cvsserver: add t9402 to test branch and tag refs
- cvsserver: support -r and sticky tags for most operations
- cvsserver: Add version awareness to argsfromdir
- cvsserver: generalize getmeta() to recognize commit refs
- cvsserver: implement req_Sticky and related utilities
- cvsserver: add misc commit lookup, file meta data, and file listing functions
- cvsserver: define a tag name character escape mechanism
- cvsserver: cleanup extra slashes in filename arguments
- cvsserver: factor out git-log parsing logic
As nobody seems to be stepping up to review this, I am tempted to merge this to 'next and see who screams.
* jc/submittingpatches (2013-01-02) 4 commits
- SubmittingPatches: give list and maintainer addresses
- SubmittingPatches: remove overlong checklist
- SubmittingPatches: mention subsystems with dedicated repositories
- SubmittingPatches: who am I and who cares?
Will merge to 'next'.
* kb/maint-bundle-doc (2013-01-01) 2 commits
- Documentation: full-ness of a bundle is significant for cloning
- Documentation: correct example restore from bundle
Will merge to 'next'.
* nd/maint-branch-desc-doc (2013-01-03) 5 commits
- format-patch: pick up branch description when no ref is specified
- format-patch: pick up correct branch name from symbolic ref
- t4014: a few more tests on cover letter using branch description
- branch: delete branch description if it's empty
- config.txt: a few lines about branch.<name>.description
Will merge to 'next'.
* tb/test-t9020-no-which (2013-01-01) 1 commit
- t9020: which is not portable
Will merge to 'next'.
* tb/test-t9810-no-sed-i (2013-01-01) 1 commit
- t9810: Do not use sed -i
Will merge to 'next'.
* aw/rebase-am-failure-detection (2012-10-11) 1 commit (merged to 'next' on 2013-01-02 at b9db3a2)
+ rebase: Handle cases where format-patch fails
Save output from format-patch command in a temporary file, just in case it aborts, to give a better failure-case behaviour.
* ap/status-ignored-in-ignored-directory (2013-01-01) 2 commits
- git-status: Test --ignored behavior
- dir.c: Make git-status --ignored more consistent
Will merge to 'next'.
* ta/remove-stale-translated-tut (2012-12-27) 1 commit (merged to 'next' on 2013-01-02 at e70df8e)
+ Remove Documentation/pt_BR/gittutorial.txt
Remove a translation of a document that was left stale.
* er/stop-recommending-parsecvs (2012-12-28) 1 commit (merged to 'next' on 2013-01-02 at fd816dd)
+ Remove the suggestion to use parsecvs, which is currently broken.
Stop recommending a defunct third-party software.
* as/test-name-alias-uniquely (2012-12-28) 1 commit (merged to 'next' on 2013-01-02 at e297810)
+ Use longer alias names in subdirectory tests
A few short-and-bland aliases used in the tests were interfering with git-custom command in user's $PATH.
* jc/maint-fmt-merge-msg-no-edit-lose-credit (2012-12-28) 1 commit (merged to 'next' on 2013-01-02 at 8795e87)
+ merge --no-edit: do not credit people involved in the side branch
Stop spending cycles to compute information to be placed on commented lines in "merge --no-edit".
* as/check-ignore (2012-12-28) 19 commits
- Add git-check-ignore sub-command
- setup.c: document get_pathspec()
- pathspec.c: extract new validate_path() for reuse
- pathspec.c: move reusable code from builtin/add.c
- add.c: remove unused argument from validate_pathspec()
- add.c: refactor treat_gitlinks()
- dir.c: provide clear_directory() for reclaiming dir_struct memory
- dir.c: keep track of where patterns came from
- dir.c: use a single struct exclude_list per source of excludes
- dir.c: rename free_excludes() to clear_exclude_list()
- dir.c: refactor is_path_excluded()
- dir.c: refactor is_excluded()
- dir.c: refactor is_excluded_from_list()
- dir.c: rename excluded() to is_excluded()
- dir.c: rename excluded_from_list() to is_excluded_from_list()
- dir.c: rename path_excluded() to is_path_excluded()
- dir.c: rename cryptic 'which' variable to more consistent name
- Improve documentation and comments regarding directory traversal API
- api-directory-listing.txt: update to match code
Rerolled. The early parts looked mostly fine; we may want to split this into two topics and have the early half graduate sooner.
* jc/format-patch-reroll (2013-01-02) 9 commits
- format-patch: give --reroll-count a short synonym -v
- format-patch: document and test --reroll-count
- format-patch: add --reroll-count=$N option
- get_patch_filename(): split into two functions
- get_patch_filename(): drop "just-numbers" hack
- get_patch_filename(): simplify function signature
- builtin/log.c: stop using global patch_suffix
- builtin/log.c: drop redundant "numbered_files" parameter from make_cover_letter()
- builtin/log.c: drop unused "numbered" parameter from make_cover_letter()
Teach "format-patch" to prefix v4- to its output files for the fourth iteration of a patch series, to make it easier for the submitter to keep separate copies for iterations.
Will merge to 'next'.
* mz/pick-unborn (2012-12-23) 2 commits
(merged to 'next' on 2013-01-02 at 22b9951)
+ learn to pick/revert into unborn branch
+ tests: move test_cmp_rev to test-lib-functions
Allows "git cherry-pick $commit" when you do not have any history behind HEAD yet.
* nd/retire-fnmatch (2013-01-01) 7 commits
- Makefile: add USE_WILDMATCH to use wildmatch as fnmatch
- wildmatch: advance faster in <asterisk> + <literal> patterns
- wildmatch: make a special case for "*/" with FNM_PATHNAME
- test-wildmatch: add "perf" command to compare wildmatch and fnmatch
- wildmatch: support "no FNM_PATHNAME" mode
- wildmatch: make dowild() take arbitrary flags
- wildmatch: rename constants and update prototype
(this branch uses nd/wildmatch.)
Replace our use of fnmatch(3) with a more feature-rich wildmatch. A handful patches at the bottom have been moved to nd/wildmatch to graduate as part of that branch, before this series solidifies.
Will merge to 'next'.
* os/gitweb-highlight-uncaptured (2013-01-01) 1 commit
- gitweb: fix error in sanitize when highlight is enabled
Will merge to 'next'.
* jc/merge-blobs (2012-12-26) 5 commits
- merge-tree: fix d/f conflicts
- merge-tree: add comments to clarify what these functions are doing
- merge-tree: lose unused "resolve_directories"
- merge-tree: lose unused "flags" from merge_list
- Which merge_file() function do you mean?
A beginning of a new merge strategy based on the disused merge-tree proof-of-concept code.
* jk/pathspec-literal (2012-12-19) 1 commit
(merged to 'next' on 2012-12-22 at c794bd6)
+ add global --literal-pathspecs option
Allow scripts to feed literal paths to commands that take pathspecs, by disabling wildcard globbing.
Will merge to 'master'.
* er/python-version-requirements (2012-12-28) 1 commit (merged to 'next' on 2013-01-02 at 1023a3f)
+ Add checks to Python scripts for version dependencies.
Some python scripts we ship cannot be run with old versions of the interpreter.
* mb/gitweb-highlight-link-target (2012-12-20) 1 commit
- Highlight the link target line in Gitweb using CSS
Expecting a reroll.
$gmane/211935
* mz/oneway-merge-wo-u-no-lstat (2012-12-20) 1 commit (merged to 'next' on 2012-12-22 at 87bd30e)
+ oneway_merge(): only lstat() when told to update worktree
Optimize "read-tree -m <tree-ish>" without "-u".
* wk/submodule-update-remote (2012-12-19) 3 commits (merged to 'next' on 2012-12-22 at 7ddf897)
+ submodule add: If --branch is given, record it in .gitmodules
+ submodule update: add --remote for submodule's upstream changes
+ submodule: add get_submodule_config helper funtion
The beginning of 'integrate with the tip of the remote branch, not the commit recorded in the superproject gitlink' support.
Will merge to 'master'.
* cc/no-gitk-build-dependency (2012-12-18) 3 commits (merged to 'next' on 2012-12-22 at da7b2cf)
+ Makefile: replace "echo 1>..." with "echo >..."
+ Makefile: detect when PYTHON_PATH changes
+ Makefile: remove tracking of TCLTK_PATH
Remove leftover bits from an earlier change to move gitk in its own subdirectory. Reimplementing the dependency tracking rules needs to be done in gitk history separately.
Will merge to 'master'.
* jc/format-color-auto (2012-12-17) 2 commits (merged to 'next' on 2012-12-18 at 5aaac94)
+ log --format: teach %C(auto,black) to respect color config
+ t6006: clean up whitespace
Introduce "log --format=%C(auto,blue)Foo%C(auto,reset)" that does not color its output when writing to a non-terminal.
Will merge to 'master'.
* zk/clean-report-failure (2013-01-02) 2 commits
- (SQUASH???) fix-up only the trivial bits
- git-clean: Display more accurate delete messages
"git clean" states what it is going to remove and then goes on to remove it, but sometimes it only discovers things that cannot be removed after recursing into a directory, which makes the output confusing and even wrong.
Rerolled, and comments sent.
* mp/complete-paths (2012-12-21) 1 commit
- git-completion.bash: add support for path completion
The completion script used to let the default completer to suggest pathnames, which gave too many irrelevant choices (e.g. "git add" would not want to add an unmodified path). Teach it to use a more git-aware logic to enumerate only relevant ones.
Waiting for area-experts' review.
* ja/directory-attrs (2012-12-17) 1 commit
(merged to 'next' on 2012-12-17 at ced8e73)
+ Add directory pattern matching to attributes
The attribute mechanism didn't allow limiting attributes to be applied to only a single directory itself with "path/" like the exclude mechanism does.
Will merge to 'master'.
* jk/mailmap-from-blob (2012-12-13) 5 commits (merged to 'next' on 2012-12-17 at 14b7cdc)
+ mailmap: default mailmap.blob in bare repositories
+ mailmap: fix some documentation loose-ends for mailmap.blob
+ mailmap: clean up read_mailmap error handling
+ mailmap: support reading mailmap from blobs
+ mailmap: refactor mailmap parsing for non-file sources
Allow us to read, and default to read, mailmap files from the tip of the history in bare repositories. This will help running tools like shortlog in server settings.
Will merge to 'master'.
* jk/complete-commit-c (2012-12-15) 1 commit
(merged to 'next' on 2012-12-18 at 75b5f21)
+ completion: complete refs for "git commit -c"
Complete "git commmit -c foo<TAB>" into a refname that begins with "foo".
Will merge to 'master'.
* jk/error-const-return (2012-12-15) 2 commits (merged to 'next' on 2012-12-22 at bf2b1cd)
+ silence some -Wuninitialized false positives
+ make error()'s constant return value more visible
Help compilers' flow analysis by making it more explicit that error() always returns -1, to reduce false "variable used uninitialized" warnings. Looks somewhat ugly but not too much.
Will merge to 'master'.
* ap/log-mailmap (2012-12-27) 10 commits
- log --use-mailmap: optimize for cases without --author/--committer search
- log: add log.mailmap configuration option
- log: grep author/committer using mailmap
- test: Add test for --use-mailmap option
- log: Add --use-mailmap option
- pretty: Use mailmap to display username and email
- mailmap: Add mailmap structure to rev_info and pp
- mailmap: Simplify map_user() interface
- mailmap: Remove buffer length limit in map_user
- Use split_ident_line to parse author and committer
(this branch is used by jc/mailmap.)
Clean up various codepaths around mailmap and teach the "log" machinery to use it.
Expecting a reroll.
$gmane/212426
* jc/fetch-ignore-symref (2012-12-11) 1 commit
(merged to 'next' on 2012-12-17 at 370e2c8)
+ fetch: ignore wildcarded refspecs that update local symbolic refs
Avoid false error from an attempt to update local symbolic ref via fetch.
Will merge to 'master'.
* bc/append-signed-off-by (2013-01-01) 12 commits
- t4014: do not use echo -n
- Unify appending signoff in format-patch, commit and sequencer
- format-patch: update append_signoff prototype
- format-patch: stricter S-o-b detection
- t4014: more tests about appending s-o-b lines
- sequencer.c: teach append_signoff to avoid adding a duplicate newline
- sequencer.c: teach append_signoff how to detect duplicate s-o-b
- sequencer.c: always separate "(cherry picked from" from commit body
- sequencer.c: recognize "(cherry picked from ..." as part of s-o-b footer
- t/t3511: add some tests of 'cherry-pick -s' functionality
- t/test-lib-functions.sh: allow to specify the tag name to test_commit
- sequencer.c: remove broken support for rfc2822 continuation in footer
Expecting a reroll.
$gmane/212507
* mh/unify-xml-in-imap-send-and-http-push (2012-12-02) 8 commits (merged to 'next' on 2012-12-03 at d677090)
+ wrap_in_html(): process message in bulk rather than line-by-line
+ wrap_in_html(): use strbuf_addstr_xml_quoted()
+ imap-send: change msg_data from storing (ptr, len) to storing strbuf
+ imap-send: correctly report errors reading from stdin
+ imap-send: store all_msgs as a strbuf
+ lf_to_crlf(): NUL-terminate msg_data::data
+ xml_entities(): use function strbuf_addstr_xml_quoted()
+ Add new function strbuf_add_xml_quoted()
Update imap-send to reuse xml quoting code from http-push codepath, clean up some code, and fix a small bug.
Will merge to 'master'.
* jk/fsck-dot-in-trees (2012-11-28) 2 commits
(merged to 'next' on 2012-11-28 at 519dabc)
+ fsck: warn about ".git" in trees
+ fsck: warn about '.' and '..' in trees
Will merge to 'master'.
* jn/warn-on-inaccessible-loosen (2012-10-14) 4 commits (merged to 'next' on 2012-11-28 at 43d51c2)
+ config: exit on error accessing any config file
+ doc: advertise GIT_CONFIG_NOSYSTEM
+ config: treat user and xdg config permission problems as errors
+ config, gitignore: failure to access with ENOTDIR is ok
Deal with a situation where .config/git is a file and we notice .config/git/config is not readable due to ENOTDIR, not ENOENT.
* fc/fast-export-fixes (2012-12-03) 15 commits (merged to 'next' on 2012-12-03 at f9df523)
+ fast-export: make sure updated refs get updated
+ fast-export: don't handle uninteresting refs
+ fast-export: fix comparison in tests
+ fast-export: trivial cleanup
+ remote-testgit: implement the "done" feature manually
+ remote-testgit: report success after an import
+ remote-testgit: exercise more features
+ remote-testgit: cleanup tests
+ remote-testgit: remove irrelevant test
+ remote-testgit: remove non-local functionality
+ Add new simplified git-remote-testgit
+ Rename git-remote-testgit to git-remote-testpy
+ remote-helpers: fix failure message
+ remote-testgit: fix direction of marks
+ fast-export: avoid importing blob marks
Will merge to 'master'.
* jc/apply-trailing-blank-removal (2012-10-12) 1 commit (merged to 'next' on 2012-11-26 at 3af69e7)
+ apply.c:update_pre_post_images(): the preimage can be truncated
Fix to update_pre_post_images() that did not take into account the possibility that whitespace fix could shrink the preimage and change the number of lines in it.
* nd/pathspec-wildcard (2012-11-26) 4 commits
(merged to 'next' on 2012-12-03 at eca0fcb)
+ tree_entry_interesting: do basedir compare on wildcard patterns when possible
+ pathspec: apply "*.c" optimization from exclude
+ pathspec: do exact comparison on the leading non-wildcard part
+ pathspec: save the non-wildcard length part
Will merge to 'master'.
* nd/wildmatch (2013-01-01) 18 commits
(merged to 'next' on 2013-01-01 at 8c633a5)
+ wildmatch: replace variable 'special' with better named ones
+ compat/fnmatch: respect NO_FNMATCH* even on glibc
+ wildmatch: fix "**" special case
(merged to 'next' on 2012-12-15 at c734714)
+ t3070: Disable some failing fnmatch tests
(merged to 'next' on 2012-11-21 at 151288f)
+ test-wildmatch: avoid Windows path mangling
(merged to 'next' on 2012-10-25 at 510e8df)
+ Support "**" wildcard in .gitignore and .gitattributes
+ wildmatch: make /**/ match zero or more directories
+ wildmatch: adjust "**" behavior
+ wildmatch: fix case-insensitive matching
+ wildmatch: remove static variable force_lower_case
+ wildmatch: make wildmatch's return value compatible with fnmatch
+ t3070: disable unreliable fnmatch tests
+ Integrate wildmatch to git
+ wildmatch: follow Git's coding convention
+ wildmatch: remove unnecessary functions
+ Import wildmatch from rsync
+ ctype: support iscntrl, ispunct, isxdigit and isprint
+ ctype: make sane_ctype[] const array
(this branch is used by nd/retire-fnmatch.)
Allows pathname patterns in .gitignore and .gitattributes files with double-asterisks "foo/**/bar" to match any number of directory hierarchies.
* cr/push-force-tag-update (2012-12-03) 10 commits (merged to 'next' on 2012-12-04 at af2e3a9)
+ push: allow already-exists advice to be disabled
+ push: rename config variable for more general use
+ push: cleanup push rules comment
+ push: clarify rejection of update to non-commit-ish
+ push: require force for annotated tags
+ push: require force for refs under refs/tags/
+ push: flag updates that require force
+ push: keep track of "update" state separately
+ push: add advice for rejected tag reference
+ push: return reject reasons as a bitset
Require "-f" for push to update a tag, even if it is a fast-forward.
Will merge to 'master'.
Quoted 21 lines · Junio C Hamano
* as/check-ignore (2012-12-28) 19 commits
- Add git-check-ignore sub-command
-setup.c: documentget_pathspec()
-pathspec.c: extract newvalidate_path()for reuse
-pathspec.c: move reusable code frombuiltin/add.c
-add.c: remove unused argument fromvalidate_pathspec()
-add.c: refactortreat_gitlinks()
-dir.c: provideclear_directory()for reclaimingdir_structmemory
-dir.c: keep track of where patterns came from
-dir.c: use a single structexclude_listper source of excludes
-dir.c: renamefree_excludes()toclear_exclude_list()
-dir.c: refactoris_path_excluded()
-dir.c: refactoris_excluded()
-dir.c: refactoris_excluded_from_list()
-dir.c: renameexcluded()tois_excluded()
-dir.c: renameexcluded_from_list()tois_excluded_from_list()
-dir.c: renamepath_excluded()tois_path_excluded()
-dir.c: rename cryptic 'which' variable to more consistent name
- Improve documentation and comments regarding directory traversal API
- api-directory-listing.txt: update to match code
Quoted 2 lines
Rerolled. The early parts looked mostly fine; we may want to split this into two topics and have the early half graduate sooner.
Sounds good to me. As already mentioned, I have the v4 series ready and it addresses all issues already voiced in v3, but I have postponed submitting it as per your request. Please let me know when and how to proceed, thanks!
Re: as/check-ignore (was Re: What's cooking in git.git (Jan 2013, #02; Thu, 3))
Quoted 22 lines · Adam Spiers
Quoted 21 lines · Junio C Hamano
* as/check-ignore (2012-12-28) 19 commits
- Add git-check-ignore sub-command
-setup.c: documentget_pathspec()
-pathspec.c: extract newvalidate_path()for reuse
-pathspec.c: move reusable code frombuiltin/add.c
-add.c: remove unused argument fromvalidate_pathspec()
-add.c: refactortreat_gitlinks()
-dir.c: provideclear_directory()for reclaimingdir_structmemory
-dir.c: keep track of where patterns came from
-dir.c: use a single structexclude_listper source of excludes
-dir.c: renamefree_excludes()toclear_exclude_list()
-dir.c: refactoris_path_excluded()
-dir.c: refactoris_excluded()
-dir.c: refactoris_excluded_from_list()
-dir.c: renameexcluded()tois_excluded()
-dir.c: renameexcluded_from_list()tois_excluded_from_list()
-dir.c: renamepath_excluded()tois_path_excluded()
-dir.c: rename cryptic 'which' variable to more consistent name
- Improve documentation and comments regarding directory traversal API
- api-directory-listing.txt: update to match code
Quoted 7 lines
Quoted 2 lines
Rerolled. The early parts looked mostly fine; we may want to split this into two topics and have the early half graduate sooner.
Sounds good to me. As already mentioned, I have the v4 series ready and it addresses all issues already voiced in v3, but I have postponed submitting it as per your request. Please let me know when and how to proceed, thanks!
I was planning to add a new "as/dir-c-cleanup" topic that leads to f619881 (dir.c: rename free_excludes() to clear_exclude_list(), 2012-12-27), and leave the remainder in this series. I think the earlier parts of this series up to that point should go 'next' now.
Re: as/check-ignore (was Re: What's cooking in git.git (Jan 2013, #02; Thu, 3))
Quoted 31 lines · Junio C Hamano
Quoted 22 lines · Adam Spiers
Quoted 21 lines · Junio C Hamano
* as/check-ignore (2012-12-28) 19 commits
- Add git-check-ignore sub-command
-setup.c: documentget_pathspec()
-pathspec.c: extract newvalidate_path()for reuse
-pathspec.c: move reusable code frombuiltin/add.c
-add.c: remove unused argument fromvalidate_pathspec()
-add.c: refactortreat_gitlinks()
-dir.c: provideclear_directory()for reclaimingdir_structmemory
-dir.c: keep track of where patterns came from
-dir.c: use a single structexclude_listper source of excludes
-dir.c: renamefree_excludes()toclear_exclude_list()
-dir.c: refactoris_path_excluded()
-dir.c: refactoris_excluded()
-dir.c: refactoris_excluded_from_list()
-dir.c: renameexcluded()tois_excluded()
-dir.c: renameexcluded_from_list()tois_excluded_from_list()
-dir.c: renamepath_excluded()tois_path_excluded()
-dir.c: rename cryptic 'which' variable to more consistent name
- Improve documentation and comments regarding directory traversal API
- api-directory-listing.txt: update to match codeQuoted 7 lines
Quoted 2 lines
Rerolled. The early parts looked mostly fine; we may want to split this into two topics and have the early half graduate sooner.
Sounds good to me. As already mentioned, I have the v4 series ready and it addresses all issues already voiced in v3, but I have postponed submitting it as per your request. Please let me know when and how to proceed, thanks!
Quoted 4 lines
I was planning to add a new "as/dir-c-cleanup" topic that leads to f619881 (
dir.c: renamefree_excludes()toclear_exclude_list(), 2012-12-27), and leave the remainder in this series. I think the earlier parts of this series up to that point should go 'next' now.
That sounds perfect; thanks. I'll rebase v4 on top of this and submit.
v4 cover new git check-ignore sub-command
This is the v4 re-roll of the check-ignore series, which is based on Junio's as/dir-c-cleanup topic branch f6198812 (dir.c: rename free_excludes() to clear_exclude_list(), 2012-12-27). As previously discussed, the earlier parts of the v3 series seem to be complete and are progressing to 'next'.
Since v3, I addressed the issue of newly public functions with unacceptably vague or generic names via the following steps:
- eliminated extraction from add.c to pathspec.c of two functions which did not need to be public (validate_pathspec() and treat_gitlinks())
- edited the series history to create separate commits for extraction of reusable code from treat_gitlinks() and validate_pathspec() into more carefully named public functions
This should make reviewing easier.
I will summarise the changes in the revised patches since v3 in between the "---" divider and the diffstat of each individual patch.
This series is also available via the check-ignore-v4 tag in:
git://github.com/aspiers/git.git
Adam Spiers (11):
dir.c: use a single struct exclude_list per source of excludes dir.c: keep track of where patterns came from
dir.c: provide clear_directory() for reclaiming dir_struct memory dir.c: improve docs for match_pathspec() and match_pathspec_depth() add.c: remove unused argument from validate_pathspec() add.c: move pathspec matchers into new pathspec.c for reuse pathspec.c: rename newly public functions for clarity add.c: extract check_path_for_gitlink() from treat_gitlinks() for
reuse
add.c: extract new die_if_path_beyond_symlink() for reuse setup.c: document get_pathspec()
add git-check-ignore sub-command
.gitignore | 1 + Documentation/git-check-ignore.txt | 89 +++ Documentation/gitignore.txt | 6 +- Documentation/technical/api-directory-listing.txt | 14 +- Makefile | 3 + builtin.h | 1 + builtin/add.c | 78 +-- builtin/check-ignore.c | 173 ++++++ builtin/clean.c | 3 +- builtin/ls-files.c | 9 +- command-list.txt | 1 + contrib/completion/git-completion.bash | 1 + dir.c | 152 ++++-- dir.h | 62 ++- git.c | 1 + pathspec.c | 101 ++++ pathspec.h | 9 + setup.c | 19 + t/t0008-ignores.sh | 632 ++++++++++++++++++++++ unpack-trees.c | 2 +- 20 files changed, 1240 insertions(+), 117 deletions(-) create mode 100644 Documentation/git-check-ignore.txt create mode 100644 builtin/check-ignore.c create mode 100644 pathspec.c create mode 100644 pathspec.h create mode 100755 t/t0008-ignores.sh
Signature · 1 line
1.7.11.7.33.gb8feba5
PATCH v4 1/11 dir.c: use a single struct exclude_list per source of excludes
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.
--- Documentation/technical/api-directory-listing.txt | 12 +++-- builtin/clean.c | 3 +- builtin/ls-files.c | 8 +-- dir.c | 64 ++++++++++++++++------- dir.h | 36 +++++++++---- unpack-trees.c | 2 +- 6 files changed, 86 insertions(+), 39 deletions(-)
Documentation/technical/api-directory-listing.txt +7 -5
@@ -67,11 +67,13 @@ marked. If you to exclude files, make sure you have loaded index first. * Prepare `struct dir_struct dir` and clear it with `memset(&dir, 0, sizeof(dir))`. -* Call `add_exclude()` to add single exclude pattern, - `add_excludes_from_file()` to add patterns from a file - (e.g. `.git/info/exclude`), and/or set `dir.exclude_per_dir`. A - short-hand function `setup_standard_excludes()` can be used to set up - the standard set of exclude settings. +* To add single exclude pattern, call `add_exclude_list()` and then + `add_exclude()`. + +* To add patterns from a file (e.g. `.git/info/exclude`), call + `add_excludes_from_file()` , and/or set `dir.exclude_per_dir`. A + short-hand function `setup_standard_excludes()` can be used to set + up the standard set of exclude settings. * Set options described in the Data Structure section above.
builtin/clean.c +2 -1
@@ -97,9 +97,10 @@ int cmd_clean(int argc, const char **argv, const char *prefix)if (!ignored)setup_standard_excludes (&dir); +add_exclude_list (&dir,EXC_CMDL );for (i =0 ; i < exclude_list.nr; i++)add_exclude (exclude_list.items[i].string,"" ,0 , - &dir.exclude_list[EXC_CMDL ]); + &dir.exclude_list_group[EXC_CMDL ].el[0 ]); pathspec =get_pathspec (prefix, argv);
builtin/ls-files.c +5 -3
@@ -420,10 +420,10 @@ static int option_parse_z(const struct option *opt,static int option_parse_exclude (const struct option *opt,const char *arg,int unset) { -struct exclude_list *list = opt->value; +struct exclude_list_group *group = opt->value; exc_given =1 ; -add_exclude (arg,"" ,0 , list); +add_exclude (arg,"" ,0 , &group->el[0 ]);return 0 ; }
@@ -488,7 +488,8 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) "show unmerged files in the output"),OPT_BOOLEAN (0 ,"resolve-undo" , &show_resolve_undo,"show resolve-undo information" ), - { OPTION_CALLBACK, 'x', "exclude", &dir.exclude_list[EXC_CMDL], "pattern", + { OPTION_CALLBACK, 'x', "exclude", + &dir.exclude_list_group[EXC_CMDL ],"pattern" ,"skip files matching pattern" , 0, option_parse_exclude }, { OPTION_CALLBACK, 'X', "exclude-from", &dir, "file",
@@ -523,6 +524,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)if (read_cache () <0 )die ("index file corrupt" ); +add_exclude_list (&dir,EXC_CMDL ); argc =parse_options (argc, argv, prefix, builtin_ls_files_options, ls_files_usage,0 );if (show_tag || show_valid_bit) {
dir.c +45 -19
132 lines not on this page · raw message
dir.h +26 -10
@@ -16,14 +16,18 @@ struct dir_entry {#define EXC_FLAG_NEGATIVE 16/* -* Each .gitignore file will be parsed into patterns which are then -* appended to the relevant exclude_list (either EXC_DIRS or -* EXC_FILE). exclude_lists are also used to represent the list of -* --exclude values passed via CLI args (EXC_CMDL). +* Each excludes file will be parsed into a fresh exclude_list which +* is appended to the relevant exclude_list_group (either EXC_DIRS or +* EXC_FILE). An exclude_list within the EXC_CMDL exclude_list_group +* can also be used to represent the list of --exclude values passed +* via CLI args. */ struct exclude_list {int nr;int alloc; +/* remember pointer to exclude file contents so we can free() */ +char *filebuf; +struct exclude {const char *pattern;int patternlen;
@@ -42,9 +46,13 @@ struct exclude_list {*/ struct exclude_stack {struct exclude_stack *prev;/* the struct exclude_stack for the parent directory */ -char *filebuf;/* remember pointer to per-directory exclude file contents so we can free() */ int baselen; -int exclude_ix; +int exclude_ix;/* index of exclude_list within EXC_DIRS exclude_list_group */ +}; + +struct exclude_list_group { +int nr, alloc; +struct exclude_list *el; };struct dir_struct {
@@ -62,16 +70,23 @@ struct dir_struct {/* Exclude info */ const char *exclude_per_dir; -struct exclude_list exclude_list[3 ]; +/* -* We maintain three exclude pattern lists: +* We maintain three groups of exclude pattern lists: +* * EXC_CMDL lists patterns explicitly given on the command line. * EXC_DIRS lists patterns obtained from per-directory ignore files. -* EXC_FILE lists patterns from fallback ignore files. +* EXC_FILE lists patterns from fallback ignore files, e.g. +* - .git/info/exclude +* - core.excludesfile +* +* Each group contains multiple exclude lists, a single list +* per source. */ #define EXC_CMDL 0#define EXC_DIRS 1#define EXC_FILE 2 +struct exclude_list_group exclude_list_group[3 ];/* * Temporary variables which are used during loading of the
@@ -129,8 +144,9 @@ extern struct exclude *last_exclude_matching_path(struct path_exclude_check *, cextern int is_path_excluded (struct path_exclude_check *,const char *,int namelen,int *dtype); +extern struct exclude_list *add_exclude_list (struct dir_struct *dir,int group_type);extern int add_excludes_from_file_to_list (const char *fname,const char *base,int baselen, -char **buf_p,struct exclude_list *el,int check_index); +struct exclude_list *el,int check_index);extern void add_excludes_from_file (struct dir_struct *,const char *fname);extern void parse_exclude_pattern (const char **string,int *patternlen,int *flags,int *nowildcardlen); extern void add_exclude(const char *string, const char *base,
unpack-trees.c +1 -1
@@ -1019,7 +1019,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_optionsif (!core_apply_sparse_checkout || !o->update) o->skip_sparse_checkout =1 ;if (!o->skip_sparse_checkout) { -if (add_excludes_from_file_to_list (git_path ("info/sparse-checkout" ),"" ,0 ,NULL , &el,0 ) <0 ) +if (add_excludes_from_file_to_list (git_path ("info/sparse-checkout" ),"" ,0 , &el,0 ) <0 ) o->skip_sparse_checkout =1 ;else o->el = ⪙
Signature · 1 line
1.7.11.7.33.gb8feba5
PATCH v4 2/11 dir.c: keep track of where patterns came from
In reply to Adam SpiersFor exclude patterns read in from files, the filename is stored in the exclude list, and the originating line number is stored in the individual exclude (counting starting at 1).
For exclude patterns provided on the command line, a string describing the source of the patterns is stored in the exclude list, and the sequence number assigned to each exclude pattern is negative, with counting starting at -1. So for example the 2nd pattern provided via --exclude would be numbered -2. This allows any future consumers of that data to easily distinguish between exclude patterns from files vs. from the CLI.
--- builtin/clean.c | 4 ++-- builtin/ls-files.c | 5 +++-- dir.c | 26 ++++++++++++++++++++------ dir.h | 21 +++++++++++++++++++-- 4 files changed, 44 insertions(+), 12 deletions(-)
builtin/clean.c +2 -2
@@ -97,10 +97,10 @@ int cmd_clean(int argc, const char **argv, const char *prefix)if (!ignored)setup_standard_excludes (&dir); -add_exclude_list (&dir,EXC_CMDL ); +add_exclude_list (&dir,EXC_CMDL ,"--exclude option" );for (i =0 ; i < exclude_list.nr; i++)add_exclude (exclude_list.items[i].string,"" ,0 , - &dir.exclude_list_group[EXC_CMDL ].el[0 ]); + &dir.exclude_list_group[EXC_CMDL ].el[0 ], -(i+1 )); pathspec =get_pathspec (prefix, argv);
builtin/ls-files.c +3 -2
@@ -35,6 +35,7 @@ static int error_unmatch;static char *ps_matched;static const char *with_tree;static int exc_given; +static int exclude_args;static const char *tag_cached ="" ;static const char *tag_unmerged ="" ;
@@ -423,7 +424,7 @@ static int option_parse_exclude(const struct option *opt,struct exclude_list_group *group = opt->value; exc_given =1 ; -add_exclude (arg,"" ,0 , &group->el[0 ]); +add_exclude (arg,"" ,0 , &group->el[0 ], --exclude_args);return 0 ; }
@@ -524,7 +525,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)if (read_cache () <0 )die ("index file corrupt" ); -add_exclude_list (&dir,EXC_CMDL ); +add_exclude_list (&dir,EXC_CMDL ,"--exclude option" ); argc =parse_options (argc, argv, prefix, builtin_ls_files_options, ls_files_usage,0 );if (show_tag || show_valid_bit) {
dir.c +20 -6
@@ -349,7 +349,7 @@ void parse_exclude_pattern(const char **pattern, }void add_exclude (const char *string,const char *base, -int baselen,struct exclude_list *el) +int baselen,struct exclude_list *el,int srcpos) {struct exclude *x;int patternlen;
@@ -373,8 +373,10 @@ void add_exclude(const char *string, const char *base, x->base = base; x->baselen = baselen; x->flags = flags; + x->srcpos = srcpos;ALLOC_GROW (el->excludes, el->nr +1 , el->alloc); el->excludes[el->nr++] = x; + x->el = el; }static void *read_skip_worktree_file_from_index (const char *path,size_t *size)
@@ -425,7 +427,7 @@ int add_excludes_from_file_to_list(const char *fname, int check_index) {struct stat st; -int fd, i; +int fd, i, lineno =1 ;size_t size =0 ;char *buf, *entry;
@@ -467,15 +469,17 @@ int add_excludes_from_file_to_list(const char *fname,if (buf[i] =='\n' ) {if (entry != buf + i && entry[0 ] !='#' ) { buf[i - (i && buf[i-1 ] =='\r' )] =0 ; -add_exclude (entry, base, baselen, el); +add_exclude (entry, base, baselen, el, lineno); } + lineno++; entry = buf + i +1 ; } }return 0 ; } -struct exclude_list *add_exclude_list (struct dir_struct *dir,int group_type) +struct exclude_list *add_exclude_list (struct dir_struct *dir, +int group_type,const char *src) {struct exclude_list *el;struct exclude_list_group *group;
@@ -484,6 +488,7 @@ struct exclude_list *add_exclude_list(struct dir_struct *dir, int group_type)ALLOC_GROW (group->el, group->nr +1 , group->alloc); el = &group->el[group->nr++];memset (el,0 ,sizeof (*el)); + el->src = src;return el; }
@@ -493,7 +498,7 @@ struct exclude_list *add_exclude_list(struct dir_struct *dir, int group_type)void add_excludes_from_file (struct dir_struct *dir,const char *fname) {struct exclude_list *el; - el =add_exclude_list (dir,EXC_FILE ); + el =add_exclude_list (dir,EXC_FILE , fname);if (add_excludes_from_file_to_list (fname,"" ,0 , el,0 ) <0 )die ("cannot use %s as an exclude file" , fname); }
@@ -524,6 +529,7 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)break ; el = &group->el[dir->exclude_stack->exclude_ix]; dir->exclude_stack = stk->prev; +free ((char *)el->src);/* see strdup() below */ clear_exclude_list (el);free (stk); group->nr--;
@@ -550,7 +556,15 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)memcpy (dir->basebuf + current, base + current, stk->baselen - current);strcpy (dir->basebuf + stk->baselen, dir->exclude_per_dir); - el =add_exclude_list (dir,EXC_DIRS ); +/* +* dir->basebuf gets reused by the traversal, but we +* need fname to remain unchanged to ensure the src +* member of each struct exclude correctly +* back-references its source file. Other invocations +* of add_exclude_list provide stable strings, so we +* strdup() and free() here in the caller. +*/ + el =add_exclude_list (dir,EXC_DIRS ,strdup (dir->basebuf)); stk->exclude_ix = group->nr -1 ; add_excludes_from_file_to_list(dir->basebuf, dir->basebuf, stk->baselen,
dir.h +19 -2
@@ -25,16 +25,32 @@ struct dir_entry {struct exclude_list {int nr;int alloc; +/* remember pointer to exclude file contents so we can free() */ char *filebuf; +/* origin of list, e.g. path to filename, or descriptive string */ +const char *src; +struct exclude { +/* +* This allows callers of last_exclude_matching() etc. +* to determine the origin of the matching pattern. +*/ +struct exclude_list *el; +const char *pattern;int patternlen;int nowildcardlen;const char *base;int baselen;int flags; + +/* +* Counting starts from 1 for line numbers in ignore files, +* and from -1 decrementing for patterns from CLI args. +*/ +int srcpos; } **excludes; };
@@ -144,13 +160,14 @@ extern struct exclude *last_exclude_matching_path(struct path_exclude_check *, cextern int is_path_excluded (struct path_exclude_check *,const char *,int namelen,int *dtype); -extern struct exclude_list *add_exclude_list (struct dir_struct *dir,int group_type); +extern struct exclude_list *add_exclude_list (struct dir_struct *dir, +int group_type,const char *src);extern int add_excludes_from_file_to_list (const char *fname,const char *base,int baselen,struct exclude_list *el,int check_index);extern void add_excludes_from_file (struct dir_struct *,const char *fname);extern void parse_exclude_pattern (const char **string,int *patternlen,int *flags,int *nowildcardlen);extern void add_exclude (const char *string,const char *base, -int baselen,struct exclude_list *el); +int baselen,struct exclude_list *el,int srcpos);extern void clear_exclude_list (struct exclude_list *el);extern int file_exists (const char *);
Signature · 1 line
1.7.11.7.33.gb8feba5
PATCH v4 3/11 dir.c: provide clear_directory() for reclaiming dir_struct memory
In reply to Adam SpiersBy the end of a directory traversal, a dir_struct instance will typically contains pointers to various data structures on the heap. clear_directory() provides a convenient way to reclaim that memory.
--- Documentation/technical/api-directory-listing.txt | 2 ++ dir.c | 30 +++++++++++++++++++++++ dir.h | 1 + 3 files changed, 33 insertions(+)
Documentation/technical/api-directory-listing.txt +2 -0
@@ -81,4 +81,6 @@ marked. If you to exclude files, make sure you have loaded index first. * Use `dir.entries[]`. +* Call `free_directory()` when none of the contained elements are no longer in use. + (JC)
dir.c +30 -0
@@ -1557,3 +1557,33 @@ void free_pathspec(struct pathspec *pathspec)free (pathspec->items); pathspec->items =NULL ; } + +/* +* Frees memory within dir which was allocated for exclude lists and +* the exclude_stack. Does not free dir itself. +*/ +void clear_directory (struct dir_struct *dir) +{ +int i, j; +struct exclude_list_group *group; +struct exclude_list *el; +struct exclude_stack *stk; + +for (i =EXC_CMDL ; i <=EXC_FILE ; i++) { + group = &dir->exclude_list_group[i]; +for (j =0 ; j < group->nr; j++) { + el = &group->el[j]; +if (i ==EXC_DIRS ) +free ((char *)el->src); +clear_exclude_list (el); + } +free (group->el); + } + + stk = dir->exclude_stack; +while (stk) { +struct exclude_stack *prev = stk->prev; +free (stk); + stk = prev; + } +}
dir.h +1 -0
@@ -169,6 +169,7 @@ extern void parse_exclude_pattern(const char **string, int *patternlen, int *flaextern void add_exclude (const char *string,const char *base,int baselen,struct exclude_list *el,int srcpos);extern void clear_exclude_list (struct exclude_list *el); +extern void clear_directory (struct dir_struct *dir);extern int file_exists (const char *);extern int is_inside_dir (const char *dir);
Signature · 1 line
1.7.11.7.33.gb8feba5
PATCH v4 4/11 dir.c: improve docs for match_pathspec() and match_pathspec_depth()
In reply to Adam SpiersFix a grammatical issue in the description of these functions, and make it more obvious how and why seen[] can be reused across multiple invocations.
--- dir.c | 38 ++++++++++++++++++++++++++------------ dir.h | 6 ++++++ 2 files changed, 32 insertions(+), 12 deletions(-)
dir.c +26 -12
@@ -167,12 +167,19 @@ static int match_one(const char *match, const char *name, int namelen) }/* -* Given a name and a list of pathspecs, see if the name matches -* any of the pathspecs. The caller is also interested in seeing -* all pathspec matches some names it calls this function with -* (otherwise the user could have mistyped the unmatched pathspec), -* and a mark is left in seen[] array for pathspec element that -* actually matched anything. +* Given a name and a list of pathspecs, returns the nature of the +* closest (i.e. most specific) match of the name to any of the +* pathspecs. +* +* The caller typically calls this multiple times with the same +* pathspec and seen[] array but with different name/namelen +* (e.g. entries from the index) and is interested in seeing if and +* how each pathspec matches all the names it calls this function +* with. A mark is left in the seen[] array for each pathspec element +* indicating the closest type of match that element achieved, so if +* seen[n] remains zero after multiple invocations, that means the nth +* pathspec did not match any names, which could indicate that the +* user mistyped the nth pathspec. */ int match_pathspec (const char **pathspec,const char *name,int namelen,int prefix,char *seen)
@@ -239,12 +246,19 @@ static int match_pathspec_item(const struct pathspec_item *item, int prefix, }/* -* Given a name and a list of pathspecs, see if the name matches -* any of the pathspecs. The caller is also interested in seeing -* all pathspec matches some names it calls this function with -* (otherwise the user could have mistyped the unmatched pathspec), -* and a mark is left in seen[] array for pathspec element that -* actually matched anything. +* Given a name and a list of pathspecs, returns the nature of the +* closest (i.e. most specific) match of the name to any of the +* pathspecs. +* +* The caller typically calls this multiple times with the same +* pathspec and seen[] array but with different name/namelen +* (e.g. entries from the index) and is interested in seeing if and +* how each pathspec matches all the names it calls this function +* with. A mark is left in the seen[] array for each pathspec element +* indicating the closest type of match that element achieved, so if +* seen[n] remains zero after multiple invocations, that means the nth +* pathspec did not match any names, which could indicate that the +* user mistyped the nth pathspec. */ int match_pathspec_depth(const struct pathspec *ps, const char *name, int namelen,
dir.h +6 -0
@@ -116,6 +116,12 @@ struct dir_struct {char basebuf[PATH_MAX ]; }; +/* +* The ordering of these constants is significant, with +* higher-numbered match types signifying "closer" (i.e. more +* specific) matches which will override lower-numbered match types +* when populating the seen[] array. +*/ #define MATCHED_RECURSIVELY 1#define MATCHED_FNMATCH 2#define MATCHED_EXACTLY 3
Signature · 1 line
1.7.11.7.33.gb8feba5
PATCH v4 5/11 add.c: remove unused argument from validate_pathspec()
In reply to Adam SpiersThe 'argc' argument passed to validate_pathspec() was never used.
--- builtin/add.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
builtin/add.c +3 -3
@@ -197,7 +197,7 @@ static void refresh(int verbose, const char **pathspec)free (seen); } -static const char **validate_pathspec (int argc,const char **argv,const char *prefix) +static const char **validate_pathspec (const char **argv,const char *prefix) {const char **pathspec =get_pathspec (prefix, argv);
@@ -248,7 +248,7 @@ int interactive_add(int argc, const char **argv, const char *prefix, int patch)const char **pathspec =NULL ;if (argc) { - pathspec =validate_pathspec (argc, argv, prefix); + pathspec =validate_pathspec (argv, prefix);if (!pathspec)return -1 ; }
@@ -414,7 +414,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)fprintf (stderr,_ ("Maybe you wanted to say 'git add .'?\n" ));return 0 ; } - pathspec =validate_pathspec (argc, argv, prefix); + pathspec =validate_pathspec (argv, prefix);if (read_cache () <0 )die (_ ("index file corrupt" ));
Signature · 1 line
1.7.11.7.33.gb8feba5
PATCH v4 6/11 add.c: move pathspec matchers into new pathspec.c for reuse
In reply to Adam SpiersExtract the following functions from builtin/add.c to pathspec.c, in preparation for reuse by a new git check-ignore command:
- fill_pathspec_matches()
- find_used_pathspec()
The functions being extracted are not changed in any way, except removal of the 'static' qualifier.
Also add comments documenting these newly public functions, including clarifications that they operate on the index.
---
The v3 version of this patch extracted 5 functions from add.c to pathspec.c, two of which did not need to be extracted. Here we use more fine-grained commits for extraction, and also wrap pathspec.h in a PATHSPEC_H gate to avoid duplication.
Makefile | 2 ++ builtin/add.c | 34 +--------------------------------- pathspec.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pathspec.h | 7 +++++++ 4 files changed, 67 insertions(+), 33 deletions(-) create mode 100644 pathspec.c create mode 100644 pathspec.h
Makefile +2 -0
@@ -645,6 +645,7 @@ LIB_H += pack-refs.h LIB_H += pack-revindex.h LIB_H += parse-options.h LIB_H += patch-ids.h +LIB_H += pathspec.h LIB_H += pkt-line.h LIB_H += progress.h LIB_H += prompt.h
@@ -758,6 +759,7 @@ LIB_OBJS += parse-options-cb.o LIB_OBJS += patch-delta.o LIB_OBJS += patch-ids.o LIB_OBJS += path.o +LIB_OBJS += pathspec.o LIB_OBJS += pkt-line.o LIB_OBJS += preload-index.o LIB_OBJS += pretty.o
builtin/add.c +1 -33
@@ -6,6 +6,7 @@#include "cache.h" #include "builtin.h" #include "dir.h" +#include "pathspec.h" #include "exec_cmd.h" #include "cache-tree.h" #include "run-command.h"
@@ -97,39 +98,6 @@ int add_files_to_cache(const char *prefix, const char **pathspec, int flags)return !!data.add_errors; } -static void fill_pathspec_matches (const char **pathspec,char *seen,int specs) -{ -int num_unmatched =0 , i; - -/* -* Since we are walking the index as if we were walking the directory, -* we have to mark the matched pathspec as seen; otherwise we will -* mistakenly think that the user gave a pathspec that did not match -* anything. -*/ -for (i =0 ; i < specs; i++) -if (!seen[i]) - num_unmatched++; -if (!num_unmatched) -return ; -for (i =0 ; i < active_nr; i++) { -struct cache_entry *ce = active_cache[i]; -match_pathspec (pathspec, ce->name,ce_namelen (ce),0 , seen); - } -} - -static char *find_used_pathspec (const char **pathspec) -{ -char *seen; -int i; - -for (i =0 ; pathspec[i]; i++) - ;/* just counting */ - seen =xcalloc (i,1 ); -fill_pathspec_matches (pathspec, seen, i); -return seen; -} -static char *prune_directory (struct dir_struct *dir,const char **pathspec,int prefix) {char *seen;
pathspec.c new file +57 -0
57 lines not on this page · raw message
pathspec.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef PATHSPEC_H +#define PATHSPEC_H + +extern char *find_used_pathspec (const char **pathspec); +extern void fill_pathspec_matches (const char **pathspec,char *seen,int specs); + +#endif /* PATHSPEC_H */
Signature · 1 line
1.7.11.7.33.gb8feba5
PATCH v4 7/11 pathspec.c: rename newly public functions for clarity
In reply to Adam SpiersPerform the following function renames to make it explicit that these pathspec handling functions are for matching against the index, rather than against a tree or the working directory.
- fill_pathspec_matches() -> add_pathspec_matches_against_index()
- find_used_pathspec() -> find_pathspecs_matching_against_index()
--- builtin/add.c | 4 ++-- pathspec.c | 17 +++++++++-------- pathspec.h | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-)
builtin/add.c +2 -2
@@ -117,7 +117,7 @@ static char *prune_directory(struct dir_struct *dir, const char **pathspec, int *dst++ = entry; } dir->nr = dst - dir->entries; -fill_pathspec_matches (pathspec, seen, specs); +add_pathspec_matches_against_index (pathspec, seen, specs);return seen; }
@@ -415,7 +415,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)path_exclude_check_init (&check, &dir);if (!seen) - seen =find_used_pathspec (pathspec); + seen =find_pathspecs_matching_against_index (pathspec);for (i =0 ; pathspec[i]; i++) {if (!seen[i] && pathspec[i][0 ] && !file_exists (pathspec[i])) {
pathspec.c +9 -8
@@ -13,9 +13,10 @@* altogether if seen[] already only contains non-zero entries. * * If seen[] has not already been written to, it may make sense -* to use find_used_pathspec() instead. +* to use find_pathspecs_matching_against_index() instead. */ -void fill_pathspec_matches (const char **pathspec,char *seen,int specs) +void add_pathspec_matches_against_index (const char **pathspec, +char *seen,int specs) {int num_unmatched =0 , i;
@@ -39,12 +40,12 @@ void fill_pathspec_matches(const char **pathspec, char *seen, int specs)/* * Finds which of the given pathspecs match items in the index. * -* This is a one-shot wrapper around fill_pathspec_matches() which -* allocates, populates, and returns a seen[] array indicating the -* nature of the "closest" (i.e. most specific) matches which each of -* the given pathspecs achieves against all items in the index. +* This is a one-shot wrapper around add_pathspec_matches_against_index() +* which allocates, populates, and returns a seen[] array indicating the +* nature of the "closest" (i.e. most specific) matches which each of the +* given pathspecs achieves against all items in the index. */ -char *find_used_pathspec (const char **pathspec) +char *find_pathspecs_matching_against_index (const char **pathspec) {char *seen;int i;
@@ -52,6 +53,6 @@ char *find_used_pathspec(const char **pathspec)for (i =0 ; pathspec[i]; i++) ;/* just counting */ seen =xcalloc (i,1 ); -fill_pathspec_matches (pathspec, seen, i); +add_pathspec_matches_against_index (pathspec, seen, i);return seen; }
pathspec.h +2 -2
@@ -1,7 +1,7 @@#ifndef PATHSPEC_H #define PATHSPEC_H -extern char *find_used_pathspec (const char **pathspec); -extern void fill_pathspec_matches (const char **pathspec,char *seen,int specs); +extern char *find_pathspecs_matching_against_index (const char **pathspec); +extern void add_pathspec_matches_against_index (const char **pathspec,char *seen,int specs);#endif /* PATHSPEC_H */
Signature · 1 line
1.7.11.7.33.gb8feba5
PATCH v4 8/11 add.c: extract check_path_for_gitlink() from treat_gitlinks() for reuse
In reply to Adam SpiersExtract the body of the for loop in treat_gitlinks() into a separate check_path_for_gitlink() function so that it can be reused elsewhere. This paves the way for a new check-ignore sub-command.
Also document treat_gitlinks().
---
Unlike v3, this series doesn't make treat_gitlinks() public.
builtin/add.c | 24 ++++++------------------ pathspec.c | 31 +++++++++++++++++++++++++++++++ pathspec.h | 1 + 3 files changed, 38 insertions(+), 18 deletions(-)
builtin/add.c +6 -18
@@ -121,6 +121,10 @@ static char *prune_directory(struct dir_struct *dir, const char **pathspec, intreturn seen; } +/* +* Checks the index to see whether any path in pathspec refers to +* something inside a submodule. If so, dies with an error message. +*/ static void treat_gitlinks (const char **pathspec) {int i;
@@ -128,24 +132,8 @@ static void treat_gitlinks(const char **pathspec)if (!pathspec || !*pathspec)return ; -for (i =0 ; i < active_nr; i++) { -struct cache_entry *ce = active_cache[i]; -if (S_ISGITLINK (ce->ce_mode)) { -int len =ce_namelen (ce), j; -for (j =0 ; pathspec[j]; j++) { -int len2 =strlen (pathspec[j]); -if (len2 <= len || pathspec[j][len] !='/' || -memcmp (ce->name, pathspec[j], len)) -continue ; -if (len2 == len +1 ) -/* strip trailing slash */ - pathspec[j] =xstrndup (ce->name, len); -else -die (_ ("Path '%s' is in submodule '%.*s'" ), - pathspec[j], len, ce->name); - } - } - } +for (i =0 ; pathspec[i]; i++) + pathspec[i] =check_path_for_gitlink (pathspec[i]); }static void refresh (int verbose,const char **pathspec)
pathspec.c +31 -0
@@ -56,3 +56,34 @@ char *find_pathspecs_matching_against_index(const char **pathspec)add_pathspec_matches_against_index (pathspec, seen, i);return seen; } + +/* +* Check the index to see whether path refers to a submodule, or +* something inside a submodule. If the former, returns the path with +* any trailing slash stripped. If the latter, dies with an error +* message. +*/ +const char *check_path_for_gitlink (const char *path) +{ +int i, path_len =strlen (path); +for (i =0 ; i < active_nr; i++) { +struct cache_entry *ce = active_cache[i]; +if (S_ISGITLINK (ce->ce_mode)) { +int ce_len =ce_namelen (ce); +if (path_len <= ce_len || path[ce_len] !='/' || +memcmp (ce->name, path, ce_len)) +/* path does not refer to this +* submodule or anything inside it */ +continue ; +if (path_len == ce_len +1 ) { +/* path refers to submodule; +* strip trailing slash */ +return xstrndup (ce->name, ce_len); + }else { +die (_ ("Path '%s' is in submodule '%.*s'" ), + path, ce_len, ce->name); + } + } + } +return path; +}
pathspec.h +1 -0
@@ -3,5 +3,6 @@extern char *find_pathspecs_matching_against_index (const char **pathspec);extern void add_pathspec_matches_against_index (const char **pathspec,char *seen,int specs); +extern const char *check_path_for_gitlink (const char *path);#endif /* PATHSPEC_H */
Signature · 1 line
1.7.11.7.33.gb8feba5
PATCH v4 9/11 add.c: extract new die_if_path_beyond_symlink() for reuse
In reply to Adam SpiersThis will be reused by a new git check-ignore command.
Also document validate_pathspec().
---
Unlike v3, this series doesn't make validate_pathspec() public.
builtin/add.c | 10 ++++++---- pathspec.c | 12 ++++++++++++ pathspec.h | 1 + 3 files changed, 19 insertions(+), 4 deletions(-)
builtin/add.c +6 -4
@@ -153,6 +153,11 @@ static void refresh(int verbose, const char **pathspec)free (seen); } +/* +* Normalizes argv relative to prefix, via get_pathspec(), and then +* runs die_if_path_beyond_symlink() on each path in the normalized +* list. +*/ static const char **validate_pathspec (const char **argv,const char *prefix) {const char **pathspec =get_pathspec (prefix, argv);
@@ -160,10 +165,7 @@ static const char **validate_pathspec(const char **argv, const char *prefix)if (pathspec) {const char **p;for (p = pathspec; *p; p++) { -if (has_symlink_leading_path (*p,strlen (*p))) { -int len = prefix ?strlen (prefix) :0 ; -die (_ ("'%s' is beyond a symbolic link" ), *p + len); - } +die_if_path_beyond_symlink (*p, prefix); } }
pathspec.c +12 -0
@@ -87,3 +87,15 @@ const char *check_path_for_gitlink(const char *path) }return path; } + +/* +* Dies if the given path refers to a file inside a symlinked +* directory in the index. +*/ +void die_if_path_beyond_symlink (const char *path,const char *prefix) +{ +if (has_symlink_leading_path (path,strlen (path))) { +int len = prefix ?strlen (prefix) :0 ; +die (_ ("'%s' is beyond a symbolic link" ), path + len); + } +}
pathspec.h +1 -0
@@ -4,5 +4,6 @@extern char *find_pathspecs_matching_against_index (const char **pathspec);extern void add_pathspec_matches_against_index (const char **pathspec,char *seen,int specs);extern const char *check_path_for_gitlink (const char *path); +extern void die_if_path_beyond_symlink (const char *path,const char *prefix);#endif /* PATHSPEC_H */
Signature · 1 line
1.7.11.7.33.gb8feba5
PATCH v4 10/11 setup.c: document get_pathspec()
In reply to Adam SpiersSince we have just created a new pathspec-handling library, now is a good time to add some comments explaining get_pathspec().
---
The deprecation warning is new since v3.
setup.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
setup.c +19 -0
@@ -249,6 +249,25 @@ static const char *prefix_pathspec(const char *prefix, int prefixlen, const charreturn prefix_path (prefix, prefixlen, copyfrom); } +/* +* N.B. get_pathspec() is deprecated in favor of the "struct pathspec" +* based interface - see pathspec_magic above. +* +* Arguments: +* - prefix - a path relative to the root of the working tree +* - pathspec - a list of paths underneath the prefix path +* +* Iterates over pathspec, prepending each path with prefix, +* and return the resulting list. +* +* If pathspec is empty, return a singleton list containing prefix. +* +* If pathspec and prefix are both empty, return an empty list. +* +* This is typically used by built-in commands such as add.c, in order +* to normalize argv arguments provided to the built-in into a list of +* paths to process, all relative to the root of the working tree. +*/ const char **get_pathspec (const char *prefix,const char **pathspec) {const char *entry = *pathspec;
Signature · 1 line
1.7.11.7.33.gb8feba5
PATCH v4 11/11 add git-check-ignore sub-command
In reply to Adam SpiersThis works in a similar manner to git-check-attr.
Thanks to Jeff King and Junio C Hamano for the idea:
http://thread.gmane.org/gmane.comp.version-control.git/108671/focus=108815
---
Several minor improvements since v3:
- rename char *dir to slash
- fix some declaration-after-statement violations
- correctly handle and test the case where --stdin is used but STDIN is empty
- test that files in the index are not listed as ignored
- test that the presence of a file in the working directory doesn't impact the result of running check-ignore on that file
- stylistic tweaks
- drop the -q option to grep in the test suite
- fix potential brittleness with future tests which could call test_expect_success_multi with parameters containing double-quotes
.gitignore | 1 + Documentation/git-check-ignore.txt | 89 +++ Documentation/gitignore.txt | 6 +- Documentation/technical/api-directory-listing.txt | 2 +- Makefile | 1 + builtin.h | 1 + builtin/check-ignore.c | 173 ++++++ command-list.txt | 1 + contrib/completion/git-completion.bash | 1 + git.c | 1 + t/t0008-ignores.sh | 632 ++++++++++++++++++++++ 11 files changed, 905 insertions(+), 3 deletions(-) create mode 100644 Documentation/git-check-ignore.txt create mode 100644 builtin/check-ignore.c create mode 100755 t/t0008-ignores.sh
.gitignore +1 -0
@@ -19,6 +19,7 @@ /git-bundle /git-cat-file /git-check-attr +/git-check-ignore /git-check-ref-format /git-checkout /git-checkout-index
Documentation/git-check-ignore.txt new file +89 -0
89 lines not on this page · raw message
Documentation/gitignore.txt +4 -2
@@ -153,8 +153,10 @@ The second .gitignore prevents git from ignoring SEE ALSO -------- -linkgit:git-rm[1], linkgit:git-update-index[1], -linkgit:gitrepository-layout[5] +linkgit:git-rm[1], +linkgit:git-update-index[1], +linkgit:gitrepository-layout[5], +linkgit:git-check-ignore[1] GIT ---
Documentation/technical/api-directory-listing.txt +1 -1
@@ -81,6 +81,6 @@ marked. If you to exclude files, make sure you have loaded index first. * Use `dir.entries[]`. -* Call `free_directory()` when none of the contained elements are no longer in use. +* Call `clear_directory()` when none of the contained elements are no longer in use. (JC)
Makefile +1 -0
@@ -822,6 +822,7 @@ BUILTIN_OBJS += builtin/branch.o BUILTIN_OBJS += builtin/bundle.o BUILTIN_OBJS += builtin/cat-file.o BUILTIN_OBJS += builtin/check-attr.o +BUILTIN_OBJS += builtin/check-ignore.o BUILTIN_OBJS += builtin/check-ref-format.o BUILTIN_OBJS += builtin/checkout-index.o BUILTIN_OBJS += builtin/checkout.o
builtin.h +1 -0
@@ -58,6 +58,7 @@ extern int cmd_cat_file(int argc, const char **argv, const char *prefix);extern int cmd_checkout (int argc,const char **argv,const char *prefix);extern int cmd_checkout_index (int argc,const char **argv,const char *prefix);extern int cmd_check_attr (int argc,const char **argv,const char *prefix); +extern int cmd_check_ignore (int argc,const char **argv,const char *prefix);extern int cmd_check_ref_format (int argc,const char **argv,const char *prefix);extern int cmd_cherry (int argc,const char **argv,const char *prefix);extern int cmd_cherry_pick (int argc,const char **argv,const char *prefix);
builtin/check-ignore.c new file +173 -0
173 lines not on this page · raw message
command-list.txt +1 -0
@@ -12,6 +12,7 @@ git-branch mainporcelain common git-bundle mainporcelain git-cat-file plumbinginterrogators git-check-attr purehelpers +git-check-ignore purehelpers git-checkout mainporcelain common git-checkout-index plumbingmanipulators git-check-ref-format purehelpers
contrib/completion/git-completion.bash +1 -0
@@ -842,6 +842,7 @@ __git_list_porcelain_commands () archimport) : import;; cat-file) : plumbing;; check-attr) : plumbing;; + check-ignore) : plumbing;; check-ref-format) : plumbing;; checkout-index) : plumbing;; commit-tree) : plumbing;;
git.c +1 -0
@@ -340,6 +340,7 @@ static void handle_internal_command(int argc, const char **argv) { "bundle", cmd_bundle, RUN_SETUP_GENTLY }, { "cat-file", cmd_cat_file, RUN_SETUP }, { "check-attr", cmd_check_attr, RUN_SETUP }, + { "check-ignore", cmd_check_ignore, RUN_SETUP | NEED_WORK_TREE }, { "check-ref-format", cmd_check_ref_format }, { "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE }, { "checkout-index", cmd_checkout_index,
t/t0008-ignores.sh new file +632 -0
632 lines not on this page · raw message
Signature · 1 line
1.7.11.7.33.gb8feba5