git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Paul Mackerras <paulus@ozlabs.org>,
	Denton Liu <liu.denton@gmail.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH] gitk: automatically cd to $GIT_PREFIX
Date: Wed,  5 May 2021 16:18:46 -0500	[thread overview]
Message-ID: <20210505211846.1842824-1-felipe.contreras@gmail.com> (raw)

If gitk is ran as a shell alias it cannot find specified files in the
command line if ran in a subdir (because it's ran in the top-level
directory).

  cd Documentation/
  git -c 'alias.test=!gitk' test -- config.txt

The simplest way to fix this is to automatically cd to the specified
$GIT_PREFIX in the environment.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 gitk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gitk b/gitk
index 23d9dd1..c7c6989 100755
--- a/gitk
+++ b/gitk
@@ -12505,6 +12505,10 @@ if {[catch {set gitdir [exec git rev-parse --git-dir]}]} {
     exit 1
 }
 
+if {[info exists env(GIT_PREFIX)] && $env(GIT_PREFIX) ne ""} {
+    cd $env(GIT_PREFIX)
+}
+
 set selecthead {}
 set selectheadid {}
 
-- 
2.31.0


                 reply	other threads:[~2021-05-05 21:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210505211846.1842824-1-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=liu.denton@gmail.com \
    --cc=paulus@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).