mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Made the version generator code work right when we are on a tag because git describe just gives the tag name and nothing else.
This commit is contained in:
+8
-1
@@ -54,12 +54,19 @@ int main(int argc, char *argv[])
|
||||
|
||||
std::string version_build = "#define VERSION_BUILD 1";
|
||||
std::string build = "#define BUILD 1";
|
||||
std::string version_extra;
|
||||
if (fd.is_open())
|
||||
{
|
||||
while (getline(fd, filebuf))
|
||||
{
|
||||
if (!filebuf.find("#define VERSION_BUILD"))
|
||||
version_build = filebuf;
|
||||
else if (!filebuf.find("#define VERSION_EXTRA"))
|
||||
{
|
||||
size_t q = filebuf.find('"');
|
||||
|
||||
version_extra = filebuf.substr(q + 1, filebuf.length() - q - 2);
|
||||
}
|
||||
else if (!filebuf.find("#define BUILD"))
|
||||
{
|
||||
size_t tab = filebuf.find(' ');
|
||||
@@ -89,7 +96,7 @@ int main(int argc, char *argv[])
|
||||
for (std::list<std::pair<std::string, std::string> >::iterator it = versions.begin(), it_end = versions.end(); it != it_end; ++it)
|
||||
{
|
||||
if (it->first == "EXTRA")
|
||||
fd << "#define VERSION_EXTRA \"" << it->second << "\"" << std::endl;
|
||||
fd << "#define VERSION_EXTRA \"" << (!version_extra.empty() ? version_extra : "") << it->second << "\"" << std::endl;
|
||||
else
|
||||
fd << "#define VERSION_" << it->first << " " << it->second << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user