git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: automatically cd to $GIT_PREFIX

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 5, 2021, 21:18 UTC
Message-ID
<20210505211846.1842824-1-felipe.contreras@gmail.com>

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
Message 1 of 1 in “gitk: automatically cd to $GIT_PREFIX”
  1. gitk: automatically cd to $GIT_PREFIXFelipe Contreras, May 5, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.