last_commit_id parameter should refer to the file commit_id in API
Description
The get-file-from-repository API returns a "commit_id" and a "last_commit_id". The "commit_id" refers to the commit where the file was modified while the "last_commit_id" refers to the last commit done on the specified branch.
The "last_commit_id" parameter was introduced in the update-existing-file-in-repository API in this issues 32642, 11694. The idea was to know if a file had been modified since the last time the user opened a file, not to know if the entire branch has been modified.
At the moment, if a user gets a file X with the api and someone else edits file Y before the user gets to commit file X, when calling the commit api, a 400 error message will be returned even though file X was not actually modified.
Note that the documentation actually says "last_commit_id : Last known file commit id".
Proposal
Make the "last_commit_id" parameter from the update-existing-file-in-repository API refer to the "commit_id" of a file. This way a more fine grained result is returned, one can know exactly if a file has been modified or not.
This makes sense because the repository_files API works on individual files, not on a repository or a branch.
Use cases
- The use-case described here.
Feature checklist
-
Feature assurance -
Documentation -
Added to features.yml