Network graph shows incorrect merge history when merge parent timestamps are later than merge
Created by: Hooksie
When a merge commit is performed that references a merge parent with a timestamp that is later than the merge commit itself, the network graph displays that the merge parent is the latest commit on the parents branch that occurs before the merge commit, which is incorrect.
This can occur when a client has a system clock set in the future, relative to the Gitlab server, and a commit is made to a branch shortly before it is merged in (either through a merge request or by another user) AND when the source branch still exists at the last commit in the branch.
Incorrect behavior: The network graph marks 49945e4 as one of 19eda68's parents.
commit 19eda6824321d5dbf1d75e52fa1943850d34ae93 Merge: 16ca233 660c6db Author: *** Date: Thu Feb 5 18:12:26 2015 -0500 ...
commit 660c6db94e234d7f3f3f786fc24103029984ee9f Author: *** Date: Thu Feb 5 18:14:38 2015 -0500 ...
commit 49945e44f26b8dc270f287b162e59519b48cadc5 Author: *** Date: Thu Feb 5 18:09:51 2015 -0500 ...
Proper behavior: The merge arrow from branch b1
should occur after 660c6db.
You can recreate this problem in a fresh repository by:
git init
touch file1; git add -A; git commit -m "Initial commit"
git checkout -b branch1
touch file2; git add -A; git commit -m "Commit on branch1"
touch file3; git add -A; git commit -m "Incorrect system time commit"
-
GIT_COMMITTER_DATE="$((
git log -1 --pretty=format:%at` + 3600))" git commit --amend --no-edit --date="$((git log -1 --pretty=format:%at
+ 3600))"` (Alter the previous commit to occur one hour in the future) git checkout master
touch file4; git add -A; git commit -m "Correct system time commit"
git merge branch1
- Add your Gitlab remotes and push master, THEN push branch1. Notice that after pushing master the network graph is correct, but after pushing branch1 the network graph is incorrect, as below:
After pushing master (correct):
After pushing branch1 (incorrect):
Found on 7.7.1.