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
|
||||
*.csv
|
||||
*.exe
|
||||
*.dll
|
||||
|
|
|
@ -7,12 +7,13 @@ using namespace std;
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
smatch matches;
|
||||
regex to_test(argv[1]);
|
||||
string line(argv[2]);
|
||||
|
||||
if(argc != 3) {
|
||||
println("USAGE: regtest <regex> <line>");
|
||||
} else {
|
||||
regex to_test(argv[1]);
|
||||
string line(argv[2]);
|
||||
|
||||
if(regex_match(line, matches, to_test)) {
|
||||
println("MATCHED: ");
|
||||
|
||||
|
|
11
watchgit.cpp
11
watchgit.cpp
|
@ -2,6 +2,7 @@
|
|||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <fmt/core.h>
|
||||
#include <fmt/chrono.h>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
|
@ -114,8 +115,7 @@ void run_build(const char* command) {
|
|||
char buffer[BUF_MAX]; // BUF_MAX is a define already?
|
||||
ofstream stats_out;
|
||||
stats_out.open("stats.csv", ios::out | ios::app);
|
||||
auto t = time(nullptr);
|
||||
auto tm = *std::gmtime(&t);
|
||||
std::time_t tstamp = std::time(nullptr);
|
||||
|
||||
dbc::check(stats_out.good(), "Error opening stats.csv file.");
|
||||
dbc::pre("simple test", [&]() { return stats_out.good(); });
|
||||
|
@ -136,13 +136,12 @@ void run_build(const char* command) {
|
|||
string type = err[4].str();
|
||||
string message = err[5].str();
|
||||
|
||||
stats_out << put_time(&tm, "%FT%TZ");
|
||||
string result = format(",{},{},{},{},{}\n", file_name, lnumber, col, type, message);
|
||||
string result = format("{:%FT%T},{},{},{},{},{}\n",
|
||||
fmt::localtime(tstamp), file_name,
|
||||
lnumber, col, type, message);
|
||||
|
||||
stats_out << result;
|
||||
cout << "MATCHED: " << quoted(result);
|
||||
} else {
|
||||
//println("NOT MATCHED! {}", line);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue