summaryrefslogtreecommitdiff
path: root/src/checkout.c
diff options
context:
space:
mode:
authorJason Haslam <jason@scitools.com>2016-02-16 21:02:41 -0700
committerEdward Thomson <ethomson@github.com>2016-05-26 01:11:34 -0500
commitafab1fff01cc4104df37531b3ddc339063a9c96a (patch)
treed735d9b05ac96f1b17cc75bf3181d35118049e15 /src/checkout.c
parentfdf14637d5ff01bb59638f8bc01ef7cf7c3324ff (diff)
downloadlibgit2-afab1fff01cc4104df37531b3ddc339063a9c96a.tar.gz
checkout: handle dirty submodules correctly
Don't generate conflicts when checking out a modified submodule and the submodule is dirty or modified in the workdir.
Diffstat (limited to 'src/checkout.c')
-rw-r--r--src/checkout.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/checkout.c b/src/checkout.c
index d84b46ba7..b3e95dff8 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -482,7 +482,8 @@ static int checkout_action_with_wd(
*action = CHECKOUT_ACTION_IF(SAFE, REMOVE, NONE);
break;
case GIT_DELTA_MODIFIED: /* case 16, 17, 18 (or 36 but not really) */
- if (checkout_is_workdir_modified(data, &delta->old_file, &delta->new_file, wd))
+ if (wd->mode != GIT_FILEMODE_COMMIT &&
+ checkout_is_workdir_modified(data, &delta->old_file, &delta->new_file, wd))
*action = CHECKOUT_ACTION_IF(FORCE, UPDATE_BLOB, CONFLICT);
else
*action = CHECKOUT_ACTION_IF(SAFE, UPDATE_BLOB, NONE);