Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
407ef708
Commit
407ef708
authored
Nov 30, 2017
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use git to determine a worktree's git path
Instead of trying to figure it out ourselves, which is more fragile.
parent
99b83964
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+2
-2
No files found.
lib/gitlab/git/repository.rb
View file @
407ef708
...
...
@@ -1311,7 +1311,6 @@ module Gitlab
end
def
with_worktree
(
worktree_path
,
branch
,
sparse_checkout_files:
nil
,
env
:)
worktree_git_path
=
File
.
join
(
path
,
'worktrees'
,
File
.
basename
(
worktree_path
))
base_args
=
%w(worktree add --detach)
# Note that we _don't_ want to test for `.present?` here: If the caller
...
...
@@ -1321,6 +1320,7 @@ module Gitlab
if
sparse_checkout_files
# Create worktree without checking out
run_git!
(
base_args
+
[
'--no-checkout'
,
worktree_path
],
env:
env
)
worktree_git_path
=
run_git!
(
%w(rev-parse --git-dir)
,
chdir:
worktree_path
)
configure_sparse_checkout
(
worktree_git_path
,
sparse_checkout_files
)
...
...
@@ -1334,7 +1334,7 @@ module Gitlab
yield
ensure
FileUtils
.
rm_rf
(
worktree_path
)
if
File
.
exist?
(
worktree_path
)
FileUtils
.
rm_rf
(
worktree_git_path
)
if
File
.
exist?
(
worktree_git_path
)
FileUtils
.
rm_rf
(
worktree_git_path
)
if
worktree_git_path
&&
File
.
exist?
(
worktree_git_path
)
end
def
clean_stuck_worktree
(
path
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment