git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] contrib/git-jump: cat output when not a terminal
@ 2020-05-09 19:15 George Brown
  2020-05-09 21:41 ` Junio C Hamano
  0 siblings, 1 reply; 23+ messages in thread
From: George Brown @ 2020-05-09 19:15 UTC (permalink / raw)
  To: git; +Cc: peff

contrib/git-jump: cat output when not a terminal

The current usage to populate Vim's quickfix list cannot be used from
within the editor as it invokes another instance.

Check if stdout is to a terminal or not. If not simply cat the output.

Signed-off-by: George Brown <321.george@gmail.com>
---
 contrib/git-jump/git-jump | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump
index 931b0fe3a9..253341c64e 100755
--- a/contrib/git-jump/git-jump
+++ b/contrib/git-jump/git-jump
@@ -19,8 +19,12 @@ EOF
 }

 open_editor() {
-    editor=`git var GIT_EDITOR`
-    eval "$editor -q \$1"
+    if test -t 1; then
+        editor=`git var GIT_EDITOR`
+        eval "$editor -q \$1"
+    else
+        cat "$1"
+    fi
 }

 mode_diff() {

^ permalink raw reply related	[flat|nested] 23+ messages in thread
* Re: [PATCH] contrib/git-jump: cat output when not a terminal
@ 2020-05-10 20:26 Benjamin
  2020-05-11 14:33 ` Junio C Hamano
  0 siblings, 1 reply; 23+ messages in thread
From: Benjamin @ 2020-05-10 20:26 UTC (permalink / raw)
  To: gitster; +Cc: 321.george, git, peff

Junio writes:

> I somehow doubt that users of vim types "!git jump diff" (or
> whichever submode they want) from within vim's command prompt;
> wouldn't they typically wrap the invocation in a vim macro?

Vim-user here. I run "git jump (options)" from a shell quite a bit, but when I'm
in vim I tend to use ":Ggrep" and similar commands from the fugitive plugin [1].
I don't *think* I'm alone in this.

I'm not really arguing either side, just pointing out that other workflows exist
(and indeed, I'm unlikely to run ":!git jump diff").

[1]: https://github.com/tpope/vim-fugitive

D. Ben Knoble

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-05-13  4:52 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09 19:15 [PATCH] contrib/git-jump: cat output when not a terminal George Brown
2020-05-09 21:41 ` Junio C Hamano
2020-05-09 22:04   ` George Brown
2020-05-09 23:42     ` Junio C Hamano
2020-05-10  9:03       ` George Brown
2020-05-10 16:47         ` Junio C Hamano
2020-05-10 17:33           ` George Brown
2020-05-10 18:12             ` Junio C Hamano
2020-05-10 18:34               ` George Brown
2020-05-10 19:10                 ` Junio C Hamano
2020-05-10 19:25                   ` George Brown
2020-05-10 19:38                   ` Junio C Hamano
2020-05-10 20:20                     ` George Brown
2020-05-11 14:31                       ` Junio C Hamano
2020-05-11 14:31                 ` Jeff King
2020-05-11 15:36                   ` Junio C Hamano
2020-05-11 15:42                     ` Jeff King
2020-05-11 16:46                       ` Re* " Junio C Hamano
2020-05-12 19:23                         ` Jeff King
2020-05-12 21:30                           ` Junio C Hamano
2020-05-13  4:52                             ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2020-05-10 20:26 Benjamin
2020-05-11 14:33 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).