Skip to content

Commit 24240b2

Browse files
authored
Merge pull request acaudwell#338 from onlyJakob/author-time
add author-time option
2 parents fe67856 + 3ce6519 commit 24240b2

5 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ options:
109109
--no-time-travel
110110
Use the time of the last commit if the time of a commit is in the past.
111111
112+
--author-time
113+
Use the timestamp of the author instead of the timestamp of the committer.
114+
112115
-c, --time-scale SCALE
113116
Change simulation time scale. This affects the movement speed of user avatars.
114117

‎data/gource.1‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ Realtime playback speed.
9191
\fB\-\-no\-time\-travel\fR
9292
Use the time of the last commit if the time of a commit is in the past.
9393
.TP
94+
\fB\-\-author\-time\fR
95+
Use the timestamp of the author instead of the timestamp of the committer.
96+
.TP
9497
\fB\-c, \-\-time\-scale SCALE\fR
9598
Change simulation time scale. This affects the movement speed of user avatars.
9699

‎src/formats/git.cpp‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ void GitCommitLog::readGitVersion() {
8888
std::string GitCommitLog::logCommand() {
8989

9090
std::string log_command = "git log "
91-
"--pretty=format:user:%aN%n%ct "
9291
"--reverse --raw --encoding=UTF-8 "
9392
"--no-renames";
9493

@@ -101,7 +100,13 @@ std::string GitCommitLog::logCommand() {
101100
|| git_version_major > 2
102101
|| (git_version_major == 2 && git_version_minor >= 10))
103102
{
104-
log_command.append(" --no-show-signature");
103+
log_command += " --no-show-signature";
104+
}
105+
106+
if(gGourceSettings.author_time) {
107+
log_command += " --pretty=format:user:%aN%n%at";
108+
} else {
109+
log_command += " --pretty=format:user:%aN%n%ct";
105110
}
106111

107112
if(!gGourceSettings.start_date.empty()) {

‎src/gource_settings.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ void GourceSettings::help(bool extended_help) {
7777
printf(" --realtime Realtime playback speed\n");
7878
printf(" --no-time-travel Use the time of the last commit if the\n");
7979
printf(" time of a commit is in the past\n");
80+
printf(" --author-time Use the timestamp of the author instead of\n");
81+
printf(" the timestamp of the committer\n");
8082
printf(" -c, --time-scale SCALE Change simulation time scale (default: 1.0)\n");
8183
printf(" -e, --elasticity FLOAT Elasticity of nodes (default: 0.0)\n\n");
8284

@@ -274,6 +276,7 @@ GourceSettings::GourceSettings() {
274276
arg_types["file-extensions"] = "bool";
275277
arg_types["file-extension-fallback"] = "bool";
276278
arg_types["fixed-user-size"] = "bool";
279+
arg_types["author-time"] = "bool";
277280
arg_types["key"] = "bool";
278281
arg_types["ffp"] = "bool";
279282

@@ -395,6 +398,7 @@ void GourceSettings::setGourceDefaults() {
395398
dont_stop = false;
396399
no_time_travel = false;
397400
fixed_user_size = false;
401+
author_time = false;
398402

399403
show_key = false;
400404

@@ -1378,6 +1382,10 @@ void GourceSettings::importGourceSettings(ConfFile& conffile, ConfSection* gourc
13781382
fixed_user_size = true;
13791383
}
13801384

1385+
if(gource_settings->getBool("author-time")) {
1386+
author_time = true;
1387+
}
1388+
13811389
if((entry = gource_settings->getEntry("max-files")) != 0) {
13821390

13831391
if(!entry->hasValue()) conffile.entryException(entry, "specify max-files (number)");

‎src/gource_settings.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class GourceSettings : public SDLAppSettings {
7171
bool dont_stop;
7272
bool no_time_travel;
7373
bool fixed_user_size;
74+
bool author_time;
7475

7576
float auto_skip_seconds;
7677
float days_per_second;

0 commit comments

Comments
 (0)