aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-06 13:45:19 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-06 13:46:18 +0300
commit84a977c25eee5706e65c6d95f23b4ba4f9ce481f (patch)
tree7d8028e7dfa9d7fe8b2331ae71a9533f41c6852a
parentf674b837d7d0ea85d899f5b4df788b29b4907f68 (diff)
Fix bdep-publish failure for older git versions
For older git versions worktree command doesn't support --track option, so we now create branch explicitly beforehand.
-rw-r--r--bdep/publish.cxx22
1 files changed, 14 insertions, 8 deletions
diff --git a/bdep/publish.cxx b/bdep/publish.cxx
index 399b04e..3650381 100644
--- a/bdep/publish.cxx
+++ b/bdep/publish.cxx
@@ -914,7 +914,7 @@ namespace bdep
// stderr and stdout to /dev/null if the verbosity level is less than
// two and advise the user to re-run with -v on failure.
//
- auto worktree_add = [&prj] (auto&&... args)
+ auto worktree_add = [&prj, &wd] ()
{
bool q (verb < 2);
auto_fd null (q ? fdnull () : auto_fd ());
@@ -925,7 +925,8 @@ namespace bdep
prj,
"worktree",
"add",
- forward<decltype(args)> (args)...));
+ wd,
+ "build2-control"));
if (pr.wait ())
return;
@@ -1041,7 +1042,7 @@ namespace bdep
// Checkout the branch. Note that the upstream branch is not setup
// for it yet. This will be done by the push operation.
//
- worktree_add (wd, "build2-control");
+ worktree_add ();
// Create the checksum files subdirectory.
//
@@ -1050,13 +1051,18 @@ namespace bdep
local_new = true;
}
else
+ {
// Create the local branch, setting up the corresponding upstream
// branch.
//
- worktree_add ("--track",
- "-b", "build2-control",
- wd,
- "origin/build2-control");
+ run_git (prj,
+ "branch",
+ verb < 2 ? "-q" : nullptr,
+ "build2-control",
+ "origin/build2-control");
+
+ worktree_add ();
+ }
}
else
{
@@ -1068,7 +1074,7 @@ namespace bdep
//
worktree_prune ();
- worktree_add (wd, "build2-control");
+ worktree_add ();
}
// "Release" the checked out branch and delete the worktree, if exists.