diff --git a/t/t9391-filter-repo-lib-usage.sh b/t/t9391-filter-repo-lib-usage.sh index 1224773..6d670e9 100755 --- a/t/t9391-filter-repo-lib-usage.sh +++ b/t/t9391-filter-repo-lib-usage.sh @@ -141,4 +141,14 @@ test_expect_success 'unusual.py' ' ) ' +test_expect_success 'erroneous.py' ' + setup erroneous && + ( + cd erroneous && + test_must_fail $TEST_DIRECTORY/t9391/erroneous.py 2>../err && + + test_i18ngrep "Error: Cannot pass a tag_callback to RepoFilter AND pass --tag-callback" ../err + ) +' + test_done diff --git a/t/t9391/erroneous.py b/t/t9391/erroneous.py new file mode 100755 index 0000000..a5c05d2 --- /dev/null +++ b/t/t9391/erroneous.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +""" +Please see the + ***** API BACKWARD COMPATIBILITY CAVEAT ***** +near the top of git-filter-repo +""" + +import git_filter_repo as fr + +def handle_tag(tag): + print("Decipher this: "+''.join(reversed(progress.message))) + +args = fr.FilteringOptions.parse_args(['--force', '--tag-callback', 'pass']) +filter = fr.RepoFilter(args, tag_callback = handle_tag) +filter.run() diff --git a/t/t9392-python-callback.sh b/t/t9392-python-callback.sh index 243228f..983879e 100755 --- a/t/t9392-python-callback.sh +++ b/t/t9392-python-callback.sh @@ -170,4 +170,15 @@ test_expect_success '--reset-callback' ' ) ' +test_expect_success 'callback has return statement sanity check' ' + setup callback_return_sanity && + ( + cd callback_return_sanity && + + test_must_fail git filter-repo --filename-callback "filename + \".txt\"" 2>../err&& + test_i18ngrep "Error: --filename-callback should have a return statement" ../err && + rm ../err + ) +' + test_done