summaryrefslogtreecommitdiff
path: root/src/status.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/status.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/status.c')
-rw-r--r--src/status.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/status.c b/src/status.c
index 546dc863d..d07b0c41c 100644
--- a/src/status.c
+++ b/src/status.c
@@ -101,7 +101,7 @@ int git_status_foreach_ext(
diffopt.flags = diffopt.flags | GIT_DIFF_RECURSE_UNTRACKED_DIRS;
/* TODO: support EXCLUDE_SUBMODULES flag */
- if (show != GIT_STATUS_SHOW_WORKDIR_ONLY && head != NULL &&
+ if (show != GIT_STATUS_SHOW_WORKDIR_ONLY &&
(err = git_diff_index_to_tree(repo, &diffopt, head, &idx2head)) < 0)
goto cleanup;