GetHEADRevision with illegal URL
Daniel Sahlberg via TortoiseSVN-dev <[email protected]> Sun, 11 Dec 2022 09:26:29 -0800 (PST)
| Newsgroups | gmane.comp.version-control.subversion.tortoisesvn.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Once again double checking my assumptions regarding the code. In the user
group there [1] is a discussion where I believe the error is caused by
GetHEADRevision returning a revision even when the URL is invalid.
The following patch is using svn_ra_stat to check if the path exists and it
seems to do what it is supposed to do.
[[[
--- C:/Users/danie/AppData/Local/Temp/SVN.cpp-revBASE.svn005.tmp.cpp tis
jun 7 17:38:11 2022
+++ C:/Devel/tortoisesvn_trunk/src/SVN/SVN.cpp sön dec 11 17:34:23 2022
@@ -2733,0 +2734,13 @@ svn_revnum_t SVN::GetHEADRevision(const CTSVNPath&
+
+ /* Check if path actually exist */
+ svn_dirent_t *dirent;
+ SVNTRACE(
+ svn_ra_stat(raSession, "", rev, &dirent, localPool),
+ urla);
+ if (dirent == nullptr)
+ {
+ CString
message(MAKEINTRESOURCE(IDS_SVN_URL_NONEXISTENT_IN_REV));
+ m_err = svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
CUnicodeUtils::GetUTF8(message).GetString(), urla, rev);
+ return -1;
+ }
+
]]]
Will this break any other assumptions, where GetHEADRevision is assumed to
return HEAD for an arbitrary path within the repository? I checked quickly
in RepoBrowser but that seemed to work fine.
Kind regards,
Daniel
[1] https://groups.google.com/g/tortoisesvn/c/5juHVu4tioQ
--
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/e907d55a-3521-41d2-b996-30cbbbdf2995n%40googlegroups.com.