The watchgit works but I don't think I really need libgit2 at all if I can just process the .gitignore correctly.
This commit is contained in:
parent
899e481c9d
commit
f1ee5e82f4
3 changed files with 9 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,3 +10,4 @@ builddir
|
||||||
subprojects
|
subprojects
|
||||||
*.csv
|
*.csv
|
||||||
*.exe
|
*.exe
|
||||||
|
*.dll
|
||||||
|
|
|
@ -7,12 +7,13 @@ using namespace std;
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
smatch matches;
|
smatch matches;
|
||||||
regex to_test(argv[1]);
|
|
||||||
string line(argv[2]);
|
|
||||||
|
|
||||||
if(argc != 3) {
|
if(argc != 3) {
|
||||||
println("USAGE: regtest <regex> <line>");
|
println("USAGE: regtest <regex> <line>");
|
||||||
} else {
|
} else {
|
||||||
|
regex to_test(argv[1]);
|
||||||
|
string line(argv[2]);
|
||||||
|
|
||||||
if(regex_match(line, matches, to_test)) {
|
if(regex_match(line, matches, to_test)) {
|
||||||
println("MATCHED: ");
|
println("MATCHED: ");
|
||||||
|
|
||||||
|
|
11
watchgit.cpp
11
watchgit.cpp
|
@ -2,6 +2,7 @@
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
|
#include <fmt/chrono.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
@ -114,8 +115,7 @@ void run_build(const char* command) {
|
||||||
char buffer[BUF_MAX]; // BUF_MAX is a define already?
|
char buffer[BUF_MAX]; // BUF_MAX is a define already?
|
||||||
ofstream stats_out;
|
ofstream stats_out;
|
||||||
stats_out.open("stats.csv", ios::out | ios::app);
|
stats_out.open("stats.csv", ios::out | ios::app);
|
||||||
auto t = time(nullptr);
|
std::time_t tstamp = std::time(nullptr);
|
||||||
auto tm = *std::gmtime(&t);
|
|
||||||
|
|
||||||
dbc::check(stats_out.good(), "Error opening stats.csv file.");
|
dbc::check(stats_out.good(), "Error opening stats.csv file.");
|
||||||
dbc::pre("simple test", [&]() { return stats_out.good(); });
|
dbc::pre("simple test", [&]() { return stats_out.good(); });
|
||||||
|
@ -136,13 +136,12 @@ void run_build(const char* command) {
|
||||||
string type = err[4].str();
|
string type = err[4].str();
|
||||||
string message = err[5].str();
|
string message = err[5].str();
|
||||||
|
|
||||||
stats_out << put_time(&tm, "%FT%TZ");
|
string result = format("{:%FT%T},{},{},{},{},{}\n",
|
||||||
string result = format(",{},{},{},{},{}\n", file_name, lnumber, col, type, message);
|
fmt::localtime(tstamp), file_name,
|
||||||
|
lnumber, col, type, message);
|
||||||
|
|
||||||
stats_out << result;
|
stats_out << result;
|
||||||
cout << "MATCHED: " << quoted(result);
|
cout << "MATCHED: " << quoted(result);
|
||||||
} else {
|
|
||||||
//println("NOT MATCHED! {}", line);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue