@@ -12,7 +12,7 @@ source "$__CUSTOM_CONSOLE_UTIL"/__split_str
12
12
13
13
function main() {
14
14
15
- numStagedFiles=$( git status --short | grep " ^[A-Z] " -c)
15
+ local numStagedFiles=$( git status --short | grep " ^[A-Z]" -c)
16
16
if [[ $numStagedFiles -eq 0 ]]; then
17
17
gstatus
18
18
echo
@@ -23,10 +23,10 @@ function main() {
23
23
__intend_to_add_untracked_files
24
24
25
25
if [[ $# -gt 0 ]]; then
26
- git status --short | grep " ^[A-Z] " | read_and_restore_staged_files
26
+ git status --short | grep " ^[A-Z]" | read_and_restore_staged_files
27
27
else
28
28
local GRESTORESTAGED_HEADER=" $( __grestorestaged_header) "
29
- git status --short | grep " ^[A-Z] " | \
29
+ git status --short | grep " ^[A-Z]" | \
30
30
fzf -m --color ' fg:64' \
31
31
--bind ' q:abort' \
32
32
--bind ' ?:toggle-preview' \
@@ -45,16 +45,16 @@ function read_and_restore_staged_files() {
45
45
while read -r str; do
46
46
47
47
if [[ ${str: 0: 1} != " R" ]]; then
48
- local file=" ${str# " ${str: 0: 3} " } "
48
+ local file=" ${str# " ${str: 0: 3} " } " # remove first 3 characters
49
49
restore_staged_file " ${file} "
50
50
continue
51
51
fi
52
52
53
+ str=" ${str# " ${str: 0: 3} " } " # remove first 3 characters
53
54
__split_str " ${str} " " -> "
54
55
local oldFile=" ${RESULT_ARR[0]} "
55
56
local newFile=" ${RESULT_ARR[1]} "
56
57
57
- oldFile=" ${oldFile# " R " } "
58
58
restore_staged_file " ${oldFile} "
59
59
restore_staged_file " ${newFile} "
60
60
done
@@ -75,4 +75,4 @@ if [[ $# -eq 1 && "$*" == "." ]]; then
75
75
exit 0
76
76
fi
77
77
78
- __print_err " valid input to grestorestaged: \" .\" "
78
+ __print_err " valid input to grestorestaged: \" .\" "
0 commit comments