Client-side commit-hook script incorrectly expands REPOROOT for deeply-nested folders

52 views
Skip to first unread message

Arnoud Berendsen

unread,
Jul 18, 2022, 12:15:27 PM7/18/22
to TortoiseSVN
Hi,

It seems the expansion of the %REPOROOT% variable does not work correctly for folders that are nested more than 2 levels deep.


Environment

I am using TSvn 1.14.3 x64 on Win 11.

Steps to reproduce:

I have a client-side start-commit-hook defined on /trunk.

My WC is a full checkout of /trunk.
I don't have any branches or externals.

The hook is set up to execute "%REPOROOT%/trunk/hooks/cleanup.exe"

"Wait for the script to finish" and "Hide the script while running" are checked, the other options are not.

In the repository I have the following files:
trunk\hooks\cleanup.exe
trunk\src\queries\schemas\myquery.sql

Actual results
  • When committing changes to the .sql file from /trunk, the location of the hook script is correctly identified (as expected).
  • When committing changes to the .sql file from /trunk/src , the location of the hook script is correctly identified (as expected)
  • When committing changes to the .sql file from /trunk/src/queries , the location of the hook script is INCORRECTLY identified as "trunk\src\hooks\cleanup.exe" in the Approve/Reject dialog.
  • When committing changes to the .sql file from /trunk/src/queries/schemas , the location of the hook script is INCORRECTLY identified as "trunk\src\schemas\hooks\cleanup.exe" in the Approve/Reject dialog.
  • When committing changes to the .sql file directly on the file , the location of the hook script is INCORRECTLY identified as "trunk\src\schemas\hooks\cleanup.exe" in the Approve/Reject dialog.

Changing %REPOROOT% to %REPOROOT+% does not fix the problem. In fact, doing so seems to completely break/disable the hook. The Approve/Reject dialog is no longer displayed regardless of where the commit is initiated from. No other errors are displayed, but the commit hook is not executed either. Changing it back to %REPOROOT% immediately reverts it back to the original behavior.


Expected results
  • Because an absolute path rooted in %REPOROOT% has been specified for the hook script, TortoiseSVN should correctly find the hook script, regardless of the nesting level that the commit dialog is initiated from.

Workaround
  • Always committing from the root level guarantees correct expansion of %REPOROOT%.



Stefan

unread,
Jul 18, 2022, 2:35:33 PM7/18/22
to TortoiseSVN
any chance that the hook files are tied in the working copy via svn:externals? Because then the repo root is a different one.

Stefan

unread,
Jul 18, 2022, 3:23:55 PM7/18/22
to TortoiseSVN
found a way to reproduce the problem.
Fixed in r29432

Arnoud Berendsen

unread,
Jul 18, 2022, 6:03:53 PM7/18/22
to TortoiseSVN

Thank you! This seems to have been broken for a long time (years)...
Op maandag 18 juli 2022 om 21:23:55 UTC+2 schreef Stefan:
Reply all
Reply to author
Forward
0 new messages