aboutsummaryrefslogtreecommitdiff
path: root/bpkg/fetch-git.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-07-29 18:32:14 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-07-30 11:04:37 +0300
commit7490948f27d70df1f88ed161a2b758755d0a7929 (patch)
tree464099162afbf339c6cb502ba38d84ae0f9ced1e /bpkg/fetch-git.cxx
parentaaf8e696886f443cd095ca7a5f37fc5b1ce0e207 (diff)
Add support for checked out repository fragments caching
Diffstat (limited to 'bpkg/fetch-git.cxx')
-rw-r--r--bpkg/fetch-git.cxx29
1 files changed, 22 insertions, 7 deletions
diff --git a/bpkg/fetch-git.cxx b/bpkg/fetch-git.cxx
index 0c2ac21..8195375 100644
--- a/bpkg/fetch-git.cxx
+++ b/bpkg/fetch-git.cxx
@@ -2152,9 +2152,13 @@ namespace bpkg
// Noop on POSIX.
//
- bool
- git_fixup_worktree (const common_options&, const dir_path&, bool)
+ optional<bool>
+ git_fixup_worktree (const common_options&,
+ const dir_path&,
+ bool revert,
+ bool)
{
+ assert (!revert);
return false;
}
@@ -2545,15 +2549,26 @@ namespace bpkg
return r;
}
- bool
+ optional<bool>
git_fixup_worktree (const common_options& co,
const dir_path& dir,
- bool revert)
+ bool revert,
+ bool ie)
{
- optional<bool> r (
- fixup_worktree (co, dir, revert, dir_path () /* prefix */));
+ try
+ {
+ optional<bool> r (
+ fixup_worktree (co, dir, revert, dir_path () /* prefix */));
- return r ? *r : false;
+ return r ? *r : false;
+ }
+ catch (const failed&)
+ {
+ if (ie)
+ return nullopt;
+
+ throw;
+ }
}
#endif