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, ...)
623
623
end
624
624
end
625
625
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
+
626
637
return M
Original file line number Diff line number Diff line change @@ -111,14 +111,6 @@ 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
-
122
114
function M .push_other (popup )
123
115
local sources = util .merge ({ popup .state .env .commit }, git .refs .list_local_branches (), git .refs .heads ())
124
116
local source = FuzzyFinderBuffer .new (sources ):open_async { prompt_prefix = " push" }
@@ -136,9 +128,9 @@ function M.push_other(popup)
136
128
end
137
129
138
130
local remote , _ = git .branch .parse_remote_branch (destination )
139
- --
131
+
140
132
-- destination is <remote>/branch-name, need to remove the remote prefix
141
- destination = remove_prefix (destination , remote .. " /" )
133
+ destination = util . remove_prefix (destination , remote .. " /" )
142
134
143
135
push_to (popup :get_arguments (), remote , source .. " :" .. destination )
144
136
end
You can’t perform that action at this time.
0 commit comments