GitHub’s server reports a “pushed date” associated to some commits sent to its server. It is supposed to be “[t]he datetime when this commit was pushed”. I wonder if this is true, or if there is a bug in this timestamping process.
Running the following query in the Graph explorer, I observe that the commit 4016
is reported to have been pushed at 2018-08-21T18:29:00Z, that is, before its parent of its parent, the commit 21af
, reported to have been pushed at 2018-08-22T10:45:40Z. Is it possible using git to push a commit before its parent?
It is impossible to modify a commit. Thus, the commit 4016
already had its parent set, itself having already its parent set, at the time it was pushed to GitHub. (Indeed, the authoring and commit timestamps suggest so, assuming they are correct.) And I see no way of pushing a commit to a remote without also pushing its ancestors (reading the git book or the git push man page). Hence my question.
Here is the query.
{
repository(owner: "oliviercailloux", name: "CLut") {
object(oid: "4016d7b1b09e2a188fb99d30d1ca5b0f726a4a3d") {
... on Commit {
history(first: 3) {
totalCount
nodes {
oid
message
parents(first: 100) {
nodes {
oid
}
}
authoredDate
committedDate
pushedDate
}
}
}
}
}
}
And here is the answer.
{
"data": {
"repository": {
"object": {
"history": {
"totalCount": 13,
"nodes": [
{
"oid": "4016d7b1b09e2a188fb99d30d1ca5b0f726a4a3d",
"message": "Intro",
"parents": {
"nodes": [
{
"oid": "c145866575e55309f943ad2c2b4d547b926f38d0"
}
]
},
"authoredDate": "2018-08-21T18:28:49Z",
"committedDate": "2018-08-21T18:28:49Z",
"pushedDate": "2018-08-21T18:29:00Z"
},
{
"oid": "c145866575e55309f943ad2c2b4d547b926f38d0",
"message": "Refactored into a short article",
"parents": {
"nodes": [
{
"oid": "21af8bffc747eaee04217b9c8bb9e3e4a3a6293d"
}
]
},
"authoredDate": "2018-08-21T18:25:52Z",
"committedDate": "2018-08-21T18:25:52Z",
"pushedDate": null
},
{
"oid": "21af8bffc747eaee04217b9c8bb9e3e4a3a6293d",
"message": "Minor (wording and a ref)",
"parents": {
"nodes": [
{
"oid": "f63a7c3a01123b266274728179c9cd46b41b69a5"
}
]
},
"authoredDate": "2018-08-21T14:35:14Z",
"committedDate": "2018-08-21T14:35:14Z",
"pushedDate": "2018-08-22T10:45:40Z"
}
]
}
}
}
}
}
Here is the relevant bit of history:
21af [reported pushed at 22 aug 10h45m40s; authored at 21 aug 14h35m14s] <- c145 [authored 21 aug 18h25m52s] <- 4016 [reported pushed at 21 aug 18h29m00; authored at 21 aug 18h28m49s]
Note that my question differs from this one, as my question is about the pushed dates timestamps set by the GitHub server, not about the commit and author dates stored in the commits.
When asked to the GitHub support, they simply confirmed to me that the observed pushedDate
values conform to their internal data in the case of this repository, so they consider it not a bug.
Background (Taken from here.)
The reason I am interested in timestamps provided by GitHub is that I use GitHub as a trusted time source. The commits themselves contain timestamps, but the client can put whatever time is desired there. I need to know the real time commits were sent to GitHub to grade student works and penalize them if they are late.
I know that GitHub classroom (which I am a happy user of) provides some timestamping option, but it does not permit to get a timestamp to multiple commits as I would like to have.
I am also aware that GitHub will not provide events older than three months through its API. That’s fine with me. My goal is to retrieve timestamps of recent events (meaning, say, one month old or more recent).