summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-10-23 22:50:19 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-10-23 22:50:19 (GMT)
commitf4e9996b77415707a20a139463c3e3782e2fa48f (patch)
treec26e1fb74f3b94585e5946bcc623b322fd9d2cbe /lib
parentdec2b4aaa87ab2b33d1ad8294872af1f1397ec7e (diff)
parentd4e890e5de1ea7107d8d1b4134ab0144bbf27b8c (diff)
downloadgit-f4e9996b77415707a20a139463c3e3782e2fa48f.zip
git-f4e9996b77415707a20a139463c3e3782e2fa48f.tar.gz
git-f4e9996b77415707a20a139463c3e3782e2fa48f.tar.bz2
Merge branch 'maint'
* maint: git-gui: Make sure we get errors from git-update-index Conflicts: lib/index.tcl
Diffstat (limited to 'lib')
-rw-r--r--lib/index.tcl65
1 files changed, 53 insertions, 12 deletions
diff --git a/lib/index.tcl b/lib/index.tcl
index 9e04f2b..a0b22f2 100644
--- a/lib/index.tcl
+++ b/lib/index.tcl
@@ -1,6 +1,56 @@
# git-gui index (add/remove) support
# Copyright (C) 2006, 2007 Shawn Pearce
+proc _delete_indexlock {} {
+ if {[catch {file delete -- [gitdir index.lock]} err]} {
+ error_popup [strcat [mc "Unable to unlock the index."] "\n\n$err"]
+ }
+}
+
+proc _close_updateindex {fd after} {
+ fconfigure $fd -blocking 1
+ if {[catch {close $fd} err]} {
+ set w .indexfried
+ toplevel $w
+ wm title $w [strcat "[appname] ([reponame]): " [mc "Index Error"]]
+ wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
+ pack [label $w.msg \
+ -justify left \
+ -anchor w \
+ -text [strcat \
+ [mc "Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui."] \
+ "\n\n$err"] \
+ ] -anchor w
+
+ frame $w.buttons
+ button $w.buttons.continue \
+ -text [mc "Continue"] \
+ -command [list destroy $w]
+ pack $w.buttons.continue -side right -padx 5
+ button $w.buttons.unlock \
+ -text [mc "Unlock Index"] \
+ -command "destroy $w; _delete_indexlock"
+ pack $w.buttons.unlock -side right
+ pack $w.buttons -side bottom -fill x -pady 10 -padx 10
+
+ wm protocol $w WM_DELETE_WINDOW update
+ bind $w.buttons.continue <Visibility> "
+ grab $w
+ focus $w.buttons.continue
+ "
+ tkwait window $w
+
+ $::main_status stop
+ unlock_index
+ rescan $after 0
+ return
+ }
+
+ $::main_status stop
+ unlock_index
+ uplevel #0 $after
+}
+
proc update_indexinfo {msg pathList after} {
global update_index_cp
@@ -35,10 +85,7 @@ proc write_update_indexinfo {fd pathList totalCnt batch after} {
global file_states current_diff_path
if {$update_index_cp >= $totalCnt} {
- close $fd
- unlock_index
- $::main_status stop
- uplevel #0 $after
+ _close_updateindex $fd $after
return
}
@@ -100,10 +147,7 @@ proc write_update_index {fd pathList totalCnt batch after} {
global file_states current_diff_path
if {$update_index_cp >= $totalCnt} {
- close $fd
- unlock_index
- $::main_status stop
- uplevel #0 $after
+ _close_updateindex $fd $after
return
}
@@ -175,10 +219,7 @@ proc write_checkout_index {fd pathList totalCnt batch after} {
global file_states current_diff_path
if {$update_index_cp >= $totalCnt} {
- close $fd
- unlock_index
- $::main_status stop
- uplevel #0 $after
+ _close_updateindex $fd $after
return
}