aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/url.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-18 21:38:15 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-18 21:38:15 +0000
commit40526fbea56a8006eb7f1758d461a5acbe9a1694 (patch)
tree5d74492a86f28fb7183897dc2a6d7baf2d24f7f1 /src/libutil/url.hh
parent6dd471ebf6b9a4996405398093ccb371b8abdf2f (diff)
parent6c000eed80565d83d596da800ca0db92e248342e (diff)
Merge remote-tracking branch 'upstream/master' into enum-class
Diffstat (limited to 'src/libutil/url.hh')
-rw-r--r--src/libutil/url.hh8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libutil/url.hh b/src/libutil/url.hh
index 1503023a2..2ef88ef2a 100644
--- a/src/libutil/url.hh
+++ b/src/libutil/url.hh
@@ -1,6 +1,6 @@
#pragma once
-#include "types.hh"
+#include "error.hh"
#include <regex>
@@ -49,6 +49,12 @@ const static std::string pathRegex = "(?:" + segmentRegex + "(?:/" + segmentRege
const static std::string refRegexS = "[a-zA-Z0-9][a-zA-Z0-9_.-]*"; // FIXME: check
extern std::regex refRegex;
+// Instead of defining what a good Git Ref is, we define what a bad Git Ref is
+// This is because of the definition of a ref in refs.c in https://github.com/git/git
+// See tests/fetchGitRefs.sh for the full definition
+const static std::string badGitRefRegexS = "//|^[./]|/\\.|\\.\\.|[[:cntrl:][:space:]:?^~\[]|\\\\|\\*|\\.lock$|\\.lock/|@\\{|[/.]$|^@$|^$";
+extern std::regex badGitRefRegex;
+
// A Git revision (a SHA-1 commit hash).
const static std::string revRegexS = "[0-9a-fA-F]{40}";
extern std::regex revRegex;