From: john smith <wempwer@gmail.com>
To: "Jakub Narębski" <jnareb@gmail.com>
Cc: "Torsten Bögershausen" <tboegi@web.de>, git@vger.kernel.org
Subject: Re: How to simulate a real checkout to test a new smudge filter?
Date: Sat, 10 Sep 2016 00:03:26 +0200 [thread overview]
Message-ID: <CAKmQUfafCP6ZwUm7Ec5n2PzvNzBHnFWEJL1usMTFB6Ef0m=8pw@mail.gmail.com> (raw)
In-Reply-To: <e17a88cd-2de7-dc84-2262-743e82d8b047@gmail.com>
On 9/8/16, Jakub Narębski <jnareb@gmail.com> wrote:
> W dniu 06.09.2016 o 23:01, john smith pisze:
>
>> I'd prefer smudge/clean filters instead of `make' scripts etc. to
>> convert template dotfiles into something usable and back because
>> filters:
>>
>> 1. could be run automatically
>>
>> 2. do not modify files as shown by `git show HEAD:<file>' and
>> therefore no files are reported as modified by git status and also
>> there are not conflicts when merging master into work/home branch.
>>
>> I have problems because with point 1 because apparently smudge filter
>> is not run automatically every time when branch is changed if files
>> listed in .gitattributes do not change. As the last resort I could
>> force smudge/clean filter to run just to keep advantage specified in
>> point 2.
>
> Couldn't you use post-checkout hook plus clean filter instead of
> clean/smudge filter pair, if the smudge part depends on the branch?
>
> Or make post-checkout hook invoke smudge filter... though
> `git cat-file --filters` is not in any released version, I think...
I moved smudge-filter functionality to post-checkout hook and only
left clean filter. Now post-checkout hooks is called every time when
changing branches but it's not working together with clean filter when
changing branches. For example, when I have this on master in
bash/.bashrc:
export EMAIL="@EMAIL@"
After moving to `work' it becomes this thanks to post-checkout hook
which replaces @EMAIL@ with correct definition:
export EMAIL="work@address.com"
But when I move to `home' branch from `work' I still get this:
export EMAIL="work@address.com"
post-checkout didn't work here because it can't see @EMAIL@ part in
bash/.bashrc because clean filter has not been run. I need to run this
single command to force `clean' filter to run to replace
work@address.com with @EMAIL@ and let post-checkout replace it with
correct value:
git checkout .
And now I get the correct definition:
export EMAIL="home@address.com"
So it seems that clean filter is only run when checking out paths but
not when checking out branches. Is my thinking correct?
--
<wempwer@gmail.com>
next prev parent reply other threads:[~2016-09-09 22:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-06 17:47 How to simulate a real checkout to test a new smudge filter? john smith
2016-09-06 19:48 ` Torsten Bögershausen
2016-09-06 21:01 ` john smith
2016-09-07 8:52 ` Michael J Gruber
2016-09-08 13:12 ` Jakub Narębski
2016-09-09 22:03 ` john smith [this message]
2016-09-09 22:34 ` Junio C Hamano
2016-09-09 23:07 ` john smith
2016-09-09 23:12 ` Junio C Hamano
2016-09-10 10:32 ` Jakub Narębski
2016-09-10 16:31 ` john smith
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='CAKmQUfafCP6ZwUm7Ec5n2PzvNzBHnFWEJL1usMTFB6Ef0m=8pw@mail.gmail.com' \
--to=wempwer@gmail.com \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=tboegi@web.de \
/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).