Skip to content

Commit

Permalink
fix: add windows specific commands for command line git interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonhard Breuer committed Aug 6, 2024
1 parent 573be86 commit 0e551fc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/gitutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
#include <memory>
#include <vector>
#include <regex>
#ifdef _WIN32
#include <stdio.h>
#include <stdlib.h>
#define popen _popen
#define pclose _pclose
#else
#include <unistd.h>
#include <cstdio>
#endif
#include "gitutil.h"

#include "common.h"
Expand Down Expand Up @@ -44,15 +53,17 @@ std::string GitUtil::getLog() {

std::vector<Commit> GitUtil::getCommits() {
std::vector<Commit> commits;
for (const auto log = getLog(); auto commit: splitGitLog(log))
const auto log = getLog();
for (auto commit: splitGitLog(log))
commits.emplace_back(commit);
std::reverse(commits.begin(), commits.end());
return commits;
}

Version GitUtil::calculateVersion() {
Version version;
for (const auto& commits = getCommits(); const auto &commit: commits) {
const auto& commits = getCommits();
for (const auto &commit: commits) {
const auto type = commit.getCommitType();
const auto minorVersionTypes = config.getConvention()->getTypesForVersion(VersionType::MINOR);
if ( contains<std::string>(minorVersionTypes, type))
Expand Down

0 comments on commit 0e551fc

Please sign in to comment.