From: Eric Sunshine <sunshine@sunshineco.com>
To: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 1/1] gitk: add --cwd=path commandline parameter to change path
Date: Tue, 3 Nov 2015 13:27:00 -0500 [thread overview]
Message-ID: <CAPig+cSs0v88AiQwSrqm-wK7rY4RdykaVf5Axh5jFyij25rfvg@mail.gmail.com> (raw)
In-Reply-To: <1446562842-8478-2-git-send-email-juhapekka.heikkila@gmail.com>
On Tue, Nov 3, 2015 at 10:00 AM, Juha-Pekka Heikkila
<juhapekka.heikkila@gmail.com> wrote:
> This patch adds --cwd (change working directory) parameter to
> gitk. With this parameter, instead of need to cd to directory
> with .git folder, one can point the correct folder from
> commandline.
git itself supports this sort of functionality via -C, as does GNU
tar, which suggests such an option in gitk should be named -C, as
well.
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> ---
> diff --git a/Documentation/gitk.txt b/Documentation/gitk.txt
> @@ -146,6 +146,11 @@ gitk-specific options
> Select the specified commit after loading the graph.
> Default behavior is equivalent to specifying '--select-commit=HEAD'.
>
> +--cwd=<path>::
> +
> + Change working direcoty to <path>. If the git tree exist elsewhere
s/direcoty/directory/
> + gitk first cd to given path before start to operate.
Taking git's -C documentation as a template, perhaps this could be
written instead as:
Run as if gitk was started in '<path>' instead of the current
working directory. When multiple `-C` options are given, each
subsequent non-absolute `-C <path>` is interpreted relative to
the preceding `-C <path>`.
This description correctly reflects your implementation which allows
--cwd to be specified multiple times.
> Examples
> --------
> gitk v2.6.12.. include/scsi drivers/scsi::
> diff --git a/gitk-git/gitk b/gitk-git/gitk
> index fcc606e..5fdf459 100755
> --- a/gitk-git/gitk
> +++ b/gitk-git/gitk
> @@ -12279,12 +12279,6 @@ setui $uicolor
>
> setoptions
>
> -# check that we can find a .git directory somewhere...
> -if {[catch {set gitdir [exec git rev-parse --git-dir]}]} {
> - show_error {} . [mc "Cannot find a git repository here."]
> - exit 1
> -}
> -
> set selecthead {}
> set selectheadid {}
>
> @@ -12305,6 +12299,9 @@ foreach arg $argv {
> "--argscmd=*" {
> set revtreeargscmd [string range $arg 10 end]
> }
> + "--cwd=*" {
> + cd [string range $arg 6 end]
> + }
> default {
> lappend revtreeargs $arg
> }
> @@ -12312,6 +12309,12 @@ foreach arg $argv {
> incr i
> }
>
> +# check that we can find a .git directory somewhere...
> +if {[catch {set gitdir [exec git rev-parse --git-dir]}]} {
> + show_error {} . [mc "Cannot find a git repository here."]
> + exit 1
> +}
> +
> if {$selecthead eq "HEAD"} {
> set selecthead {}
> }
> --
> 1.9.1
next prev parent reply other threads:[~2015-11-03 18:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-03 15:00 [PATCH 0/1] gitk: add --cwd=path commandline parameter to change path Juha-Pekka Heikkila
2015-11-03 15:00 ` [PATCH 1/1] " Juha-Pekka Heikkila
2015-11-03 18:27 ` Eric Sunshine [this message]
2015-11-05 9:19 ` [PATCH v2] gitk: add -C <path> " Juha-Pekka Heikkila
2015-11-06 9:48 ` Eric Sunshine
2015-11-06 10:49 ` Juha-Pekka Heikkila
2015-11-09 11:45 ` [PATCH v3] " Juha-Pekka Heikkila
2015-12-19 3:13 ` Paul Mackerras
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=CAPig+cSs0v88AiQwSrqm-wK7rY4RdykaVf5Axh5jFyij25rfvg@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=juhapekka.heikkila@gmail.com \
/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).