From: Junio C Hamano <gitster@pobox.com>
To: "Nika Layzell via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Nika Layzell <nika@thelayzells.com>
Subject: Re: [PATCH v2 1/1] reset: parse rev as tree-ish in patch mode
Date: Mon, 25 Nov 2019 11:03:16 +0900 [thread overview]
Message-ID: <xmqq7e3ozp97.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <a608dc8368c6fc738393dac46618f12e25d40eaf.1574627149.git.gitgitgadget@gmail.com> (Nika Layzell via GitGitGadget's message of "Sun, 24 Nov 2019 20:25:49 +0000")
"Nika Layzell via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Nika Layzell <nika@thelayzells.com>
>
> Since 2f328c3d ("reset $sha1 $pathspec: require $sha1 only to be
> treeish", 2013-01-14), we allowed "git reset $object -- $path" to reset
> individual paths that match the pathspec to take the blob from a tree
> object, not necessarily a commit, while the form to reset the tip of the
> current branch to some other commit still must be given a commit.
>
> Like resetting with paths, "git reset --patch" does not update HEAD, and
> need not require a commit. The path-filtered form, "git reset --patch
> $object -- $pathspec", has accepted a tree-ish since 2f328c3d.
>
> "git reset --patch" is documented as accepting a <tree-ish> since
> bf44142f ("reset: update documentation to require only tree-ish with
> paths", 2013-01-16). Documentation changes are not required.
>
> Loosen the restriction that requires a commit for the unfiltered "git
> reset --patch $object".
>
> Signed-off-by: Nika Layzell <nika@thelayzells.com>
> ---
Nicely explained.
> diff --git a/t/t7105-reset-patch.sh b/t/t7105-reset-patch.sh
> index bd10a96727..fc2a6cf5c7 100755
> --- a/t/t7105-reset-patch.sh
> +++ b/t/t7105-reset-patch.sh
> @@ -38,6 +38,27 @@ test_expect_success PERL 'git reset -p HEAD^' '
> test_i18ngrep "Apply" output
> '
>
> +test_expect_success PERL 'git reset -p HEAD^^{tree}' '
> + test_write_lines n y | git reset -p HEAD^^{tree} >output &&
> + verify_state dir/foo work parent &&
> + verify_saved_state bar &&
> + test_i18ngrep "Apply" output
> +'
> +
> +test_expect_success PERL 'git reset -p HEAD^:dir/foo (blob fails)' '
> + set_and_save_state dir/foo work work &&
> + test_must_fail git reset -p HEAD^:dir/foo &&
> + verify_saved_state dir/foo &&
> + verify_saved_state bar
> +'
> +
> +test_expect_success PERL 'git reset -p aaaaaaaa (unknown fails)' '
> + set_and_save_state dir/foo work work &&
> + test_must_fail git reset -p aaaaaaaa &&
> + verify_saved_state dir/foo &&
> + verify_saved_state bar
> +'
Thanks, will queue.
prev parent reply other threads:[~2019-11-25 2:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-23 19:55 [PATCH 0/1] reset: parse rev as tree-ish in patch mode Nika Layzell via GitGitGadget
2019-11-23 19:55 ` [PATCH 1/1] " Nika Layzell via GitGitGadget
2019-11-24 5:54 ` Junio C Hamano
2019-11-24 18:31 ` Nika Layzell
2019-11-25 1:58 ` Junio C Hamano
2019-11-24 20:25 ` [PATCH v2 0/1] " Nika Layzell via GitGitGadget
2019-11-24 20:25 ` [PATCH v2 1/1] " Nika Layzell via GitGitGadget
2019-11-25 2:03 ` Junio C Hamano [this message]
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=xmqq7e3ozp97.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=nika@thelayzells.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).