git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Git List <git@vger.kernel.org>, Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH v2] gitk: add -C <path> commandline parameter to change path
Date: Fri, 6 Nov 2015 12:49:41 +0200	[thread overview]
Message-ID: <563C85C5.80703@gmail.com> (raw)
In-Reply-To: <CAPig+cT9K2H_jzVNOHS0vaarU+tfDfp_=Z4c1n6o5EX9wE6JXA@mail.gmail.com>

On 06.11.2015 11:48, Eric Sunshine wrote:
> On Thu, Nov 5, 2015 at 4:19 AM, Juha-Pekka Heikkila
> <juhapekka.heikkila@gmail.com> wrote:
>> This patch adds -C (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.
>
> Thanks, -C makes more sense than --cwd, and is more consistent with
> other commands.
>
> You'll want to also address the patch to Paul Mackerras (I've cc:'d
> him) since he's the gitk maintainer, and Junio pulls gitk from him.
>
>> v2: Adjusted the parameter as per Eric's suggestion. I think
>>      it now work in similar manner as in many GNU tools as well
>>      as git itself.
>
> This sort of explanation of of changes between versions is definitely
> welcome, but should be placed below the "---" line just under your
> sign-off so that it does not become part of the permanent commit
> message.

Ok, I'll make bit later another version. I didn't realize to check where 
to put this comment as some projects want these in the commit message.

>
>> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>> ---
>
> You'd place your commentary about changes between patch versions here.
> More below...
>
>>   Documentation/gitk.txt |  7 +++++++
>>   gitk-git/gitk          | 26 +++++++++++++++++---------
>>   2 files changed, 24 insertions(+), 9 deletions(-)
>>
>> diff --git a/gitk-git/gitk b/gitk-git/gitk
>> @@ -12279,20 +12279,14 @@ 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 {}
>>
>>   set revtreeargs {}
>>   set cmdline_files {}
>> -set i 0
>>   set revtreeargscmd {}
>> -foreach arg $argv {
>> +for {set i 0} {$i < [llength $argv]} {incr i} {
>> +       set arg [lindex $argv [expr {$i}]]
>>       switch -glob -- $arg {
>>          "" { }
>>          "--" {
>> @@ -12305,11 +12299,25 @@ foreach arg $argv {
>>          "--argscmd=*" {
>>              set revtreeargscmd [string range $arg 10 end]
>>          }
>> +       "-C*" {
>> +               if {[string length $arg] < 3} {
>> +                       incr i
>> +                       cd [lindex $argv [expr {$i}]]
>
> What happens if no arguments follow -C (that is, the entire
> command-line is "gitk -C")? Will this simply run "cd" with no argument
> or with an empty argument or error out or what? Should there be a
> check for this condition?
>
>> +                       continue
>
> Why does this 'continue' need to be here? Am I missing something obvious?
>

I'll add the missing try/catch for these cd commands, I slowly start to 
understand how tcl work. Earlier catch was not for some reason needed 
here when the loop was ran with 'foreach', error was reported once 
reached UI but now it seem to advertise "error in startup script.." 
'continue' was part of this skipping but doesn't do its trick anymore.

Anyway, I'll make v3 and resend. :)

>> +               } else {
>> +                       cd [string range $arg 2 end]
>> +               }
>> +       }
>>          default {
>>              lappend revtreeargs $arg
>>          }
>>       }
>> -    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"} {
>> --
>> 1.9.1

  reply	other threads:[~2015-11-06 10:49 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
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 [this message]
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=563C85C5.80703@gmail.com \
    --to=juhapekka.heikkila@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=sunshine@sunshineco.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).