Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clone repositories in specific branch #7

Merged
merged 1 commit into from
May 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lua/git-dev/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ local cd_func = {
-- Generates a function to trigger a deletion of `repo_dir`
local function clean_repo_callback(repo_dir)
return function()
vim.print("Cleaning " .. repo_dir)
local is_deleted = vim.fn.delete(repo_dir, "rf")
if M.config.verbose then
local msg
Expand All @@ -82,7 +83,7 @@ local function clean_repo_callback(repo_dir)
else
msg = "Not found: " .. repo_dir
end
vim.fn.notify(msg)
vim.print(msg)
end
end
end
Expand Down Expand Up @@ -155,7 +156,12 @@ M.open = function(repo, ref, opts)
-- Fresh clone
table.insert(
verbose,
gitcmd:clone(parsed_repo.repo_url, repo_dir, nil, config.git.clone_args)
gitcmd:clone(
parsed_repo.repo_url,
repo_dir,
parsed_repo.branch,
config.git.clone_args
)
)
if vim.fn.isdirectory(repo_dir) == 0 then
if config.verbose then
Expand Down