diff options
Diffstat (limited to 'git-gui')
-rw-r--r-- | git-gui/Makefile | 2 | ||||
-rwxr-xr-x | git-gui/git-gui.sh | 30 | ||||
-rw-r--r-- | git-gui/lib/commit.tcl | 12 | ||||
-rw-r--r-- | git-gui/lib/diff.tcl | 1 |
4 files changed, 38 insertions, 7 deletions
diff --git a/git-gui/Makefile b/git-gui/Makefile index 918a8de369..f10caedaa7 100644 --- a/git-gui/Makefile +++ b/git-gui/Makefile @@ -254,7 +254,7 @@ $(ALL_MSGFILES): %.msg : %.po lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS $(QUIET_INDEX)if echo \ $(foreach p,$(PRELOAD_FILES),source $p\;) \ - auto_mkindex lib '*.tcl' \ + auto_mkindex lib $(patsubst lib/%,%,$(sort $(ALL_LIBFILES))) \ | $(TCL_PATH) $(QUIET_2DEVNULL); then : ok; \ else \ echo >&2 " * $(TCL_PATH) failed; using unoptimized loading"; \ diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index 5bc21b878d..91c00e6489 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -24,8 +24,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}] +along with this program; if not, see <http://www.gnu.org/licenses/>.}] ###################################################################### ## @@ -2502,9 +2501,28 @@ proc toggle_or_diff {mode w args} { set pos [split [$w index @$x,$y] .] foreach {lno col} $pos break } else { + if {$mode eq "toggle"} { + if {$w eq $ui_workdir} { + do_add_selection + set last_clicked {} + return + } + if {$w eq $ui_index} { + do_unstage_selection + set last_clicked {} + return + } + } + if {$last_clicked ne {}} { set lno [lindex $last_clicked 1] } else { + if {![info exists file_lists] + || ![info exists file_lists($w)] + || [llength $file_lists($w)] == 0} { + set last_clicked {} + return + } set lno [expr {int([lindex [$w tag ranges in_diff] 0])}] } if {$mode eq "toggle"} { @@ -2515,7 +2533,13 @@ proc toggle_or_diff {mode w args} { } } - set path [lindex $file_lists($w) [expr {$lno - 1}]] + if {![info exists file_lists] + || ![info exists file_lists($w)] + || [llength $file_lists($w)] < $lno - 1} { + set path {} + } else { + set path [lindex $file_lists($w) [expr {$lno - 1}]] + } if {$path eq {}} { set last_clicked {} return diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl index 83620b7cbc..75ea965dac 100644 --- a/git-gui/lib/commit.tcl +++ b/git-gui/lib/commit.tcl @@ -25,6 +25,8 @@ You are currently in the middle of a merge that has not been fully completed. Y set msg {} set parents [list] if {[catch { + set name "" + set email "" set fd [git_read cat-file commit $curHEAD] fconfigure $fd -encoding binary -translation lf # By default commits are assumed to be in utf-8 @@ -34,9 +36,7 @@ You are currently in the middle of a merge that has not been fully completed. Y lappend parents [string range $line 7 end] } elseif {[string match {encoding *} $line]} { set enc [string tolower [string range $line 9 end]] - } elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} { - set commit_author [list name $name email $email date $time] - } + } elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} { } } set msg [read $fd] close $fd @@ -44,7 +44,13 @@ You are currently in the middle of a merge that has not been fully completed. Y set enc [tcl_encoding $enc] if {$enc ne {}} { set msg [encoding convertfrom $enc $msg] + set name [encoding convertfrom $enc $name] + set email [encoding convertfrom $enc $email] } + if {$name ne {} && $email ne {}} { + set commit_author [list name $name email $email date $time] + } + set msg [string trim $msg] } err]} { error_popup [strcat [mc "Error loading commit data for amend:"] "\n\n$err"] diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl index 4cae10a4c7..68c4a6c736 100644 --- a/git-gui/lib/diff.tcl +++ b/git-gui/lib/diff.tcl @@ -698,6 +698,7 @@ proc apply_range_or_line {x y} { set hh [$ui_diff get $i_l "$i_l + 1 lines"] set hh [lindex [split $hh ,] 0] set hln [lindex [split $hh -] 1] + set hln [lindex [split $hln " "] 0] # There is a special situation to take care of. Consider this # hunk: |