File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,14 @@ function M.to_elsewhere(popup)
111
111
end
112
112
end
113
113
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
+
114
122
function M .push_other (popup )
115
123
local sources = util .merge ({ popup .state .env .commit }, git .refs .list_local_branches (), git .refs .heads ())
116
124
local source = FuzzyFinderBuffer .new (sources ):open_async { prompt_prefix = " push" }
@@ -119,17 +127,19 @@ function M.push_other(popup)
119
127
end
120
128
121
129
local destinations = git .refs .list_remote_branches ()
122
- for _ , remote in ipairs (git .remote .list ()) do
123
- table.insert (destinations , 1 , remote .. " /" .. source )
124
- end
125
130
126
131
local destination = FuzzyFinderBuffer .new (util .deduplicate (destinations ))
127
132
:open_async { prompt_prefix = " push " .. source .. " to" }
133
+
128
134
if not destination then
129
135
return
130
136
end
131
137
132
138
local remote , _ = git .branch .parse_remote_branch (destination )
139
+ --
140
+ -- destination is <remote>/branch-name, need to remove the remote prefix
141
+ destination = remove_prefix (destination , remote .. " /" )
142
+
133
143
push_to (popup :get_arguments (), remote , source .. " :" .. destination )
134
144
end
135
145
You can’t perform that action at this time.
0 commit comments