{"thread":{"id":"27802","subject":"gitk: make \"touching paths\" search support backslashes","startedAt":"2011-07-13T08:30:26Z","lastAt":"2011-07-13T08:30:26Z","messageCount":1,"participants":["Yggy King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171220","messageId":"CAE2ZgT1W1ugfjY4fXdSsa8LzSgwYXhNOT=8jD5AZf5J3+FX9HQ@mail.gmail.com","threadId":"27802","inReplyTo":null,"subject":"gitk: make \"touching paths\" search support backslashes","fromName":"Yggy King","fromEmail":"yggy@zeroandone.ca","sentAt":"2011-07-13T08:30:26Z","receivedAt":"2011-07-13T08:30:26Z","isPatch":false,"sender":{"key":"yggy@zeroandone.ca","avatar":null},"body":">From bf31f7cf6faa7b786e231345b69826cc114001e0 Mon Sep 17 00:00:00 2001\nFrom: Yggy King <yggy@zeroandone.ca>\nDate: Wed, 13 Jul 2011 01:15:51 -0700\nSubject: [PATCH] gitk: make \"touching paths\" search support backslashes\n\nGitk can search for commits touching a specified path. The search text is\nalways treated as a regular expression, regardless of the matching option\nselected (Exact, IgnCase, or Regexp). In particular, backslashes escape\nthe next character. This is inconvenient on Windows systems, where backslashes\nare then norm for path specifiers, for example when copy/pasting from\nWindows Explorer or a cmd shell -- these copy-pasted paths must be manually\nmodified in the gitk search text edit box before they will work.\n\nThis change uses the match option \"Exact\" to mean that a slash is a slash,\nnot part of a regular expression. Backslashes are converted to frontslashes\nbefore searching, thus allowing easy copy/pasting of paths on Windows\nsystems. If the previous behaviour of \"touching paths\" search is desired,\nsimply select the \"Regexp\" search mode.\n\nOne potential drawback is that the default setting for the match option\n($findtype in the code) is \"Exact\", and so this change alters the default\nbehaviour, which may confuse users and lead to bug reports.\n\n(This is my first submission to the list -- please be gentle if I've\nviolated protocol. :-)\n\nSigned-off-by: Yggy King <yggy@zeroandone.ca>\n---\n gitk-git/gitk |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 4cde0c4..d5f604e 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -4528,9 +4528,14 @@ proc makepatterns {l} {\n }\n\n proc do_file_hl {serial} {\n-    global highlight_files filehighlight highlight_paths gdttype fhl_list\n+    global highlight_files filehighlight highlight_paths gdttype\nfindtype fhl_list\n\n     if {$gdttype eq [mc \"touching paths:\"]} {\n+    # If \"exact\" match then convert backslashes to frontslashes. Most useful\n+    # to support Windows-flavoured file paths.\n+    if {$findtype eq [mc \"Exact\"]} {\n+        set highlight_files [string map {\"\\\\\" \"/\"} $highlight_files]\n+    }\n \tif {[catch {set paths [shellsplit $highlight_files]}]} return\n \tset highlight_paths [makepatterns $paths]\n \thighlight_filelist\n-- \n1.7.6.msysgit.0\n"}]}