Don't show context menu for paths

Daniel Sahlberg via TortoiseSVN-dev <[email protected]> Sun, 15 Sep 2024 07:13:52 -0700 (PDT)
Newsgroups gmane.comp.version-control.subversion.tortoisesvn.devel
Message-ID <[email protected]>
------=_Part_34446_1827874012.1726409632057
Content-Type: multipart/alternative; 
	boundary="----=_Part_34447_995677910.1726409632057"

------=_Part_34447_995677910.1726409632057
Content-Type: text/plain; charset="UTF-8"

Hi,

Is there any documentation how the setting "Don't show context menu for 
paths" should work?

I realised that to ignore my working copy c:\temp\wc\ completely, I had to 
set either

   - "c:\temp\wc*"
   - Both "c:\temp\wc" and "c:\temp\wc\*"

The first one also ignored c:\temp\wc2\.
The second being quite clumsy.

This is handled in ShellCache::IsContextPathAllowed(LPCWSTR path). If 
right-clicking the folder itself, path will be c:\temp\wc

I'm considering to check the list of ignored paths for a trailing \* as 
follows (adding the ternary operator to check for \\).

        if (!I->empty() && I->at(I->size() - 1) == '*')
        {
            std::wstring str = I->substr(0, I->size() - *(I->at(I->size() - 
2) == '\\' ? 2 : *1*)*);

Then c:\temp\wc\* would work, but it might crash on a single * (didn't 
check yet).

Or to check separately for trailing \:

        else if (!I->empty() && I->at(I->size() - 1) == '\')
        {
            std::wstring str = I->substr(0, I->size() - 1);
            if (_wcsnicmp(str.c_str(), path, str.size()) == 0)
                return FALSE;
        }

Basically treating \ as a wildcard character - then you could add 
c:\temp\wc\ as "ignore the wc folder and everything below".

What do you think? Any risk of regressions?

While I was at it, I'd suggest to remove the check for !I->empty() in the 
if statement. There is already a separate statement:

        if (I->empty())
            continue;

just above. So we KNOW that I->empty() is false. Do I miss something here? 
(For comparison, TortoiseGit don't have that !I->empty() check).

Kind regards,
Daniel

-- 
You received this message because you are subscribed to the Google Groups "TortoiseSVN-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/tortoisesvn-dev/e8bd566a-576d-4717-9029-d7a94ea310c1n%40googlegroups.com.

------=_Part_34447_995677910.1726409632057
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,<div><br /></div><div>Is there any documentation how the setting "Don't =
show context menu for paths" should work?</div><div><br /></div><div>I real=
ised that to ignore my working copy c:\temp\wc\ completely, I had to set ei=
ther</div><div><ul><li>"c:\temp\wc*"</li><li>Both "c:\temp\wc" and "c:\temp=
\wc\*"</li></ul></div><div>The first one also ignored c:\temp\wc2\.<br /></=
div><div>The second being quite clumsy.</div><div><br /></div><div>This is =
handled in ShellCache::IsContextPathAllowed(LPCWSTR path). If right-clickin=
g the folder itself, path will be c:\temp\wc</div><div><br /></div><div>I'm=
 considering to check the list of ignored paths for a trailing \* as follow=
s (adding the ternary operator to check for \\).</div><div><br /></div>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 if (!I-&gt;empty() &amp;&amp; I-&gt;at(I-&gt;size(=
) - 1) =3D=3D '*')<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br /><div>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::wstring str =3D I-&gt;substr(0, I-&gt;=
size() - <b>(I-&gt;at(I-&gt;size() - 2) =3D=3D '\\' ? 2 : </b>1<b>)</b>);<b=
r /></div><div><br /></div><div>Then c:\temp\wc\* would work, but it might =
crash on a single * (didn't check yet).</div><div><br /></div><div>Or to ch=
eck separately for trailing \:</div><div><br /></div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 else if (!I-&gt;empty() &amp;&amp; I-&gt;at(I-&gt;size() - 1) =
=3D=3D '\')<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br />=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 std::wstring str =3D I-&gt;substr(0, I-&gt;size() - 1)=
;<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (_wcsnicmp(str.c_str(),=
 path, str.size()) =3D=3D 0)<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 return FALSE;<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br /></div>=
<div><br /></div><div>Basically treating \ as a wildcard character - then y=
ou could add c:\temp\wc\ as "ignore the wc folder and everything below".</d=
iv><div><br /></div><div>What do you think? Any risk of regressions?</div><=
div><br /></div><div>While I was at it, I'd suggest to remove the check for=
 !I-&gt;empty() in the if statement. There is already a separate statement:=
</div><div><br /></div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (I-&gt;empty())<=
br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 continue;<br /></div><div><b=
r /></div><div>just above. So we KNOW that I-&gt;empty() is false. Do I mis=
s something here? (For comparison, TortoiseGit don't have that !I-&gt;empty=
() check).</div><div><br /></div><div>Kind regards,</div><div>Daniel</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;TortoiseSVN-dev&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">tor=
[email protected]</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/tortoisesvn-dev/e8bd566a-576d-4717-9029-d7a94ea310c1n%40googlegr=
oups.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/=
d/msgid/tortoisesvn-dev/e8bd566a-576d-4717-9029-d7a94ea310c1n%40googlegroup=
s.com</a>.<br />

------=_Part_34447_995677910.1726409632057--

------=_Part_34446_1827874012.1726409632057--