Skip to content

Commit f4e9996

Browse files
committed
Merge branch 'maint'
* maint: git-gui: Make sure we get errors from git-update-index Conflicts: lib/index.tcl
2 parents dec2b4a + d4e890e commit f4e9996

File tree

1 file changed

+53
-12
lines changed

1 file changed

+53
-12
lines changed

lib/index.tcl

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,56 @@
11
# git-gui index (add/remove) support
22
# Copyright (C) 2006, 2007 Shawn Pearce
33

4+
proc _delete_indexlock {} {
5+
if {[catch {file delete -- [gitdir index.lock]} err]} {
6+
error_popup [strcat [mc "Unable to unlock the index."] "\n\n$err"]
7+
}
8+
}
9+
10+
proc _close_updateindex {fd after} {
11+
fconfigure $fd -blocking 1
12+
if {[catch {close $fd} err]} {
13+
set w .indexfried
14+
toplevel $w
15+
wm title $w [strcat "[appname] ([reponame]): " [mc "Index Error"]]
16+
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
17+
pack [label $w.msg \
18+
-justify left \
19+
-anchor w \
20+
-text [strcat \
21+
[mc "Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui."] \
22+
"\n\n$err"] \
23+
] -anchor w
24+
25+
frame $w.buttons
26+
button $w.buttons.continue \
27+
-text [mc "Continue"] \
28+
-command [list destroy $w]
29+
pack $w.buttons.continue -side right -padx 5
30+
button $w.buttons.unlock \
31+
-text [mc "Unlock Index"] \
32+
-command "destroy $w; _delete_indexlock"
33+
pack $w.buttons.unlock -side right
34+
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
35+
36+
wm protocol $w WM_DELETE_WINDOW update
37+
bind $w.buttons.continue <Visibility> "
38+
grab $w
39+
focus $w.buttons.continue
40+
"
41+
tkwait window $w
42+
43+
$::main_status stop
44+
unlock_index
45+
rescan $after 0
46+
return
47+
}
48+
49+
$::main_status stop
50+
unlock_index
51+
uplevel #0 $after
52+
}
53+
454
proc update_indexinfo {msg pathList after} {
555
global update_index_cp
656

@@ -35,10 +85,7 @@ proc write_update_indexinfo {fd pathList totalCnt batch after} {
3585
global file_states current_diff_path
3686

3787
if {$update_index_cp >= $totalCnt} {
38-
close $fd
39-
unlock_index
40-
$::main_status stop
41-
uplevel #0 $after
88+
_close_updateindex $fd $after
4289
return
4390
}
4491

@@ -100,10 +147,7 @@ proc write_update_index {fd pathList totalCnt batch after} {
100147
global file_states current_diff_path
101148

102149
if {$update_index_cp >= $totalCnt} {
103-
close $fd
104-
unlock_index
105-
$::main_status stop
106-
uplevel #0 $after
150+
_close_updateindex $fd $after
107151
return
108152
}
109153

@@ -175,10 +219,7 @@ proc write_checkout_index {fd pathList totalCnt batch after} {
175219
global file_states current_diff_path
176220

177221
if {$update_index_cp >= $totalCnt} {
178-
close $fd
179-
unlock_index
180-
$::main_status stop
181-
uplevel #0 $after
222+
_close_updateindex $fd $after
182223
return
183224
}
184225

0 commit comments

Comments
 (0)