[GIT GUI/PATCH/RFC] git gui: get current theme in 8.5-backwards-compatible way

2016-12-20 Thread Pete Harlan
Later Tcl 8.5 versions learned to return the current theme by omitting
the final argument to "[ttk::style theme use]", but this throws an
error on earlier 8.5 versions (e.g., 8.5.7).

InitTheme works around this by catching the error and reading
::ttk::currentTheme instead.

A call to "[ttk::style theme use]" was added to ttext in 30508bc
("Amend tab ordering and text widget border and highlighting.",
2016-10-02).  Break out InitTheme's workaround into its own
get_current_theme proc and use it in both places.

Signed-off-by: Pete Harlan <p...@tento.net>
---

Note: Applies to the upstream git-gui repo, http://repo.or.cz/git-gui .
To apply to Git itself, apply in the git-gui directory.

Issue entered Git in v2.10.1-537-g3eae30870.

 lib/themed.tcl | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lib/themed.tcl b/lib/themed.tcl
index 351a712..85c157b 100644
--- a/lib/themed.tcl
+++ b/lib/themed.tcl
@@ -28,10 +28,7 @@ proc InitTheme {} {
}
}

-   # Handle either current Tk or older versions of 8.5
-   if {[catch {set theme [ttk::style theme use]}]} {
-   set theme  $::ttk::currentTheme
-   }
+   set theme [get_current_theme]

if {[lsearch -exact {default alt classic clam} $theme] != -1} {
# Simple override of standard ttk::entry to change the field
@@ -248,7 +245,7 @@ proc tspinbox {w args} {
 proc ttext {w args} {
global use_ttk
if {$use_ttk} {
-   switch -- [ttk::style theme use] {
+   switch -- [get_current_theme] {
"vista" - "xpnative" {
lappend args -highlightthickness 0
-borderwidth 0
}
@@ -343,6 +340,16 @@ proc on_choosefont {familyvar sizevar font} {
set size [dict get $font -size]
 }

+# Get current theme in a backwards-compatible way.
+proc get_current_theme {} {
+   # Handle either current Tk or older versions of 8.5
+   if {[catch {set theme [ttk::style theme use]}]} {
+   set theme $::ttk::currentTheme
+   }
+
+   return $theme
+}
+
 # Local variables:
 # mode: tcl
 # indent-tabs-mode: t


Regression? Ambiguous tags listed as "tags/"

2016-01-23 Thread Pete Harlan
There was a behavior change in "git tag" in b7cc53e9 (tag.c: use
'ref-filter' APIs, 2015-07-11, v2.5.0-276-gb7cc53e), such that "git
tag" now writes "foo" as "tags/foo" if there is also a branch named
"foo":

% git tag
tags/branchortag
tagonly

Previous behavior:

% git tag
branchortag
tagonly

I prefer the previous behavior.  Perhaps the change was intentional,
but I didn't see it documented.

Thanks,

Pete Harlan
p...@tento.net
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/2] connect: improve check for plink to reduce false positives

2015-04-24 Thread Pete Harlan
On Fri, Apr 24, 2015 at 3:28 PM, brian m. carlson
sand...@crustytoothpaste.net wrote:
 The git_connect function has code to handle plink and tortoiseplink
 specially, as they require different command line arguments from
 OpenSSH.  However, the match was done by checking for plink
 case-insensitively in the string, which led to false positives when

Perhaps s/case-insensitively/anywhere/?

It's not important that it ignored case (your change ignores it too),
it's that it was too lenient about its context.

--Pete

 GIT_SSH contained uplink.  Improve the check by looking for plink or
 tortoiseplink (or those names suffixed with .exe) in the final
 component of the path.

 Signed-off-by: brian m. carlson sand...@crustytoothpaste.net
 ---
  connect.c | 18 +++---
  1 file changed, 15 insertions(+), 3 deletions(-)

 diff --git a/connect.c b/connect.c
 index 749a07b..c0144d8 100644
 --- a/connect.c
 +++ b/connect.c
 @@ -724,7 +724,7 @@ struct child_process *git_connect(int fd[2], const char 
 *url,
 conn-in = conn-out = -1;
 if (protocol == PROTO_SSH) {
 const char *ssh;
 -   int putty;
 +   int putty, tortoiseplink = 0;
 char *ssh_host = hostandport;
 const char *port = NULL;
 get_host_and_port(ssh_host, port);
 @@ -750,14 +750,26 @@ struct child_process *git_connect(int fd[2], const char 
 *url,
 conn-use_shell = 1;
 putty = 0;
 } else {
 +   const char *base;
 +   char *ssh_dup;
 +
 ssh = getenv(GIT_SSH);
 if (!ssh)
 ssh = ssh;
 -   putty = !!strcasestr(ssh, plink);
 +
 +   ssh_dup = xstrdup(ssh);
 +   base = basename(ssh_dup);
 +
 +   tortoiseplink = !strcasecmp(base, 
 tortoiseplink) ||
 +   !strcasecmp(base, 
 tortoiseplink.exe);
 +   putty = !strcasecmp(base, plink) ||
 +   !strcasecmp(base, plink.exe) || 
 tortoiseplink;
 +
 +   free(ssh_dup);
 }

 argv_array_push(conn-args, ssh);
 -   if (putty  !strcasestr(ssh, tortoiseplink))
 +   if (tortoiseplink)
 argv_array_push(conn-args, -batch);
 if (port) {
 /* P is for PuTTY, p is for OpenSSH */
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] status: document the -v/--verbose option

2015-04-23 Thread Pete Harlan
Junio writes:
 Michael Haggerty mhag...@alum.mit.edu writes:

  Document `git status -v`, including its new doubled `-vv` form.
 
  Signed-off-by: Michael Haggerty mhag...@alum.mit.edu
 ---

 Will queue on mg/status-v-v series, which did add description for
 commit -v, but status -v did not have the description to begin
 with and we missed it.
[...]
  +-v::
  +--verbose::
  + In addition to the names of files that have been changed, also
  + show the textual changes that are staged to be committed
  + (i.e., like the output of `git diff`). If `-v` is specified

Should this be `git diff --cached`?

  + twice, then also show the changes in the working tree that
  + have not yet been staged (i.e., like the output of `git diff
  + --cached`).

...and should this just be `git diff`?

--Pete

(Sorry for not replying to the email; bit of a mess here in my setup.)
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html