summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-05-08 15:03:59 -0700
committerRussell Belfer <rb@github.com>2012-05-08 15:03:59 -0700
commit7e000ab2ece977a028e3f1327de37342bef9f687 (patch)
tree5955c21f0174237dfa0f2b99b9de8016862aeb54 /src/diff.c
parent364f51bdca8cd5bb11bb322f8cac1b0d7dfcf686 (diff)
downloadlibgit2-7e000ab2ece977a028e3f1327de37342bef9f687.tar.gz
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/diff.c')
-rw-r--r--src/diff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/diff.c b/src/diff.c
index 524cc9f59..fed22f403 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -631,7 +631,7 @@ int git_diff_index_to_tree(
{
git_iterator *a = NULL, *b = NULL;
- assert(repo && old_tree && diff);
+ assert(repo && diff);
if (git_iterator_for_tree(repo, old_tree, &a) < 0 ||
git_iterator_for_index(repo, &b) < 0)