git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: disable checkout of remote branch

From
Sitaram Chamarty <sitaramc@gmail.com>
Date
Jun 6, 2009, 04:06 UTC
Message-ID
<slrnh2jqqr.64k.sitaramc@sitaramc.homelinux.net>
In-Reply-To
<slrnh2ie05.8mr.sitaramc@sitaramc.homelinux.net>

At the command line, this gives you a detailed warning message, but the GUI currently allows it without any fuss.

Since the GUI is often used by people much less familiar with git, it seems reasonable to make the GUI more restrictive than the command line, not less.

This prevents a lot of detached HEAD commits by new users.
Signed-off-by: Sitaram Chamarty <sitaramc@gmail.com>
---

I have a lot of new users, and I'd really appreciate it if someone could review (hey it's my first Tcl code in all my life!) and approve; this will save me a whole boatload of trouble :-)

If someone disagrees with the logic that the GUI should be more "safe" than the command line please do let me know.

 gitk-git/gitk |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 gitk-git/gitk
diff --git a/gitk-git/gitk b/gitk-git/gitk
old mode 100644
new mode 100755
index 8c66d17..411bc52
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -8770,6 +8770,9 @@ proc headmenu {x y id head} {
     set headmenuid $id
     set headmenuhead $head
     set state normal
+    if {[string match "remotes/*" $head]} {
+	set state disabled
+    }
     if {$head eq $mainhead} {
 	set state disabled
     }
-- 
1.6.3.2
Previous: Sitaram Chamarty
Message 2 of 2 in “preventing checking out remote branch in gitk”
  1. Sitaram ChamartyJun 5, 2009
  2. gitk: disable checkout of remote branchSitaram Chamarty, Jun 6, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.