public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Zoli Szabó" <zoli.szabo@gmail•com>
To: Pratyush Yadav <me@yadavpratyush•com>
Cc: git@vger•kernel.org
Subject: Re: Re: [PATCH 1/1] git-gui: add possibility to open currently selected file
Date: Sun, 29 Dec 2019 15:23:37 +0200	[thread overview]
Message-ID: <c681ca1b-cdcb-d021-95a9-ca3ad944cfa3@gmail.com> (raw)
In-Reply-To: <20191227193418.36uzeizs37nv7ywb@yadavpratyush.com>

Hi Pratyush,

Thanks for your thorough review.

On 2019.12.27 21:34, Pratyush Yadav wrote:
>> ...This change enables just that by:
>>   - Diff header path context menu -> Open;
> 
> Would it be a better idea to have this option in the diff body context
> menu (.vpane.lower.diff.body.ctxm) instead? The problem I see with the
> way its currently done is visibility/discovery. It is not very likely
> for a user to try and click the file name which doesn't give any
> indication that it is clickable. So how will someone who hasn't read
> this commit message know that they can use this neat feature. The diff
> body context menu is much more "visible" IMO.
> 
>>   - or double-clicking the diff header path.
> 
> An alternative to the above suggestion would be to make this path
> underlined and blue in color (like a hyperlink in a web browser). This
> will give the indication that this is not just plain text.
> 
> I like the latter idea more, but I don't mind either.

For me, the body context menu holds the diff-related options, I am not 
sure the "Open" fits in there. But I do like your suggestion of making 
the filename web browser-link-like. I'll try to implement that.


>> One "downside" of the approach is that executable files will be run
>> and not opened for editing.
> 
> FWIW, I do not see it as a downside at all. The menu option is called
> "open" not "edit". So if you click it, you should expect the file to
> open. In case its a binary file, executing it is the correct outcome. In
> case its a text file, opening it in the editor is the correct outcome.

Alright then.

>> +proc do_file_open {file} {
>> +	global _gitworktree
>> +	set explorer [get_explorer]
>> +	set full_file_path [file join $_gitworktree $file]
>> +	eval exec $explorer [list [file nativename $full_file_path]] &
> 
> This executes $explorer, which is 'explorer.exe' on Windows. I'm not a
> heavy Windows user but AFAIK it is a file manager. This makes it quite
> different from 'xdg-open' which is used to open _any_ file/URL in the
> user's default application. So it also happens to open _directories_ in
> the default file explorer which was the original intention of this
> procedure.
> 
> Have you tested it on Windows? Does 'explorer.exe' do the correct thing?
> 
> Looking at MacOS's 'open' man page, I think it should also work like
> xdg-open and shouldn't be a problem.

I am in fact working on this patch on Windows. explorer.exe works also 
for files and even brings up the "Open with..." dialog for 
not-recognized file types.

> Tested on Linux. Works fine. Looking forward to the re-roll.

Thanks for testing it on Linux. Since I am working on Windows, I just 
read about `xdg-open` and `open` and assumed everything should work OK.

All other points I agree with you and will push a new version of the patch.

Thanks,
Zoli

  parent reply	other threads:[~2019-12-29 13:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-26 19:01 [PATCH 0/1] git-gui: add possibility to open currently selected file Zoli Szabó via GitGitGadget
2019-12-26 19:01 ` [PATCH 1/1] " Zoli Szabó via GitGitGadget
2019-12-27 19:34   ` Pratyush Yadav
2019-12-27 22:32     ` Junio C Hamano
2019-12-29 20:15       ` Zoli Szabó
2019-12-29 23:14         ` Junio C Hamano
2019-12-30 16:13           ` Zoli Szabó
2019-12-29 13:23     ` Zoli Szabó [this message]
2019-12-29 19:32 ` [PATCH v2 0/1] git-gui: allow opening " Zoli Szabó via GitGitGadget
2019-12-29 19:32   ` [PATCH v2 1/1] " Zoli Szabó via GitGitGadget
2019-12-30 15:56   ` [PATCH v3 0/1] " Zoli Szabó via GitGitGadget
2019-12-30 15:56     ` [PATCH v3 1/1] git-gui: allow opening currently selected file in default app Zoli Szabó via GitGitGadget
2019-12-30 19:41       ` Pratyush Yadav
2019-12-30 20:31         ` Zoli Szabó

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

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

  git send-email \
    --in-reply-to=c681ca1b-cdcb-d021-95a9-ca3ad944cfa3@gmail.com \
    --to=zoli.szabo@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=me@yadavpratyush$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox