From 1f166b5bddfd95ecb1a8e16aed9dbaab3bc14322 Mon Sep 17 00:00:00 2001 From: twio142 <64556708+twio142@users.noreply.github.com> Date: Fri, 18 Sep 2026 00:19:06 +0200 Subject: [PATCH] fix(open): clone the branch given in `ref` `M.open` resolved a ref from both `ref` and the parsed URI, but the clone call only received `parsed_repo.branch`. Calling `open(repo, { branch = "x" })` with a URI that carries no branch therefore cloned without `-b`, and since the default `clone_args` include `--single-branch`, no remote-tracking ref for "x" was ever fetched. The post-clone checkout then failed and the repository was left on the default branch. Pass `ref.branch or ref.tag` to the clone, falling back to the parsed URI as before. --- lua/git-dev/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/git-dev/init.lua b/lua/git-dev/init.lua index 908d4b2..dca6847 100644 --- a/lua/git-dev/init.lua +++ b/lua/git-dev/init.lua @@ -341,7 +341,7 @@ M.open = function(repo, ref, opts) gitcmd:clone({ repo_url = parsed_repo.repo_url, repo_dir = repo_dir, - branch = parsed_repo.branch, + branch = ref.branch or ref.tag or parsed_repo.branch, extra_args = config.git.clone_args, }, clone_callback) end