File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -232,6 +232,14 @@ _forgit_reflog() {
232232 return $fzf_exit_code
233233}
234234
235+ _forgit_remove_status_from_diff_line () {
236+ # Remove the status prefix from a diff line, e.g.
237+ # [M] somefile
238+ # becomes
239+ # somefile
240+ sed ' s/^[[:space:]]*\[[A-Z0-9]*\][[:space:]]*//'
241+ }
242+
235243_forgit_get_files_from_diff_line () {
236244 # Construct a null-terminated list of the filenames
237245 # The input looks like one of these lines:
@@ -244,13 +252,13 @@ _forgit_get_files_from_diff_line() {
244252 # oldfile\0
245253 # We have to do a two-step sed -> tr pipe because OSX's sed implementation does
246254 # not support the null-character directly.
247- sed ' s/^[[:space:]]*\[[A-Z0-9]*\][[:space:]]*// ' | sed ' s/ -> /\n/' | tr ' \n' ' \0'
255+ _forgit_remove_status_from_diff_line | sed ' s/ -> /\n/' | tr ' \n' ' \0'
248256}
249257
250258_forgit_get_single_file_from_diff_line () {
251259 # Similar to the function above, but only gets a single file from a single line
252260 # Gets the new name of renamed files
253- sed ' s/^[[:space:]]*\[[A-Z0-9]*\][[:space:]]*// ' | sed ' s/.*-> //'
261+ _forgit_remove_status_from_diff_line | sed ' s/.*-> //'
254262}
255263
256264_forgit_exec_diff () {
You can’t perform that action at this time.
0 commit comments