threads / patch / 25279

patchcheckout: add a space between the commit and "..."

Subject: [PATCH] checkout: add a space between the commit and "..."

## tl;dr

9 messages between Sep 28, 2010 and Sep 29, 2010. Diffs are folded; open one to read it.

replies: 8people: 7as markdown or json

Aaron Plattner· Sep 28, 2010, 22:23 UTC · lore
Switching to a detached head prints something like
  HEAD is now at 9d14017... dir.c: squelch false uninitialized memory warning

These dots get selected when you double-click on the abbreviated commit hash, which makes it annoying to copy and paste.

Add a space between the abbreviated commit and the dots, to improve copy and pasteability.

Reported-by: Joe Kain <jkain@nvidia.com>
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
---
 builtin/checkout.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to builtin/checkout.c +1 −1
diff --git a/builtin/checkout.c b/builtin/checkout.c
index a54583b..ca1cae3 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -303,7 +303,7 @@ static void describe_detached_head(char *msg, struct commit *commit)
 	struct pretty_print_context ctx = {0};
 	parse_commit(commit);
 	pretty_print_commit(CMIT_FMT_ONELINE, commit, &sb, &ctx);
-	fprintf(stderr, "%s %s... %s\n", msg,
+	fprintf(stderr, "%s %s ... %s\n", msg,
 		find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV), sb.buf);
 	strbuf_release(&sb);
 }
-- 
1.7.0.4
Brandon Casey· Sep 28, 2010, 22:40 UTC · re: Aaron Plattner · lore

Re: [PATCH] checkout: add a space between the commit and "..."

On 09/28/2010 05:23 PM, Aaron Plattner wrote:
Show 6 quoted lines
> Switching to a detached head prints something like
> 
>   HEAD is now at 9d14017... dir.c: squelch false uninitialized memory warning
> 
> These dots get selected when you double-click on the abbreviated
> commit hash, which makes it annoying to copy and paste.
This must be another gnome-terminal/konsole "innovation".

xterm still does the "right thing"(tm) _and_ it doesn't eat my alt keystrokes like alt-b to move the cursor back a word. /rant

-Brandon
Kevin Ballard· Sep 28, 2010, 23:34 UTC · re: Brandon Casey · lore

Re: [PATCH] checkout: add a space between the commit and "..."

On Sep 28, 2010, at 3:40 PM, Brandon Casey wrote:
Show 12 quoted lines
> On 09/28/2010 05:23 PM, Aaron Plattner wrote:
>> Switching to a detached head prints something like
>> 
>>  HEAD is now at 9d14017... dir.c: squelch false uninitialized memory warning
>> 
>> These dots get selected when you double-click on the abbreviated
>> commit hash, which makes it annoying to copy and paste.
> 
> This must be another gnome-terminal/konsole "innovation".
> 
> xterm still does the "right thing"(tm) _and_ it doesn't eat my
> alt keystrokes like alt-b to move the cursor back a word. /rant
FWIW, Terminal.app on OS X also does the "right thing".
-Kevin Ballard
Aaron Plattner· Sep 28, 2010, 23:38 UTC · re: Brandon Casey · lore

Re: [PATCH] checkout: add a space between the commit and "..."

On Tue, Sep 28, 2010 at 03:40:11PM -0700, Brandon Casey wrote:
Show 12 quoted lines
> On 09/28/2010 05:23 PM, Aaron Plattner wrote:
> > Switching to a detached head prints something like
> > 
> >   HEAD is now at 9d14017... dir.c: squelch false uninitialized memory warning
> > 
> > These dots get selected when you double-click on the abbreviated
> > commit hash, which makes it annoying to copy and paste.
> 
> This must be another gnome-terminal/konsole "innovation".
> 
> xterm still does the "right thing"(tm) _and_ it doesn't eat my
> alt keystrokes like alt-b to move the cursor back a word. /rant

How is your xterm configured? On my stock Ubuntu 9.10 system, it doesn't do the "right thing"... the dots are selected. Gvim gets it right.

Also, Alt-B appears to work fine in gnome-terminal. I don't have Konsole to try.

-- Aaron
Brandon Casey· Sep 29, 2010, 00:45 UTC · re: Aaron Plattner · lore

Re: [PATCH] checkout: add a space between the commit and "..."

On Tue, Sep 28, 2010 at 6:38 PM, Aaron Plattner <aplattner@nvidia.com> wrote:
Show 16 quoted lines
> On Tue, Sep 28, 2010 at 03:40:11PM -0700, Brandon Casey wrote:
>> On 09/28/2010 05:23 PM, Aaron Plattner wrote:
>> > Switching to a detached head prints something like
>> >
>> >   HEAD is now at 9d14017... dir.c: squelch false uninitialized memory warning
>> >
>> > These dots get selected when you double-click on the abbreviated
>> > commit hash, which makes it annoying to copy and paste.
>>
>> This must be another gnome-terminal/konsole "innovation".
>>
>> xterm still does the "right thing"(tm) _and_ it doesn't eat my
>> alt keystrokes like alt-b to move the cursor back a word. /rant
>
> How is your xterm configured?  On my stock Ubuntu 9.10 system, it doesn't
> do the "right thing"... the dots are selected.  Gvim gets it right.

Nothing special, and nothing that would affect the double-click selection functionality as far as I know. Though I don't know what controls that.

   $ cat ~/.Xresources
   XTerm*geometry: 80x33
   XTerm*faceName: Liberation Mono
   XTerm*faceSize: 9
   XTerm*foreground: green
   XTerm*background: black
Centos5.X and Fedora11.

