summaryrefslogtreecommitdiff
path: root/src/checkout.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2013-05-01 09:50:40 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2013-05-01 09:50:40 -0500
commit0cc7d8df19c82a13fd9d7c48563f40580d366cd3 (patch)
treeae1e58d57f0ea80b025673147c67a5df76841c7e /src/checkout.c
parente1807113c43b7c5008e2d5c8c449ae56c8dceeb4 (diff)
downloadlibgit2-0cc7d8df19c82a13fd9d7c48563f40580d366cd3.tar.gz
allow empty dirs to exist when doing checkout
Diffstat (limited to 'src/checkout.c')
-rw-r--r--src/checkout.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/checkout.c b/src/checkout.c
index defc21d2d..21f32d89a 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -467,6 +467,7 @@ static int checkout_action(
int cmp = -1, act;
int (*strcomp)(const char *, const char *) = data->diff->strcomp;
int (*pfxcomp)(const char *str, const char *pfx) = data->diff->pfxcomp;
+ int error;
/* move workdir iterator to follow along with deltas */
@@ -490,8 +491,11 @@ static int checkout_action(
if (cmp == 0) {
if (wd->mode == GIT_FILEMODE_TREE) {
/* case 2 - entry prefixed by workdir tree */
- if (git_iterator_advance_into(&wd, workdir) < 0)
- goto fail;
+ if ((error = git_iterator_advance_into(&wd, workdir)) < 0) {
+ if (error != GIT_ENOTFOUND ||
+ git_iterator_advance(&wd, workdir) < 0)
+ goto fail;
+ }
*wditem_ptr = wd;
continue;