File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -623,4 +623,15 @@ function M.try(fn, ...)
623623 end
624624end
625625
626+ --- @param str string
627+ --- @param prefix string
628+ --- @return string
629+ function M .remove_prefix (str , prefix )
630+ if str :sub (1 , # prefix ) == prefix then
631+ return str :sub (# prefix + 1 )
632+ else
633+ return str
634+ end
635+ end
636+
626637return M
Original file line number Diff line number Diff line change @@ -111,14 +111,6 @@ function M.to_elsewhere(popup)
111111 end
112112end
113113
114- local function remove_prefix (str , prefix )
115- if str :sub (1 , # prefix ) == prefix then
116- return str :sub (# prefix + 1 )
117- else
118- return str
119- end
120- end
121-
122114function M .push_other (popup )
123115 local sources = util .merge ({ popup .state .env .commit }, git .refs .list_local_branches (), git .refs .heads ())
124116 local source = FuzzyFinderBuffer .new (sources ):open_async { prompt_prefix = " push" }
@@ -136,9 +128,9 @@ function M.push_other(popup)
136128 end
137129
138130 local remote , _ = git .branch .parse_remote_branch (destination )
139- --
131+
140132 -- destination is <remote>/branch-name, need to remove the remote prefix
141- destination = remove_prefix (destination , remote .. " /" )
133+ destination = util . remove_prefix (destination , remote .. " /" )
142134
143135 push_to (popup :get_arguments (), remote , source .. " :" .. destination )
144136end
You can’t perform that action at this time.
0 commit comments