Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-05-09 02:03:59 +0400
committerRussell Belfer <rb@github.com>2012-05-09 02:03:59 +0400
commit7e000ab2ece977a028e3f1327de37342bef9f687 (patch)
tree5955c21f0174237dfa0f2b99b9de8016862aeb54 /src/iterator.h
parent364f51bdca8cd5bb11bb322f8cac1b0d7dfcf686 (diff)
Add support for diffing index with no HEAD
When a repo is first created, there is no HEAD yet and attempting to diff files in the index was showing nothing because a tree iterator could not be constructed. This adds an "empty" iterator and falls back on that when the head cannot be looked up.
Diffstat (limited to 'src/iterator.h')
-rw-r--r--src/iterator.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/iterator.h b/src/iterator.h
index aa78c9f29..12eb96bb0 100644
--- a/src/iterator.h
+++ b/src/iterator.h
@@ -13,6 +13,7 @@
typedef struct git_iterator git_iterator;
typedef enum {
+ GIT_ITERATOR_EMPTY = 0,
GIT_ITERATOR_TREE = 1,
GIT_ITERATOR_INDEX = 2,
GIT_ITERATOR_WORKDIR = 3
@@ -27,6 +28,8 @@ struct git_iterator {
void (*free)(git_iterator *);
};
+int git_iterator_for_nothing(git_iterator **iter);
+
int git_iterator_for_tree(
git_repository *repo, git_tree *tree, git_iterator **iter);