API: feature request to add author/committer date #4533

Closed
opened 2025-11-02 05:53:39 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @lukastribus on GitHub (Dec 22, 2019).

  • Gitea version (or commit ref): 1.11.0+dev-481-g1df701fd1
  • Git version: 2.17.1 or whatever try.gitea.io runs
  • Operating system: Ubuntu 16.04 or whatever try.gitea.io runs
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes
    • No
    • Not relevant
  • Log gist: n/a

Description

This is a feature request for the API allowing to add/update/delete files (and commit it):
​/repos​/{owner}​/{repo}​/contents​/{filepath}

I would like to be able to specify the author date and commit date, just as git commit on the command line allows (--date argument or GIT_AUTHOR_DATE and GIT_COMMITTER_DATE environment variable).

We should also allow the same date formats that git commit itself allows, so not only a single unix timestamp, but also the time zone offset (or even RFC 2822/ISO8601), so that we can actually use local time zones as opposed to only UTC.

Extending the API with optional parameters does not break backwards compatibility, so this should be fine.

CCing @6543 who recently touched this code.

What do you think about this request? Would this change be complex?

Originally created by @lukastribus on GitHub (Dec 22, 2019). - Gitea version (or commit ref): 1.11.0+dev-481-g1df701fd1 - Git version: `2.17.1` or whatever `try.gitea.io` runs - Operating system: Ubuntu 16.04 or whatever `try.gitea.io` runs - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes - [ ] No - [x] Not relevant - Log gist: n/a ## Description This is a feature request for the API allowing to add/update/delete files (and commit it): `​/repos​/{owner}​/{repo}​/contents​/{filepath}` I would like to be able to specify the author date and commit date, just as `git commit` on the command line allows (`--date` argument or `GIT_AUTHOR_DATE` and `GIT_COMMITTER_DATE` environment variable). We should also allow the same date formats that `git commit` itself allows, so not only a single unix timestamp, but also the time zone offset (or even RFC 2822/ISO8601), so that we can actually use local time zones as opposed to only UTC. Extending the API with optional parameters does not break backwards compatibility, so this should be fine. CCing @6543 who recently touched this code. What do you think about this request? Would this change be complex?
GiteaMirror added the type/enhancementmodifies/api labels 2025-11-02 05:53:39 -06:00
Author
Owner

@6543 commented on GitHub (Dec 22, 2019):

first look: I would extend the body, more exact:
from ...

  • DeleteFileOptions
  • CreateFileOptions
  • UpdateFileOptions
    ... the Identity type has to be extendet ...
@6543 commented on GitHub (Dec 22, 2019): first look: I would extend the `body`, more exact: from ... - DeleteFileOptions - CreateFileOptions - UpdateFileOptions ... the `Identity` type has to be extendet ...
Author
Owner

@6543 commented on GitHub (Dec 22, 2019):

but extending IdentityOptions and Identity with a fild not related to itself is ... mad

@6543 commented on GitHub (Dec 22, 2019): but extending `IdentityOptions` and `Identity` with a fild not related to itself is ... mad * GitHub [Link] (https://developer.github.com/v3/repos/contents/#parameters-2) do not have this option so adding a optional in-body-param is the way I would do it
Author
Owner

@6543 commented on GitHub (Dec 22, 2019):

what do you thin of:

{
  "message": "my commit message",
  "committer": {
    "name": "Monalisa Octocat",
    "email": "octocat@github.com"
  },
  "content": "bXkgbmV3IGZpbGUgY29udGVudHM=",
  ...
  "dates": {
    "author": "2014-11-07T22:01:45Z",
    "committer": "2014-11-07T22:01:45Z"
  },
  ...
}
@6543 commented on GitHub (Dec 22, 2019): what do you thin of: ```json { "message": "my commit message", "committer": { "name": "Monalisa Octocat", "email": "octocat@github.com" }, "content": "bXkgbmV3IGZpbGUgY29udGVudHM=", ... "dates": { "author": "2014-11-07T22:01:45Z", "committer": "2014-11-07T22:01:45Z" }, ... } ```
Author
Owner
@6543 commented on GitHub (Dec 22, 2019): and * https://github.com/go-gitea/gitea/blob/master/modules/repofiles/update.go#L374 * https://github.com/go-gitea/gitea/blob/master/modules/repofiles/temp_repo.go#L190 have to be changed ...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4533