@@ -17,7 +17,7 @@ gdel() {
17
17
__gdel_usage
18
18
return 1
19
19
else
20
- interactive=false
20
+ local interactive=false
21
21
for arg in " $@ "
22
22
do
23
23
shift
@@ -54,9 +54,9 @@ git_delete_interactive() {
54
54
else
55
55
__gi_check_dependencies
56
56
57
- only_remote_branch=false
58
- only_local_branch=false
59
- branch_list_arg=" "
57
+ local only_remote_branch=false
58
+ local only_local_branch=false
59
+ local branch_list_arg=" "
60
60
for arg in " $@ "
61
61
do
62
62
shift
@@ -73,8 +73,8 @@ git_delete_interactive() {
73
73
set -- " $@ " " $arg "
74
74
done
75
75
76
- branches=$( __gi_fetch_branches " $branch_list_arg " )
77
- branch_selection_return_value=" $? "
76
+ local branches=$( __gi_fetch_branches " $branch_list_arg " )
77
+ local branch_selection_return_value=" $? "
78
78
79
79
if [ " $# " -gt 1 ]
80
80
then
@@ -88,17 +88,17 @@ git_delete_interactive() {
88
88
echo " Error while fetching branches."
89
89
return 1
90
90
else
91
- nb_branches=$( echo $branches | wc -l)
91
+ local nb_branches=$( echo $branches | wc -l)
92
92
if [ " $nb_branches " -lt 1 ]
93
93
then
94
94
echo " No branch to delete"
95
95
return 0
96
96
elif [ " $nb_branches " -eq 1 ]
97
97
then
98
- selected_branch=$branches
98
+ local selected_branch=$branches
99
99
echo " Only one branch found: $selected_branch "
100
100
else
101
- selected_branch=$( echo $branches | fzf --cycle -q " $1 " )
101
+ local selected_branch=$( echo $branches | fzf --cycle -q " $1 " )
102
102
if [ -z " $selected_branch " ]
103
103
then
104
104
return 0
@@ -112,11 +112,11 @@ git_delete_interactive() {
112
112
then
113
113
__gdi_delete_branch --remote $selected_branch
114
114
else
115
- remote_branch_info=" $( __gdi_get_info_remote_branch $selected_branch ) "
115
+ local remote_branch_info=" $( __gdi_get_info_remote_branch $selected_branch ) "
116
116
if [ -n " $remote_branch_info " ]
117
117
then
118
118
remote_branch_name=" $( echo $remote_branch_info | cut -d' ' -f1) "
119
- up_to_date_with_remote=" $( echo $remote_branch_info | cut -d' ' -f2) "
119
+ local up_to_date_with_remote=" $( echo $remote_branch_info | cut -d' ' -f2) "
120
120
121
121
if [ $up_to_date_with_remote = true ]
122
122
then
@@ -162,11 +162,11 @@ __gdi_get_info_remote_branch() {
162
162
163
163
git fetch & > /dev/null
164
164
165
- pattern=" ^\*?\s+$1 "
166
- branch_info=$( git branch -vv | eval $__gi_grep_command ' $pattern' )
165
+ local pattern=" ^\*?\s+$1 "
166
+ local branch_info=$( git branch -vv | eval $__gi_grep_command ' $pattern' )
167
167
if [[ " $branch_info " =~ ' ^\*?\s+\w+\s+\w+\s+\[' ]]
168
168
then
169
- remote_info=" ${${branch_info#* \[ } %% \] * } "
169
+ local remote_info=" ${${branch_info#* \[ } %% \] * } "
170
170
if [[ " $remote_info " =~ ' :' ]]
171
171
then
172
172
echo " ${remote_info%%:* } false"
@@ -177,8 +177,8 @@ __gdi_get_info_remote_branch() {
177
177
}
178
178
179
179
__gdi_delete_branch () {
180
- local_branch=false
181
- remote_branch=false
180
+ local local_branch=false
181
+ local remote_branch=false
182
182
for arg in " $@ "
183
183
do
184
184
shift
0 commit comments