I hesitate to ask, since you /seem/ to understand that xterm, gnome-terminal, and konsole are three different programs, but I can also imagine there are people who may use the word "xterm" in a generic way to refer to all X11-based terminal programs. So, no offense, but are you sure you're running the program called "xterm"? If the answer is yes, then please ignore the rest of this paragraph. If you are just clicking on the terminal icon to pop-up a terminal, then try typing "xterm" into that terminal. The xterm program may not even be installed by default on Ubuntu anymore (I don't know). But I'm thinking it probably is, and that gvim may merely be vim run inside an xterm, and that's why the selection is working properly.

> Also, Alt-B appears to work fine in gnome-terminal.  I don't have Konsole
> to try.

Ok, they recently got rid of the Tab(with an underlined 'b') menu item. Try alt-f to go forward by a word then. That's still intercepted by gnome.

-Brandon
Johannes Sixt· Sep 29, 2010, 07:20 UTC · re: Brandon Casey · lore

Re: [PATCH] checkout: add a space between the commit and "..."

Am 9/29/2010 0:40, schrieb Brandon Casey:
Show 12 quoted lines
> On 09/28/2010 05:23 PM, Aaron Plattner wrote:
>> Switching to a detached head prints something like
>>
>>   HEAD is now at 9d14017... dir.c: squelch false uninitialized memory warning
>>
>> These dots get selected when you double-click on the abbreviated
>> commit hash, which makes it annoying to copy and paste.
> 
> This must be another gnome-terminal/konsole "innovation".
> 
> xterm still does the "right thing"(tm) _and_ it doesn't eat my
> alt keystrokes like alt-b to move the cursor back a word. /rant

You must be running an xterm with settings from the stone ages. I had the impression that modern installations have the selection configured such that a file path can be selected with a mere double-click, without dragging. For this, the dot must be in the same class as letters and digits. Just for reference (I don't know how to read this):

$ appres XTerm | grep charClass *charClass: 33:48,37:48,43:48,45-47:48,64:48,126:48,95:48

That said, I welcome this change, though I'd just have dropped ... or replaced with a colon (preference for the second).

-- Hannes
Brandon Casey· Sep 29, 2010, 13:13 UTC · re: Johannes Sixt · lore

Re: [PATCH] checkout: add a space between the commit and "..."

On Wed, Sep 29, 2010 at 2:20 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 17 quoted lines
> Am 9/29/2010 0:40, schrieb Brandon Casey:
>> On 09/28/2010 05:23 PM, Aaron Plattner wrote:
>>> Switching to a detached head prints something like
>>>
>>>   HEAD is now at 9d14017... dir.c: squelch false uninitialized memory warning
>>>
>>> These dots get selected when you double-click on the abbreviated
>>> commit hash, which makes it annoying to copy and paste.
>>
>> This must be another gnome-terminal/konsole "innovation".
>>
>> xterm still does the "right thing"(tm) _and_ it doesn't eat my
>> alt keystrokes like alt-b to move the cursor back a word. /rant
>
> You must be running an xterm with settings from the stone ages. I had the
> impression that modern installations have the selection configured such
> that a file path can be selected with a mere double-click,
Fedora 11 (and hopefully later versions), default settings.
   $ appres XTerm | grep charClass; echo nada
   nada
It's probably an ubuntu thing.
> without dragging.

Just right-click to extend the selection. It's a lot easier than reducing an over-aggressive selection (read: impossible). Try using right-click to adjust a double-click selection with and without the charClass setting that you mention below.

Show 5 quoted lines
> For this, the dot must be in the same class as letters and
> digits. Just for reference (I don't know how to read this):
>
> $ appres XTerm | grep charClass
> *charClass:     33:48,37:48,43:48,45-47:48,64:48,126:48,95:48
Thanks, now I know what to disable when I use ubuntu.
   $ echo charClass | xrdb -remove
   # Then start a new xterm
-Brandon
Andreas Schwab· Sep 29, 2010, 21:48 UTC · re: Brandon Casey · lore

Re: [PATCH] checkout: add a space between the commit and "..."

Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil> writes:
Show 9 quoted lines
> On 09/28/2010 05:23 PM, Aaron Plattner wrote:
>> Switching to a detached head prints something like
>> 
>>   HEAD is now at 9d14017... dir.c: squelch false uninitialized memory warning
>> 
>> These dots get selected when you double-click on the abbreviated
>> commit hash, which makes it annoying to copy and paste.
>
> This must be another gnome-terminal/konsole "innovation".
It's configurable in konsole at least (and not the default).
Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Santi Béjar· Sep 29, 2010, 01:49 UTC · re: Aaron Plattner · lore

Re: [PATCH] checkout: add a space between the commit and "..."

On Wed, Sep 29, 2010 at 12:23 AM, Aaron Plattner <aplattner@nvidia.com> wrote:
> Switching to a detached head prints something like
>
>  HEAD is now at 9d14017... dir.c: squelch false uninitialized memory warning
You should also change the message when going from one detached HEAD to another:

$ git co HEAD^ Previous HEAD position was 7bba3dd... Merge branch 'master' into next HEAD is now at df51bf2... Merge branch 'dm/mergetool-vimdiff' into next

Show 6 quoted lines
>
> These dots get selected when you double-click on the abbreviated
> commit hash, which makes it annoying to copy and paste.
>
> Add a space between the abbreviated commit and the dots, to improve
> copy and pasteability.
I would change it to mimic the output of "git commit", something like:

$ git co HEAD^ [HEAD was at 7bba3dd] Merge branch 'master' into next [HEAD is now at df51bf2] Merge branch 'dm/mergetool-vimdiff' into next

HTH, Santi

← back to recent threads