From: ZheNing Hu <adlternative@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git List <git@vger.kernel.org>, Denton Liu <liu.denton@gmail.com>,
David Aguilar <davvid@gmail.com>,
John Keeping <john@keeping.me.uk>,
Ryan Zoeller <rtzoeller@rtzoeller.com>,
ZheNing Hu via GitGitGadget <gitgitgadget@gmail.com>
Subject: Re: [PATCH v6] difftool.c: learn a new way start at specified file
Date: Mon, 22 Feb 2021 23:11:40 +0800 [thread overview]
Message-ID: <CAOLTT8ST9_eazfsy+=j-t3bHuwhnsBhzXiQ4peC3RbLEK1CTxg@mail.gmail.com> (raw)
In-Reply-To: <pull.870.v6.git.1613739235241.gitgitgadget@gmail.com>
Hi,Junio,
ZheNing Hu via GitGitGadget <gitgitgadget@gmail.com> 于2021年2月19日周五 下午8:53写道:
>
> From: ZheNing Hu <adlternative@gmail.com>
>
> `git difftool` only allow us to select file to view in turn.
> If there is a commit with many files and we exit in the middle,
> we will have to traverse list again to get the file diff which
> we want to see. Therefore,teach the command an option
> `--skip-to=<path>` to allow the user to say that diffs for earlier
> paths are not interesting (because they were already seen in an
> earlier session) and start this session with the named path.
>
> Signed-off-by: ZheNing Hu <adlternative@gmail.com>
> ---
> difftool.c: learn a new way start at specified file
>
> * The patch of the previous version implemented the jump through
> environment variables. The current version is based on the "diff
> --skip-to=" feature implemented by gitster, which implements a
> possible solution for the jump of difftool.
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-870%2Fadlternative%2Fdifftool_save_point-v6
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-870/adlternative/difftool_save_point-v6
> Pull-Request: https://github.com/gitgitgadget/git/pull/870
>
> Range-diff vs v5:
>
> 1: fb4bfd0f8b16 < -: ------------ diff: --{rotate,skip}-to=<path>
> 2: 98e2707ee2fa ! 1: 4377a917ca9e difftool.c: learn a new way start at specified file
> @@ Commit message
> difftool.c: learn a new way start at specified file
>
> `git difftool` only allow us to select file to view in turn.
> - If there is a commit with many files and we exit in the search,
> - We will have to traverse list again to get the file diff which
> - we want to see. Therefore, here is a new method: user can use
> - `git difftool --rotate-to=<filename>` or `git difftool --skip-to=<filename>`
> - to start viewing from the specified file, This will improve the
> - user experience.
> -
> - `git difftool --rotate-to=<file>` or `git difftool --skip-to=<filename>`
> - will pass the path to `diffcore-rotate`, and diff-core will
> - adjust the order of files, make the specified file sorted to
> - the first.`git difftool --rotate-to=<file>` will move files before
> - the specified path to the last output, and
> - `git difftool --skip-to=<filename>` will ignore these files output.
> - It is an error when there is no patch for specified file is shown.
> + If there is a commit with many files and we exit in the middle,
> + we will have to traverse list again to get the file diff which
> + we want to see. Therefore,teach the command an option
> + `--skip-to=<path>` to allow the user to say that diffs for earlier
> + paths are not interesting (because they were already seen in an
> + earlier session) and start this session with the named path.
>
> Signed-off-by: ZheNing Hu <adlternative@gmail.com>
>
> - ## Documentation/diff-options.txt ##
> -@@ Documentation/diff-options.txt: components matches the pattern. For example, the pattern "`foo*bar`"
> - matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`".
> -
> - --skip-to=<file>::
> ----rotate-to=<file::
> -+--rotate-to=<file>::
> - Discard the files before the named <file> from the output
> - (i.e. 'skip to'), or move them to the end of the output
> - (i.e. 'rotate to'). These were invented primarily for use
> -
> ## Documentation/git-difftool.txt ##
> @@ Documentation/git-difftool.txt: OPTIONS
> This is the default behaviour; the option is provided to
> override any configuration settings.
>
> +--rotate-to=<file>::
> -+ Internally call `git diff --rotate-to=<file>`,
> -+ show the change in the specified path first.
> -+ Files before the specified path will be moved to the last output.
> ++ Start showing the diff for the given path,
> ++ the paths before it will move to end and output.
> +
> +--skip-to=<file>::
> -+ Internally call `git diff --skip-to=<file>`,
> -+ skip the output to the specified path.
> -+ Files before the specified path will not output.
> ++ Start showing the diff for the given path, skipping all
> ++ the paths before it.
> +
> -t <tool>::
> --tool=<tool>::
> @@ t/t7800-difftool.sh: test_expect_success 'difftool --gui, --tool and --extcmd ar
> + 4
> + 1
> + EOF
> -+ test_cmp output expect &&
> -+ test_must_fail git difftool --no-prompt --extcmd=cat --rotate-to="3" HEAD^
> ++ test_cmp output expect
> +'
> +
> +test_expect_success 'difftool --skip-to' '
> @@ t/t7800-difftool.sh: test_expect_success 'difftool --gui, --tool and --extcmd ar
> + 2
> + 4
> + EOF
> -+ test_cmp output expect &&
> -+ test_must_fail git difftool --no-prompt --extcmd=cat --skip-to="3" HEAD^
> ++ test_cmp output expect
> +'
> +
> ++test_expect_success 'difftool --rotate/skip-to error condition' '
> ++ test_must_fail git difftool --no-prompt --extcmd=cat --rotate-to="3" HEAD^ &&
> ++ test_must_fail git difftool --no-prompt --extcmd=cat --skip-to="3" HEAD^
> ++'
> test_done
>
>
> Documentation/git-difftool.txt | 8 ++++++++
> t/t7800-difftool.sh | 32 ++++++++++++++++++++++++++++++++
> 2 files changed, 40 insertions(+)
>
> diff --git a/Documentation/git-difftool.txt b/Documentation/git-difftool.txt
> index 484c485fd06c..143b0c49d739 100644
> --- a/Documentation/git-difftool.txt
> +++ b/Documentation/git-difftool.txt
> @@ -34,6 +34,14 @@ OPTIONS
> This is the default behaviour; the option is provided to
> override any configuration settings.
>
> +--rotate-to=<file>::
> + Start showing the diff for the given path,
> + the paths before it will move to end and output.
> +
> +--skip-to=<file>::
> + Start showing the diff for the given path, skipping all
> + the paths before it.
> +
> -t <tool>::
> --tool=<tool>::
> Use the diff tool specified by <tool>. Valid values include
> diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
> index 9192c141ffc6..3e041e83aede 100755
> --- a/t/t7800-difftool.sh
> +++ b/t/t7800-difftool.sh
> @@ -762,4 +762,36 @@ test_expect_success 'difftool --gui, --tool and --extcmd are mutually exclusive'
> test_must_fail git difftool --gui --tool=test-tool --extcmd=cat
> '
>
> +test_expect_success 'difftool --rotate-to' '
> + difftool_test_setup &&
> + test_when_finished git reset --hard &&
> + echo 1 >1 &&
> + echo 2 >2 &&
> + echo 4 >4 &&
> + git add 1 2 4 &&
> + git commit -a -m "124" &&
> + git difftool --no-prompt --extcmd=cat --rotate-to="2" HEAD^ >output&&
> + cat >expect <<-\EOF &&
> + 2
> + 4
> + 1
> + EOF
> + test_cmp output expect
> +'
> +
> +test_expect_success 'difftool --skip-to' '
> + difftool_test_setup &&
> + test_when_finished git reset --hard &&
> + git difftool --no-prompt --extcmd=cat --skip-to="2" HEAD^ >output &&
> + cat >expect <<-\EOF &&
> + 2
> + 4
> + EOF
> + test_cmp output expect
> +'
> +
> +test_expect_success 'difftool --rotate/skip-to error condition' '
> + test_must_fail git difftool --no-prompt --extcmd=cat --rotate-to="3" HEAD^ &&
> + test_must_fail git difftool --no-prompt --extcmd=cat --skip-to="3" HEAD^
> +'
> test_done
>
> base-commit: 1eb4136ac2a24764257567b930535fcece01719f
> --
> gitgitgadget
A few days ago I successfully sent this patch with the help
of Denton Liu, I don't know if you see it?
Any reply is appreciated.
--
ZheNing Hu
next prev parent reply other threads:[~2021-02-22 15:14 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-07 15:19 [PATCH] git-difftool-helper.sh: learn a new way skip to save point 阿德烈 via GitGitGadget
2021-02-07 18:29 ` Junio C Hamano
2021-02-07 19:04 ` Junio C Hamano
2021-02-08 8:06 ` 胡哲宁
2021-02-08 17:02 ` [PATCH v2] git-difftool-helper.sh: learn a new way go back to last " ZheNing Hu via GitGitGadget
2021-02-08 20:13 ` Junio C Hamano
2021-02-08 22:15 ` David Aguilar
2021-02-08 23:34 ` Junio C Hamano
2021-02-09 6:19 ` 胡哲宁
2021-02-09 6:04 ` 胡哲宁
2021-02-09 15:30 ` [PATCH v3] difftool.c: learn a new way start from specified file ZheNing Hu via GitGitGadget
2021-02-09 18:17 ` Junio C Hamano
2021-02-10 17:00 ` 胡哲宁
2021-02-10 18:16 ` Junio C Hamano
2021-02-10 20:05 ` Junio C Hamano
2021-02-14 7:53 ` ZheNing Hu
2021-02-14 13:09 ` [PATCH v4] difftool.c: learn a new way start at " ZheNing Hu via GitGitGadget
2021-02-16 1:46 ` Junio C Hamano
2021-02-16 12:56 ` [PATCH v5 0/2] " ZheNing Hu via GitGitGadget
2021-02-16 12:56 ` [PATCH v5 1/2] diff: --{rotate,skip}-to=<path> Junio C Hamano via GitGitGadget
2021-02-16 12:56 ` [PATCH v5 2/2] difftool.c: learn a new way start at specified file ZheNing Hu via GitGitGadget
2021-02-17 10:31 ` Junio C Hamano
2021-02-17 16:18 ` ZheNing Hu
2021-02-16 18:45 ` [PATCH v5 0/2] " Junio C Hamano
2021-02-17 4:12 ` ZheNing Hu
2021-02-17 11:14 ` Denton Liu
2021-02-17 11:40 ` ZheNing Hu
2021-02-17 18:56 ` Junio C Hamano
2021-02-18 5:20 ` ZheNing Hu
2021-02-18 15:04 ` ZheNing Hu
2021-02-18 19:11 ` Junio C Hamano
2021-02-19 10:59 ` ZheNing Hu
2021-02-25 11:08 ` Johannes Schindelin
2021-02-25 19:01 ` Junio C Hamano
2021-02-19 12:53 ` [PATCH v6] " ZheNing Hu via GitGitGadget
2021-02-22 15:11 ` ZheNing Hu [this message]
2021-02-22 21:40 ` Junio C Hamano
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='CAOLTT8ST9_eazfsy+=j-t3bHuwhnsBhzXiQ4peC3RbLEK1CTxg@mail.gmail.com' \
--to=adlternative@gmail.com \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=john@keeping.me.uk \
--cc=liu.denton@gmail.com \
--cc=rtzoeller@rtzoeller.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).