Re: [PATCH] git: add -N as a short option for --no-pager

2018-05-01 Thread Kaartic Sivaraam
On Wednesday 25 April 2018 11:55 AM, Johannes Sixt wrote:
> 
> I considered -P, but thought that it would better be reserved for
> something related to "paths". We have --{html,man,info}-path, which
> would be served better with -[HMI]. That leaves --exec-path, which we
> would probably abbreviate as -x or -X. So, -P is perhaps not that bad
> after all.
> 

It might be a good choice but I don't think it's not the best choice
anyway because '-P' doesn't seem to communicate 'no pager' well.


> Perhaps --no-pager means also "unpaginated" (-u, -U), "linear" (-l, -L),
> "streamed" (-s, -S). Other ideas, anyone?
>

Considering the other alternatives you suggested (as I couldn't come up
with a better "single letter" option ;-) ), I think '-s' might be a nice
choice but would possibly need some explanation in the documentation to
the wondering users.

In the end, lacking a better one letter option, I think '-P' would be a
better choice after all. It would, possibly, be easily understood as a
negation of pagination (-p). So, I guess it would be better to go with
'-P' than '-N'.

-- 
Sivaraam

QUOTE:

“The most valuable person on any team is the person who makes everyone
else on the team more valuable, not the person who knows the most.”

  - Joel Spolsky

KIND NOTE TO THE NATIVE ENGLISH SPEAKER:

As I'm not a native English speaker myself, there might be mistaeks in
my usage of English. I apologise for any mistakes that I make.

It would be "helpful" if you take the time to point out the mistakes.

It would be "super helpful" if you could provide suggestions about how
to correct those mistakes.

Thanks in advance!



signature.asc
Description: OpenPGP digital signature


Re: [PATCH] git: add -N as a short option for --no-pager

2018-05-01 Thread Kaartic Sivaraam
On Thursday 26 April 2018 01:01 AM, Johannes Sixt wrote:
> 
> Right. But I have LESS=RS because I do *not* want it to remain on screen
> by default.
> 

In that case how about updating the commit message to be more clear
about it. How about,

It is possible to configure 'less', the pager, to use an
alternate screen to show the content. When it is closed in this
case, it switches back to the original screen, and all content
is gone.

-- 
Sivaraam

QUOTE:

“The most valuable person on any team is the person who makes everyone
else on the team more valuable, not the person who knows the most.”

  - Joel Spolsky

KIND NOTE TO THE NATIVE ENGLISH SPEAKER:

As I'm not a native English speaker myself, there might be mistaeks in
my usage of English. I apologise for any mistakes that I make.

It would be "helpful" if you take the time to point out the mistakes.

It would be "super helpful" if you could provide suggestions about how
to correct those mistakes.

Thanks in advance!



signature.asc
Description: OpenPGP digital signature


Re: [PATCH] git: add -N as a short option for --no-pager

2018-04-25 Thread Johannes Sixt

Am 25.04.2018 um 11:21 schrieb Phillip Wood:

On 24/04/18 17:59, Johannes Sixt wrote:


In modern setups, less, the pager, uses alternate screen to show
the content. When it is closed, it switches back to the original
screen, and all content is gone.


Are you setting LESS explicitly in the environment?

 From the git config man page:
When the LESS environment variable is unset, Git sets it to FRX (if LESS 
environment variable is set, Git does not change it at all).


 From the less man page the X option:
Disables  sending the termcap initialization and deinitialization 
strings to the terminal.  This is sometimes desirable if the 
deinitialization string does something unnecessary, like clearing the 
screen.


So with the default setup the output should remain on the screen.


Right. But I have LESS=RS because I do *not* want it to remain on screen 
by default.


-- Hannes


Re: [PATCH] git: add -N as a short option for --no-pager

2018-04-25 Thread Johannes Sixt

Am 25.04.2018 um 09:41 schrieb Johannes Schindelin:

Hi Hannes,

On Wed, 25 Apr 2018, Johannes Sixt wrote:


Am 25.04.2018 um 02:05 schrieb Junio C Hamano:

Johannes Sixt  writes:

It is not uncommon to request that the output remains visible in
the terminal.


I ran `git log` and then hit `q`, and the latest screen contents were
still visible in all of these scenarios:

- in a Linux VM via SSH client

- in Git Bash on Windows

- in Git CMD on Windows

Granted, this is only the latest screen, but that is usually good enough
here.

Is anything different happening in your setups?


I have LESS=RS in my environment, because I do want that the alternate 
screen is used by the pager. Nevertheless, occasionally I want git's 
output to remain visible.


-- Hannes


Re: [PATCH] git: add -N as a short option for --no-pager

2018-04-25 Thread Phillip Wood

On 24/04/18 17:59, Johannes Sixt wrote:


In modern setups, less, the pager, uses alternate screen to show
the content. When it is closed, it switches back to the original
screen, and all content is gone.


Are you setting LESS explicitly in the environment?

From the git config man page:
When the LESS environment variable is unset, Git sets it to FRX (if LESS 
environment variable is set, Git does not change it at all).


From the less man page the X option:
Disables  sending the termcap initialization and deinitialization 
strings to the terminal.  This is sometimes desirable if the 
deinitialization string does something unnecessary, like clearing the 
screen.


So with the default setup the output should remain on the screen.

Best Wishes

Phillip



It is not uncommon to request that the output remains visible in
the terminal. For this, the option --no-pager can be used. But
it is a bit cumbersome to type, even when command completion is
available. Provide a short option, -N, to make the option easier
accessible.

Signed-off-by: Johannes Sixt 
---
  Documentation/git.txt | 3 ++-
  git.c | 4 ++--
  2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Documentation/git.txt b/Documentation/git.txt
index 4767860e72..17b50b0dc6 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -11,7 +11,7 @@ SYNOPSIS
  [verse]
  'git' [--version] [--help] [-C ] [-c =]
  [--exec-path[=]] [--html-path] [--man-path] [--info-path]
-[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
+[-p|--paginate|-N|--no-pager] [--no-replace-objects] [--bare]
  [--git-dir=] [--work-tree=] [--namespace=]
  [--super-prefix=]
   []
@@ -103,6 +103,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which 
`git config
configuration options (see the "Configuration Mechanism" section
below).
  
+-N::

  --no-pager::
Do not pipe Git output into a pager.
  
diff --git a/git.c b/git.c

index ceaa58ef40..9e2d78f442 100644
--- a/git.c
+++ b/git.c
@@ -7,7 +7,7 @@
  const char git_usage_string[] =
N_("git [--version] [--help] [-C ] [-c =]\n"
   "   [--exec-path[=]] [--html-path] [--man-path] 
[--info-path]\n"
-  "   [-p | --paginate | --no-pager] [--no-replace-objects] 
[--bare]\n"
+  "   [-p | --paginate | -N | --no-pager] [--no-replace-objects] 
[--bare]\n"
   "   [--git-dir=] [--work-tree=] 
[--namespace=]\n"
   "[]");
  
@@ -81,7 +81,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)

exit(0);
} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
use_pager = 1;
-   } else if (!strcmp(cmd, "--no-pager")) {
+   } else if (!strcmp(cmd, "-N") || !strcmp(cmd, "--no-pager")) {
use_pager = 0;
if (envchanged)
*envchanged = 1;





Re: [PATCH] git: add -N as a short option for --no-pager

2018-04-25 Thread Johannes Schindelin
Hi Hannes,

On Wed, 25 Apr 2018, Johannes Sixt wrote:

> Am 25.04.2018 um 02:05 schrieb Junio C Hamano:
> > Johannes Sixt  writes:
> > > It is not uncommon to request that the output remains visible in
> > > the terminal.

I ran `git log` and then hit `q`, and the latest screen contents were
still visible in all of these scenarios:

- in a Linux VM via SSH client

- in Git Bash on Windows

- in Git CMD on Windows

Granted, this is only the latest screen, but that is usually good enough
here.

Is anything different happening in your setups?

Ciao,
Dscho


Re: [PATCH] git: add -N as a short option for --no-pager

2018-04-25 Thread Johannes Sixt

Am 25.04.2018 um 02:05 schrieb Junio C Hamano:

Johannes Sixt  writes:

It is not uncommon to request that the output remains visible in
the terminal. For this, the option --no-pager can be used. But
it is a bit cumbersome to type, even when command completion is
available. Provide a short option, -N, to make the option easier
accessible.

Signed-off-by: Johannes Sixt 
---


Heh, I used to append "|cat", which is four keystrokes that is a bit
shorter than " --no-pager", but that is only acceptable when you do
not care about colored output ;-)

I am not absolutely certain about the choice of a single letter. I
already checked we do not use "git -N cmd" for anything else right
now, so I am certain about the availability, but I am not sure if
capital 'N' is the best choice, when the other side is lowercase 'p'
(and more importantly, the other side 'p' has mneomonic value for
'pagination', but 'N' merely stands for 'no' and could be negating
anything, not related to pagination). But I agree that a short-hand
would be welcome.


I considered -P, but thought that it would better be reserved for 
something related to "paths". We have --{html,man,info}-path, which 
would be served better with -[HMI]. That leaves --exec-path, which we 
would probably abbreviate as -x or -X. So, -P is perhaps not that bad 
after all.


We could also choose +p, for which there is some precedent in other 
POSIX tools to mean negated -p, but not in git, I think. 
Implementationwise, it is not that trivial, either, because the section 
handling options is guarded by a check that the word begins with a dash.


Perhaps --no-pager means also "unpaginated" (-u, -U), "linear" (-l, -L), 
"streamed" (-s, -S). Other ideas, anyone?





diff --git a/Documentation/git.txt b/Documentation/git.txt
index 4767860e72..17b50b0dc6 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -11,7 +11,7 @@ SYNOPSIS
  [verse]
  'git' [--version] [--help] [-C ] [-c =]
  [--exec-path[=]] [--html-path] [--man-path] [--info-path]
-[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
+[-p|--paginate|-N|--no-pager] [--no-replace-objects] [--bare]
  [--git-dir=] [--work-tree=] [--namespace=]
  [--super-prefix=]
   []


Re: [PATCH] git: add -N as a short option for --no-pager

2018-04-24 Thread Beat Bolli <bbo...@ewanet.ch>
On Wed, Apr 25, 2018 at 09:05:56AM +0900, Junio C Hamano wrote:
> Johannes Sixt  writes:
> 
> > In modern setups, less, the pager, uses alternate screen to show
> > the content. When it is closed, it switches back to the original
> > screen, and all content is gone.
> >
> > It is not uncommon to request that the output remains visible in
> > the terminal. For this, the option --no-pager can be used. But
> > it is a bit cumbersome to type, even when command completion is
> > available. Provide a short option, -N, to make the option easier
> > accessible.
> >
> > Signed-off-by: Johannes Sixt 
> > ---
> 
> Heh, I used to append "|cat", which is four keystrokes that is a bit
> shorter than " --no-pager", but that is only acceptable when you do
> not care about colored output ;-)
> 
> I am not absolutely certain about the choice of a single letter. I
> already checked we do not use "git -N cmd" for anything else right
> now, so I am certain about the availability, but I am not sure if
> capital 'N' is the best choice, when the other side is lowercase 'p'
> (and more importantly, the other side 'p' has mneomonic value for
> 'pagination', but 'N' merely stands for 'no' and could be negating
> anything, not related to pagination). But I agree that a short-hand
> would be welcome.
> 

I'm quite fond of the notation "-p-", but that would set a precedent for
all other "--no-" options.

Maybe the option parser could be enhanced to allow for both?

Thanks,
Beat

> > diff --git a/Documentation/git.txt b/Documentation/git.txt
> > index 4767860e72..17b50b0dc6 100644
> > --- a/Documentation/git.txt
> > +++ b/Documentation/git.txt
> > @@ -11,7 +11,7 @@ SYNOPSIS
> >  [verse]
> >  'git' [--version] [--help] [-C ] [-c =]
> >  [--exec-path[=]] [--html-path] [--man-path] [--info-path]
> > -[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
> > +[-p|--paginate|-N|--no-pager] [--no-replace-objects] [--bare]
> >  [--git-dir=] [--work-tree=] [--namespace=]
> >  [--super-prefix=]
> >   []
> > @@ -103,6 +103,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which 
> > `git config
> > configuration options (see the "Configuration Mechanism" section
> > below).
> >  
> > +-N::
> >  --no-pager::
> > Do not pipe Git output into a pager.


signature.asc
Description: PGP signature


Re: [PATCH] git: add -N as a short option for --no-pager

2018-04-24 Thread Junio C Hamano
Johannes Sixt  writes:

> In modern setups, less, the pager, uses alternate screen to show
> the content. When it is closed, it switches back to the original
> screen, and all content is gone.
>
> It is not uncommon to request that the output remains visible in
> the terminal. For this, the option --no-pager can be used. But
> it is a bit cumbersome to type, even when command completion is
> available. Provide a short option, -N, to make the option easier
> accessible.
>
> Signed-off-by: Johannes Sixt 
> ---

Heh, I used to append "|cat", which is four keystrokes that is a bit
shorter than " --no-pager", but that is only acceptable when you do
not care about colored output ;-)

I am not absolutely certain about the choice of a single letter. I
already checked we do not use "git -N cmd" for anything else right
now, so I am certain about the availability, but I am not sure if
capital 'N' is the best choice, when the other side is lowercase 'p'
(and more importantly, the other side 'p' has mneomonic value for
'pagination', but 'N' merely stands for 'no' and could be negating
anything, not related to pagination). But I agree that a short-hand
would be welcome.

> diff --git a/Documentation/git.txt b/Documentation/git.txt
> index 4767860e72..17b50b0dc6 100644
> --- a/Documentation/git.txt
> +++ b/Documentation/git.txt
> @@ -11,7 +11,7 @@ SYNOPSIS
>  [verse]
>  'git' [--version] [--help] [-C ] [-c =]
>  [--exec-path[=]] [--html-path] [--man-path] [--info-path]
> -[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
> +[-p|--paginate|-N|--no-pager] [--no-replace-objects] [--bare]
>  [--git-dir=] [--work-tree=] [--namespace=]
>  [--super-prefix=]
>   []
> @@ -103,6 +103,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which 
> `git config
>   configuration options (see the "Configuration Mechanism" section
>   below).
>  
> +-N::
>  --no-pager::
>   Do not pipe Git output into a pager.