diff options
author | Russell Belfer <rb@github.com> | 2012-05-15 14:17:39 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-05-15 14:34:15 -0700 |
commit | 41a82592ef56a216f96558942d717af15589071d (patch) | |
tree | 8f9c2969000d388f1091b2cd134776bee59e29c6 /src/buffer.h | |
parent | 54695f4098c75801f477f5bc229a52653484e08a (diff) | |
download | libgit2-41a82592ef56a216f96558942d717af15589071d.tar.gz |
Ranged iterators and rewritten git_status_file
The goal of this work is to rewrite git_status_file to use the
same underlying code as git_status_foreach.
This is done in 3 phases:
1. Extend iterators to allow ranged iteration with start and
end prefixes for the range of file names to be covered.
2. Improve diff so that when there is a pathspec and there is
a common non-wildcard prefix of the pathspec, it will use
ranged iterators to minimize excess iteration.
3. Rewrite git_status_file to call git_status_foreach_ext
with a pathspec that covers just the one file being checked.
Since ranged iterators underlie the status & diff implementation,
this is actually fairly efficient. The workdir iterator does
end up loading the contents of all the directories down to the
single file, which should ideally be avoided, but it is pretty
good.
Diffstat (limited to 'src/buffer.h')
-rw-r--r-- | src/buffer.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h index 1f0ec1c15..5a0e7d7b2 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -122,4 +122,6 @@ void git_buf_rtrim(git_buf *buf); int git_buf_cmp(const git_buf *a, const git_buf *b); +int git_buf_common_prefix(git_buf *buf, const git_strarray *strings); + #endif |