summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-09-16 17:46:24 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-09-16 17:46:24 +0200
commitadd0378d8eb76cb7fde92bcbed3eb59ee5b8947c (patch)
tree4f693b9149765c90fdd77eb0bdbf959450dc87a0 /src
parentb1f6c0b6fa8bbb0c9c11a4d09c731a7f7c311558 (diff)
parenteea7c850248c04a6ac3aadbb13b2c72c2237013b (diff)
downloadlibgit2-add0378d8eb76cb7fde92bcbed3eb59ee5b8947c.tar.gz
Merge pull request #3429 from ethomson/checkout_chmod
Checkout: handle mode changes
Diffstat (limited to 'src')
-rw-r--r--src/checkout.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/checkout.c b/src/checkout.c
index de48c9e01..8c06b3335 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -243,6 +243,12 @@ static int checkout_action_common(
if (delta->new_file.mode == GIT_FILEMODE_LINK && wd != NULL)
*action |= CHECKOUT_ACTION__REMOVE;
+ /* if the file is on disk and doesn't match our mode, force update */
+ if (wd &&
+ GIT_PERMS_IS_EXEC(wd->mode) !=
+ GIT_PERMS_IS_EXEC(delta->new_file.mode))
+ *action |= CHECKOUT_ACTION__REMOVE;
+
notify = GIT_CHECKOUT_NOTIFY_UPDATED;
}
@@ -1500,15 +1506,6 @@ static int blob_content_to_file(
if (error < 0)
return error;
- if (GIT_PERMS_IS_EXEC(mode)) {
- data->perfdata.chmod_calls++;
-
- if ((error = p_chmod(path, mode)) < 0) {
- giterr_set(GITERR_OS, "Failed to set permissions on '%s'", path);
- return error;
- }
- }
-
if (st) {
data->perfdata.stat_calls++;