{"thread":{"id":"15171","subject":"[GIT-GUI PATCH] Teach git gui about file type changes","startedAt":"2008-08-22T20:10:27Z","lastAt":"2008-08-25T04:36:04Z","messageCount":2,"participants":["Gustaf Hendeby","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"88185","messageId":"1219435827-11122-1-git-send-email-hendeby@isy.liu.se","threadId":"15171","inReplyTo":null,"subject":"[GIT-GUI PATCH] Teach git gui about file type changes","fromName":"Gustaf Hendeby","fromEmail":"hendeby@isy.liu.se","sentAt":"2008-08-22T20:10:27Z","receivedAt":"2008-08-22T20:10:27Z","isPatch":true,"sender":{"key":"hendeby@isy.liu.se","avatar":"https://avatars.githubusercontent.com/u/730316?v=4"},"body":"Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>\n---\n\nHi!\n\nFirst of all, I'm really new to tcl/tk and the git gui code base so I\nwould appreciate any and all pointers here to make the changes\nacceptable.\n\nSecondly, I could really not come up with an icon to represent a type\nchange of a file.  Right now it is just different from all the others\nand not illustrative at all...\n\n/Gustaf\n\n git-gui.sh     |   18 +++++++++++++++++-\n lib/commit.tcl |    2 ++\n lib/index.tcl  |    7 +++++++\n 3 files changed, 26 insertions(+), 1 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex ad65aaa..8ad6567 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -1619,6 +1619,15 @@ static unsigned char file_merge_bits[] = {\n    0xfa, 0x17, 0x02, 0x10, 0xfe, 0x1f};\n } -maskdata $filemask\n \n+image create bitmap file_statechange -background white -foreground green -data {\n+#define file_merge_width 14\n+#define file_merge_height 15\n+static unsigned char file_statechange_bits[] = {\n+   0xfe, 0x01, 0x02, 0x03, 0x02, 0x05, 0x02, 0x09, 0x02, 0x1f, 0x62, 0x10,\n+   0x62, 0x10, 0xba, 0x11, 0xba, 0x11, 0x62, 0x10, 0x62, 0x10, 0x02, 0x10,\n+   0x02, 0x10, 0x02, 0x10, 0xfe, 0x1f};\n+} -maskdata $filemask\n+\n set ui_index .vpane.files.index.list\n set ui_workdir .vpane.files.workdir.list\n \n@@ -1627,12 +1636,14 @@ set all_icons(A$ui_index)   file_fulltick\n set all_icons(M$ui_index)   file_fulltick\n set all_icons(D$ui_index)   file_removed\n set all_icons(U$ui_index)   file_merge\n+set all_icons(T$ui_index)   file_statechange\n \n set all_icons(_$ui_workdir) file_plain\n set all_icons(M$ui_workdir) file_mod\n set all_icons(D$ui_workdir) file_question\n set all_icons(U$ui_workdir) file_merge\n set all_icons(O$ui_workdir) file_plain\n+set all_icons(T$ui_workdir) file_statechange\n \n set max_status_desc 0\n foreach i {\n@@ -1643,6 +1654,9 @@ foreach i {\n \t\t{MM {mc \"Portions staged for commit\"}}\n \t\t{MD {mc \"Staged for commit, missing\"}}\n \n+\t\t{_T {mc \"File type changed, not staged\"}}\n+\t\t{T_ {mc \"File type changed, staged\"}}\n+\n \t\t{_O {mc \"Untracked, not staged\"}}\n \t\t{A_ {mc \"Staged for commit\"}}\n \t\t{AM {mc \"Portions staged for commit\"}}\n@@ -2757,7 +2771,9 @@ proc popup_diff_menu {ctxm x y X Y} {\n \tif {$::is_3way_diff\n \t\t|| $current_diff_path eq {}\n \t\t|| ![info exists file_states($current_diff_path)]\n-\t\t|| {_O} eq [lindex $file_states($current_diff_path) 0]} {\n+\t\t|| {_O} eq [lindex $file_states($current_diff_path) 0]\n+\t\t|| {_T} eq [lindex $file_states($current_diff_path) 0]\n+\t\t|| {T_} eq [lindex $file_states($current_diff_path) 0]} {\n \t\tset s disabled\n \t} else {\n \t\tset s normal\ndiff --git a/lib/commit.tcl b/lib/commit.tcl\nindex 40a7103..f4ab707 100644\n--- a/lib/commit.tcl\n+++ b/lib/commit.tcl\n@@ -149,6 +149,7 @@ The rescan will be automatically started now.\n \t\t_? {continue}\n \t\tA? -\n \t\tD? -\n+\t\tT_ -\n \t\tM? {set files_ready 1}\n \t\tU? {\n \t\t\terror_popup [mc \"Unmerged files cannot be committed.\n@@ -428,6 +429,7 @@ A rescan will be automatically started now.\n \t\t__ -\n \t\tA_ -\n \t\tM_ -\n+\t\tT_ -\n \t\tD_ {\n \t\t\tunset file_states($path)\n \t\t\tcatch {unset selected_paths($path)}\ndiff --git a/lib/index.tcl b/lib/index.tcl\nindex 3c1fce7..0a98715 100644\n--- a/lib/index.tcl\n+++ b/lib/index.tcl\n@@ -99,6 +99,7 @@ proc write_update_indexinfo {fd pathList totalCnt batch after} {\n \t\tswitch -glob -- [lindex $s 0] {\n \t\tA? {set new _O}\n \t\tM? {set new _M}\n+\t\tT_ {set new _T}\n \t\tD_ {set new _D}\n \t\tD? {set new _?}\n \t\t?? {continue}\n@@ -162,6 +163,7 @@ proc write_update_index {fd pathList totalCnt batch after} {\n \t\t?D {set new D_}\n \t\t_O -\n \t\tAM {set new A_}\n+\t\t_T {set new T_}\n \t\tU? {\n \t\t\tif {[file exists $path]} {\n \t\t\t\tset new M_\n@@ -231,6 +233,7 @@ proc write_checkout_index {fd pathList totalCnt batch after} {\n \t\tswitch -glob -- [lindex $file_states($path) 0] {\n \t\tU? {continue}\n \t\t?M -\n+\t\t_T -\n \t\t?D {\n \t\t\tputs -nonewline $fd \"[encoding convertto $path]\\0\"\n \t\t\tdisplay_file $path ?_\n@@ -252,6 +255,7 @@ proc unstage_helper {txt paths} {\n \t\tswitch -glob -- [lindex $file_states($path) 0] {\n \t\tA? -\n \t\tM? -\n+\t\tT_ -\n \t\tD? {\n \t\t\tlappend pathList $path\n \t\t\tif {$path eq $current_diff_path} {\n@@ -296,6 +300,7 @@ proc add_helper {txt paths} {\n \t\t_O -\n \t\t?M -\n \t\t?D -\n+\t\t_T -\n \t\tU? {\n \t\t\tlappend pathList $path\n \t\t\tif {$path eq $current_diff_path} {\n@@ -336,6 +341,7 @@ proc do_add_all {} {\n \t\tswitch -glob -- [lindex $file_states($path) 0] {\n \t\tU? {continue}\n \t\t?M -\n+\t\t_T -\n \t\t?D {lappend paths $path}\n \t\t}\n \t}\n@@ -353,6 +359,7 @@ proc revert_helper {txt paths} {\n \t\tswitch -glob -- [lindex $file_states($path) 0] {\n \t\tU? {continue}\n \t\t?M -\n+\t\t_T -\n \t\t?D {\n \t\t\tlappend pathList $path\n \t\t\tif {$path eq $current_diff_path} {\n-- \n1.6.0.150.gf1ade9\n"},{"id":"88425","messageId":"20080825043604.GB19127@spearce.org","threadId":"15171","inReplyTo":"1219435827-11122-1-git-send-email-hendeby@isy.liu.se","subject":"Re: [GIT-GUI PATCH] Teach git gui about file type changes","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-08-25T04:36:04Z","receivedAt":"2008-08-25T04:36:04Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Gustaf Hendeby <hendeby@isy.liu.se> wrote:\n> First of all, I'm really new to tcl/tk and the git gui code base so I\n> would appreciate any and all pointers here to make the changes\n> acceptable.\n\nYour patch looks good, but I am squashing this into it.  By using\n?T rather than _T we can correctly handle MT, which I think happens\nwhen the user modifies the file content, stages the file, then\nchanges the mode (644->755).\n\ndiff --git a/lib/index.tcl b/lib/index.tcl\nindex 0a98715..7c27f2a 100644\n--- a/lib/index.tcl\n+++ b/lib/index.tcl\n@@ -233,7 +233,7 @@ proc write_checkout_index {fd pathList totalCnt batch after} {\n \t\tswitch -glob -- [lindex $file_states($path) 0] {\n \t\tU? {continue}\n \t\t?M -\n-\t\t_T -\n+\t\t?T -\n \t\t?D {\n \t\t\tputs -nonewline $fd \"[encoding convertto $path]\\0\"\n \t\t\tdisplay_file $path ?_\n@@ -300,7 +300,7 @@ proc add_helper {txt paths} {\n \t\t_O -\n \t\t?M -\n \t\t?D -\n-\t\t_T -\n+\t\t?T -\n \t\tU? {\n \t\t\tlappend pathList $path\n \t\t\tif {$path eq $current_diff_path} {\n@@ -341,7 +341,7 @@ proc do_add_all {} {\n \t\tswitch -glob -- [lindex $file_states($path) 0] {\n \t\tU? {continue}\n \t\t?M -\n-\t\t_T -\n+\t\t?T -\n \t\t?D {lappend paths $path}\n \t\t}\n \t}\n@@ -359,7 +359,7 @@ proc revert_helper {txt paths} {\n \t\tswitch -glob -- [lindex $file_states($path) 0] {\n \t\tU? {continue}\n \t\t?M -\n-\t\t_T -\n+\t\t?T -\n \t\t?D {\n \t\t\tlappend pathList $path\n \t\t\tif {$path eq $current_diff_path} {\n \n> Secondly, I could really not come up with an icon to represent a type\n> change of a file.  Right now it is just different from all the others\n> and not illustrative at all...\n\nI think the icon looks fine.  I cannot come up with anything\nbetter myself.\n\n-- \nShawn.\n"}]}