From: Ben Peart <peartben@gmail.com>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: git@vger.kernel.org, benpeart@microsoft.com, pclouds@gmail.com,
sandals@crustytoothpaste.net, avarab@gmail.com,
Johannes.Schindelin@gmx.de
Subject: Re: [PATCH v1] teach git to support a virtual (partially populated) work directory
Date: Thu, 29 Nov 2018 09:09:46 -0500 [thread overview]
Message-ID: <26e0b60c-c343-6ade-1e96-228c7d1b9418@gmail.com> (raw)
In-Reply-To: <20181128133114.GF30222@szeder.dev>
On 11/28/2018 8:31 AM, SZEDER Gábor wrote:
> On Tue, Nov 27, 2018 at 02:50:57PM -0500, Ben Peart wrote:
>
>> diff --git a/t/t1092-virtualworkdir.sh b/t/t1092-virtualworkdir.sh
>> new file mode 100755
>> index 0000000000..0cdfe9b362
>> --- /dev/null
>> +++ b/t/t1092-virtualworkdir.sh
>> @@ -0,0 +1,393 @@
>> +#!/bin/sh
>> +
>> +test_description='virtual work directory tests'
>> +
>> +. ./test-lib.sh
>> +
>> +# We need total control of the virtual work directory hook
>> +sane_unset GIT_TEST_VIRTUALWORKDIR
>> +
>> +clean_repo () {
>> + rm .git/index &&
>> + git -c core.virtualworkdir=false reset --hard HEAD &&
>> + git -c core.virtualworkdir=false clean -fd &&
>> + touch untracked.txt &&
> We would usually run '>untracked.txt' instead, sparing the external
> process.
>
> A further nit is that a function called 'clean_repo' creates new
> untracked files...
Thanks, all good suggestions I've incorporated for the next iteration.
>
>> + touch dir1/untracked.txt &&
>> + touch dir2/untracked.txt
>> +}
>> +
>> +test_expect_success 'setup' '
>> + mkdir -p .git/hooks/ &&
>> + cat > .gitignore <<-\EOF &&
> CodingGuidelines suggest no space between redirection operator and
> filename.
>
>> + .gitignore
>> + expect*
>> + actual*
>> + EOF
>> + touch file1.txt &&
>> + touch file2.txt &&
>> + mkdir -p dir1 &&
>> + touch dir1/file1.txt &&
>> + touch dir1/file2.txt &&
>> + mkdir -p dir2 &&
>> + touch dir2/file1.txt &&
>> + touch dir2/file2.txt &&
>> + git add . &&
>> + git commit -m "initial" &&
>> + git config --local core.virtualworkdir true
>> +'
>
>> +test_expect_success 'verify files not listed are ignored by git clean -f -x' '
>> + clean_repo &&
> I find it odd to clean the repo right after setting it up; but then
> again, 'clean_repo' not only cleans, but also creates new files.
> Perhaps rename it to 'reset_repo'? Dunno.
>
>> + write_script .git/hooks/virtual-work-dir <<-\EOF &&
>> + printf "untracked.txt\0"
>> + printf "dir1/\0"
>> + EOF
>> + mkdir -p dir3 &&
>> + touch dir3/untracked.txt &&
>> + git clean -f -x &&
>> + test -f file1.txt &&
> Please use the 'test_path_is_file', ...
>
>> + test -f file2.txt &&
>> + test ! -f untracked.txt &&
> ... 'test_path_is_missing', and ...
>
>> + test -d dir1 &&
> ... 'test_path_is_dir' helpers, respectively, because they print
> informative error messages on failure.
>
>> + test -f dir1/file1.txt &&
>> + test -f dir1/file2.txt &&
>> + test ! -f dir1/untracked.txt &&
>> + test -f dir2/file1.txt &&
>> + test -f dir2/file2.txt &&
>> + test -f dir2/untracked.txt &&
>> + test -d dir3 &&
>> + test -f dir3/untracked.txt
>> +'
next prev parent reply other threads:[~2018-11-29 14:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-30 19:16 [RFC v1] Add virtual file system settings and hook proc Ben Peart
2018-10-30 23:07 ` Junio C Hamano
2018-10-31 20:12 ` Ben Peart
2018-11-05 0:02 ` Junio C Hamano
2018-11-05 20:00 ` Ben Peart
2018-10-31 19:11 ` Duy Nguyen
2018-10-31 20:53 ` Ben Peart
2018-11-04 6:34 ` Duy Nguyen
2018-11-04 21:01 ` brian m. carlson
2018-11-05 15:22 ` Duy Nguyen
2018-11-05 20:18 ` Ben Peart
2018-11-05 20:27 ` Ben Peart
2018-11-05 11:40 ` Ævar Arnfjörð Bjarmason
2018-11-05 15:26 ` Duy Nguyen
2018-11-05 20:07 ` Ben Peart
2018-11-05 21:53 ` Johannes Schindelin
2018-11-27 19:50 ` [PATCH v1] teach git to support a virtual (partially populated) work directory Ben Peart
2018-11-28 13:31 ` SZEDER Gábor
2018-11-29 14:09 ` Ben Peart [this message]
2018-12-13 19:41 ` [PATCH v2] " Ben Peart
2019-01-28 19:00 ` Ben Peart
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=26e0b60c-c343-6ade-1e96-228c7d1b9418@gmail.com \
--to=peartben@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=avarab@gmail.com \
--cc=benpeart@microsoft.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
--cc=sandals@crustytoothpaste.net \
--cc=szeder.dev@gmail.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.
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).