From 54350a2bb48f2d4cf56bd2b8220fad7124d3592c Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Wed, 6 Jan 2010 02:16:38 -0600 Subject: git-gui: Makefile: consolidate .FORCE-* targets Providing multiple targets to force a rebuild is unnecessary complication. Avoid using a name that could conflict with future special targets in GNU make (a leading period followed by uppercase letters). Cc: Junio C Hamano Signed-off-by: Jonathan Nieder Signed-off-by: Shawn O. Pearce diff --git a/Makefile b/Makefile index b3580e9..197b55e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ all:: # TCL_PATH must be vaild for this to work. # -GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE +GIT-VERSION-FILE: FORCE @$(SHELL_PATH) ./GIT-VERSION-GEN -include GIT-VERSION-FILE @@ -270,7 +270,7 @@ TRACK_VARS = \ GITGUI_MACOSXAPP=$(GITGUI_MACOSXAPP) \ #end TRACK_VARS -GIT-GUI-VARS: .FORCE-GIT-GUI-VARS +GIT-GUI-VARS: FORCE @VARS='$(TRACK_VARS)'; \ if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \ echo 1>&2 " * new locations or Tcl/Tk interpreter"; \ @@ -340,5 +340,4 @@ ifdef GITGUI_WINDOWS_WRAPPER endif .PHONY: all install uninstall dist-version clean -.PHONY: .FORCE-GIT-VERSION-FILE -.PHONY: .FORCE-GIT-GUI-VARS +.PHONY: FORCE -- cgit v0.10.2-6-g49f6 From b677c66e299c8754a6093cbd19ce71b0ad2a8a17 Mon Sep 17 00:00:00 2001 From: Vitaly _Vi Shukela Date: Thu, 31 Dec 2009 15:32:53 +0200 Subject: git-gui: Add hotkeys for "Unstage from commit" and "Revert changes" Signed-off-by: Vitaly _Vi Shukela Signed-off-by: Shawn O. Pearce diff --git a/git-gui.sh b/git-gui.sh index 718277a..822d598 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -2543,12 +2543,14 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} { [list .mbar.commit entryconf [.mbar.commit index last] -state] .mbar.commit add command -label [mc "Unstage From Commit"] \ - -command do_unstage_selection + -command do_unstage_selection \ + -accelerator $M1T-U lappend disable_on_lock \ [list .mbar.commit entryconf [.mbar.commit index last] -state] .mbar.commit add command -label [mc "Revert Changes"] \ - -command do_revert_selection + -command do_revert_selection \ + -accelerator $M1T-J lappend disable_on_lock \ [list .mbar.commit entryconf [.mbar.commit index last] -state] @@ -3296,6 +3298,10 @@ unset gws bind $ui_comm <$M1B-Key-Return> {do_commit;break} bind $ui_comm <$M1B-Key-t> {do_add_selection;break} bind $ui_comm <$M1B-Key-T> {do_add_selection;break} +bind $ui_comm <$M1B-Key-u> {do_unstage_selection;break} +bind $ui_comm <$M1B-Key-U> {do_unstage_selection;break} +bind $ui_comm <$M1B-Key-j> {do_revert_selection;break} +bind $ui_comm <$M1B-Key-J> {do_revert_selection;break} bind $ui_comm <$M1B-Key-i> {do_add_all;break} bind $ui_comm <$M1B-Key-I> {do_add_all;break} bind $ui_comm <$M1B-Key-x> {tk_textCut %W;break} -- cgit v0.10.2-6-g49f6 From ea888f84bd6ebb7e944311d95251d28a3b547024 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Sun, 20 Dec 2009 02:02:03 +0000 Subject: git-gui: handle really long error messages in updateindex. As reported to msysGit (bug #340) it is possible to get some very long error messages when updating the index. The use of a label to display this prevents scrolling the output. This patch replaces the label with a scrollable text widget configured to look like a label. Signed-off-by: Pat Thoyts Signed-off-by: Shawn O. Pearce diff --git a/lib/index.tcl b/lib/index.tcl index d33896a..0b58bd8 100644 --- a/lib/index.tcl +++ b/lib/index.tcl @@ -14,29 +14,31 @@ proc _close_updateindex {fd after} { 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 \ + set s [mc "Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui."] + text $w.msg -yscrollcommand [list $w.vs set] \ + -width [string length $s] -relief flat \ + -borderwidth 0 -highlightthickness 0 \ + -background [$w cget -background] + $w.msg tag configure bold -font font_uibold -justify center + scrollbar $w.vs -command [list $w.msg yview] + $w.msg insert end $s bold \n\n$err {} + $w.msg configure -state disabled + + button $w.continue \ -text [mc "Continue"] \ -command [list destroy $w] - pack $w.buttons.continue -side right -padx 5 - button $w.buttons.unlock \ + button $w.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 + grid $w.msg - $w.vs -sticky news + grid $w.unlock $w.continue - -sticky se -padx 2 -pady 2 + grid columnconfigure $w 0 -weight 1 + grid rowconfigure $w 0 -weight 1 wm protocol $w WM_DELETE_WINDOW update - bind $w.buttons.continue " + bind $w.continue " grab $w - focus $w.buttons.continue + focus %W " tkwait window $w -- cgit v0.10.2-6-g49f6 From 3c6a2870274ea629499dfb6a925548caf55ee105 Mon Sep 17 00:00:00 2001 From: Christopher Beelby Date: Sat, 23 Jan 2010 14:37:17 -0800 Subject: git-gui: Keep repo_config(gui.recentrepos) and .gitconfig in sync When the number of recent repo's gets to ten there can be a situation where an item is removed from the .gitconfig file via a call to git config --unset, but the internal representation of that file (repo_config(gui.recentrepo)) is not updated. Then a subsequent attempt to remove an item from the list fails because git-gui attempts to call --unset on a value that has already been removed. This leads to duplicates in the .gitconfig file, which then also cause errors if the git-gui tries to --unset them (rather than using --unset-all. --unset-all is not used because it is not expected that duplicates should ever be allowed to exist.) When loading the list of recent repositories (proc _get_recentrepos) if a repo in the list is not considered a valid git reposoitory then we should go ahead and remove it so it doesn't take up a slot in the list (since we limit to 10 items). This will prevent a bunch of invalid entries in the list (which are not shown) from making valid entries dissapear off the list even when there are less than ten valid entries. See: http://code.google.com/p/msysgit/issues/detail?id=362 Signed-off-by: Shawn O. Pearce diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl index 633cc57..3f8f303 100644 --- a/lib/choose_repository.tcl +++ b/lib/choose_repository.tcl @@ -235,6 +235,8 @@ proc _get_recentrepos {} { foreach p [get_config gui.recentrepo] { if {[_is_git [file join $p .git]]} { lappend recent $p + } else { + _unset_recentrepo $p } } return [lsort $recent] @@ -243,6 +245,7 @@ proc _get_recentrepos {} { proc _unset_recentrepo {p} { regsub -all -- {([()\[\]{}\.^$+*?\\])} $p {\\\1} p git config --global --unset gui.recentrepo "^$p\$" + load_config 1 } proc _append_recentrepos {path} { @@ -261,6 +264,7 @@ proc _append_recentrepos {path} { lappend recent $path git config --global --add gui.recentrepo $path + load_config 1 while {[llength $recent] > 10} { _unset_recentrepo [lindex $recent 0] -- cgit v0.10.2-6-g49f6 From e27d106ec4b2f68c210703e4bfa3a0a0cf2550a4 Mon Sep 17 00:00:00 2001 From: Peter Krefting Date: Thu, 21 Jan 2010 13:15:17 +0100 Subject: git-gui: Fix gitk for branch whose name matches local file When trying to run gitk on a branch name whose name matches a local file, it will toss an error saying that the name is ambiguous. Adding a pair of dashes will make gitk parse the options to the left of it as branch names. Since wish eats the first pair of dashes we throw at it, we need to add a second one to ensure they get through. Signed-off-by: Peter Krefting Signed-off-by: Shawn O. Pearce diff --git a/git-gui.sh b/git-gui.sh index 822d598..2114945 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1941,7 +1941,7 @@ proc do_gitk {revs} { cd [file dirname [gitdir]] set env(GIT_DIR) [file tail [gitdir]] - eval exec $cmd $revs & + eval exec $cmd $revs "--" "--" & if {$old_GIT_DIR eq {}} { unset env(GIT_DIR) -- cgit v0.10.2-6-g49f6 From 7ec2b69f1ad54db0acee165701c769de33f5ba13 Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Mon, 7 Dec 2009 21:35:59 +0100 Subject: git-gui: Correct file_states when unstaging partly staged entry When unstaging a partly staged file or submodule, the file_states list was not updated properly (unless unstaged linewise). Its index_info part did not contain the former head_info as it should have but kept its old value. This seems not to have had any bad effects but diminishes the value of the file_states list for future enhancements. Signed-off-by: Jens Lehmann Signed-off-by: Shawn O. Pearce diff --git a/git-gui.sh b/git-gui.sh index 2114945..e3473a8 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1613,6 +1613,9 @@ proc merge_state {path new_state {head_info {}} {index_info {}}} { } elseif {$s0 ne {_} && [string index $state 0] eq {_} && $head_info eq {}} { set head_info $index_info + } elseif {$s0 eq {_} && [string index $state 0] ne {_}} { + set index_info $head_info + set head_info {} } set file_states($path) [list $s0$s1 $icon \ -- cgit v0.10.2-6-g49f6 From 390425bdef450a0eb246552f94ca88a05dc11d06 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 7 Dec 2009 18:22:42 -0600 Subject: git-gui: Fix applying a line when all following lines are deletions If a diff looked like: @@ context -del1 -del2 and you wanted to stage the deletion 'del1', the generated patch wouldn't apply because it was missing the line 'del2' converted to context, but this line was counted in the @@-line Signed-off-by: Jeff Epler Signed-off-by: Shawn O. Pearce diff --git a/lib/diff.tcl b/lib/diff.tcl index bd5d189..066755b 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -664,6 +664,7 @@ proc apply_line {x y} { } set i_l $next_l } + set patch "$patch$pre_context" set patch "@@ -$hln,$n +$hln,[eval expr $n $sign 1] @@\n$patch" if {[catch { -- cgit v0.10.2-6-g49f6 From 87cd09f43e56de5235d09aef3ff5d840419fef49 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 23 Jan 2010 11:03:36 +0100 Subject: git-gui: work from the .git dir When git-gui is run from a .git dir, _gitdir would be set to "." by rev-parse, something that confuses the worktree detection. Fix by expanding the value of _gitdir to pwd in this special case. Signed-off-by: Giuseppe Bilotta Signed-off-by: Shawn O. Pearce diff --git a/git-gui.sh b/git-gui.sh index e3473a8..1fb3cbf 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1074,6 +1074,8 @@ if {[catch { set _prefix {} }] && [catch { + # beware that from the .git dir this sets _gitdir to . + # and _prefix to the empty string set _gitdir [git rev-parse --git-dir] set _prefix [git rev-parse --show-prefix] } err]} { @@ -1082,6 +1084,14 @@ if {[catch { choose_repository::pick set picked 1 } + +# we expand the _gitdir when it's just a single dot (i.e. when we're being +# run from the .git dir itself) lest the routines to find the worktree +# get confused +if {$_gitdir eq "."} { + set _gitdir [pwd] +} + if {![file isdirectory $_gitdir] && [is_Cygwin]} { catch {set _gitdir [exec cygpath --windows $_gitdir]} } -- cgit v0.10.2-6-g49f6