From: "Jakub Narębski" <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git-testadd: Execute a command with only the staged changes in Git applied
Date: Thu, 28 Jul 2016 21:31:35 +0200 [thread overview]
Message-ID: <579A5D97.7080708@gmail.com> (raw)
In-Reply-To: <CAA787rmDb+1=4RCscvo1rZWSt=tUQSm5wrFet-=PhRKZcf9x5A@mail.gmail.com>
W dniu 2016-07-28 o 18:56, Øyvind A. Holm pisze:
> On 28 July 2016 at 18:37, Junio C Hamano <gitster@pobox.com> wrote:
>> Øyvind A. Holm <sunny@sunbase.org> writes:
>>> This is a script I created some weeks ago, and I've found it to be
>>> immensely useful. Here is a snippet from git-testadd --help:
>>>
>>> If you have lots of unrelated uncommitted changes in the current
>>> repository and want to split up the commit, how can you easily
>>> check if the changes passes the test suite? With all the other
>>> unrelated changes it can be hard to make sure that only relevant
>>> changes becomes part of the commit, and that they don't result in
>>> regressions. This script clones the repository to the directory
>>> ".testadd.tmp" in the current directory and applies the staged
>>> chenges there (unless -u/--unmodified or -p/--pristine is
>>> specified), chdirs to the same relative directory in the clone and
>>> executes the command specified on the command line there.
>>
>> So in short, this solves the same problem as "git stash --keep" but in
>> a more scalable way, in the sense that "git stash --keep" allows you
>> to instantiate what you have in the index so that your working tree
>> can be used for such a test, but you cannot do anything else while you
>> are waiting for the test to finish, and "testadd" allows you to keep
>> hacking in the working tree while a test runs in its own temporary
>> checkout (and presumably you can have more than one running, which
>> would allow you to scale more)?
>
> That's correct, the test clone is entirely separated from the working
> copy, and you can keep working while the tests are running in the clone.
> Combined with git-gui and/or "git add -p/git reset -p", it's easy to
> tweak the staged changes until things are ok.
I wonder if using `git worktree` instead of `git clone` (well, local
clone uses hardlinks, so it is not that costly as it looks like) would
be a better solution.
> Also, there is a -l/--label option that creates a clone directory with
> the name ".testadd-[LABEL].tmp", so you can have several test clones at
> the same time, all with different staged changes. There is also a
> -r/--ref option that tries to apply the staged changes onto another
> commit, and the command will only run if the apply succeeds. Also, this
> won't create dangling heads like "git stash --keep" does.
Nice.
next prev parent reply other threads:[~2016-07-28 19:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-28 16:20 git-testadd: Execute a command with only the staged changes in Git applied Øyvind A. Holm
[not found] ` <xmqqlh0lsoq6.fsf@gitster.mtv.corp.google.com>
2016-07-28 16:56 ` Øyvind A. Holm
2016-07-28 19:31 ` Jakub Narębski [this message]
2016-07-28 22:31 ` Øyvind A. Holm
[not found] ` <xmqqzip1pew5.fsf@gitster.mtv.corp.google.com>
2016-07-28 23:17 ` Øyvind A. Holm
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=579A5D97.7080708@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).