{"thread":{"id":"19676","subject":"preventing checking out remote branch in gitk","startedAt":"2009-06-05T15:21:41Z","lastAt":"2009-06-06T04:06:51Z","messageCount":2,"participants":["Sitaram Chamarty"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"115511","messageId":"slrnh2ie05.8mr.sitaramc@sitaramc.homelinux.net","threadId":"19676","inReplyTo":null,"subject":"preventing checking out remote branch in gitk","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-06-05T15:21:41Z","receivedAt":"2009-06-05T15:21:41Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"Hello,\n\nI have a fair number of new users, mostly refugees from VSS\nand SVN, and they do use the GUIs a fair bit.\n\nAnd they keep doing this :-)  I know what you're thinking:\nteach them not to do it...\n\nBut doing this at the command line gives you a nice warning,\nand a GUI is (like it or not) considered more \"safe\" (aka\nless powerful).  So it should go one better and just refuse\n:-)\n\nIs there any way we can disable \"Checkout this branch\" for\nbranches that are not local in gitk?  I'm willing to play\naround with the code and test it if someone can give me a\ncouple of pointers at least.\n\nThanks,\n\nSitaram\n"},{"id":"115598","messageId":"slrnh2jqqr.64k.sitaramc@sitaramc.homelinux.net","threadId":"19676","inReplyTo":"slrnh2ie05.8mr.sitaramc@sitaramc.homelinux.net","subject":"[PATCH] gitk: disable checkout of remote branch","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-06-06T04:06:51Z","receivedAt":"2009-06-06T04:06:51Z","isPatch":true,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"At the command line, this gives you a detailed warning message, but the\nGUI currently allows it without any fuss.\n\nSince the GUI is often used by people much less familiar with git, it\nseems reasonable to make the GUI more restrictive than the command line,\nnot less.\n\nThis prevents a lot of detached HEAD commits by new users.\n\nSigned-off-by: Sitaram Chamarty <sitaramc@gmail.com>\n---\n\nI have a lot of new users, and I'd really appreciate it if\nsomeone could review (hey it's my first Tcl code in all my\nlife!) and approve; this will save me a whole boatload of\ntrouble :-)\n\nIf someone disagrees with the logic that the GUI should be\nmore \"safe\" than the command line please do let me know.\n\n gitk-git/gitk |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n mode change 100644 => 100755 gitk-git/gitk\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nold mode 100644\nnew mode 100755\nindex 8c66d17..411bc52\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -8770,6 +8770,9 @@ proc headmenu {x y id head} {\n     set headmenuid $id\n     set headmenuhead $head\n     set state normal\n+    if {[string match \"remotes/*\" $head]} {\n+\tset state disabled\n+    }\n     if {$head eq $mainhead} {\n \tset state disabled\n     }\n-- \n1.6.3.2\n"}]}