Allow time tracking to be recorded via commit message

Description

Time tracking is enabled on an individual issue. Time spent can be recorded using issue comments, but cannot be recorded by the developer while writing code, unless they have the issue open in the web browser.

Developers should be able to track time on a per-commit level and have that time assigned to the issue their commit relates to.

Proposal

I see two possible situations which might be desired:

  1. The /spend command in a commit message spends time on all tickets ref'd by this commit. (every ticket referenced using the #closes, #refs, etc syntax)
  • Pro: Simple. It seems fair to say that if a ticket is ref'd by a commit, it's fair to say that time was spent on the commit, so this is simple. Keeps your actual commits in the git log reasonably clean.
  • Con: Makes it hard if you're using time tracking to try and do granular access for billing/reporting, etc. (Causes double-charging for the same time) Doesn't behave the same way as time tracking via issues.
  1. A unique syntax is developed allowing the developer to use a /spend style command for a specific issue.
  • Pro: Allows granular time-tracking at the commit level to filter up to project time reporting. Behaves the same way as time tracking via issues.
  • Con: Requires new syntax to be documented and learned. Creates messier looking git log messages

In order to support both of these use-cases I propose the following syntax:

  • Spend time on specific ticket: spend 2h30m on #24
  • Spend time on multiple tickets: spend 1h5m on #1 #99
  • Spend time on all tickets: spend 50m on #refs

With "spend" or "spends", or even "spent" as the keyword, followed by the same timestring format used in dash-commands, followed by "on #" it should create a reasonably unique string that is able to be parsed out of the commit messages without false-positives, and it allows whatever level of time tracking is desired, while keeping a fairly natural sounding commit message.

Out of Scope

  • Other Dash-Commands (Although it may be desirable in same cases, the ephemeral nature of /label, /assign and /milestone may not be desirable to record in the git commit log, so this request is only for time tracking commands.)

Links / references

This issue has been discussed in many of the time tracking related tickets, declared out-of-scope on the initial iteration, and asked for in a number of tickets. (Since I could not find a master ticket to track this request I created this ticket)

Edited by 🤖 GitLab Bot 🤖