Skip to content

Jira Smart Commits support #95

@desaroger

Description

@desaroger

Hi! First of all, sorry if there was already another issue where this is solved. I only found the issue #72, but I think it does not solve my problem.

I need to create Smart Commits instead of Commit Notes. I solved this, as @mschenk42 suggested in #72, creating a commit-msg hook where I modify the commit message adding a new line with the format Jira expects. You can see my commit-msg and post-commit hooks.

So in short I do gtm status --total-only to get the total time and that is what I add to the commit message. And everything seems fine until I found a problem with that:

When you run gtm status --total-only you get the the time spent on all the files. But when a commit is done, only the events related with files in that commit are cleaned. This means that if I am working on a file, but I do not commit it, the time spent in that file will be added to the time of that commit, but will not be erased from the gtm folder, so in the next commit that time will (plust the new time I spent in the file) will be added also to the commit time. And to the next, and next, until I commit that file.

My solution to that problem is to clean gtm after a commit (you can see this in the post-commit hook). But this is not ideal, as I am including time in commits not relevant for them.

The solution I think would be ideal for me is a way of getting the total time spent, but only for the files that would be included in the next commit. Something like gtm status --only-staged or something like that.

Thank you very much! I love this project, I think it's very useful, thanks for creating it!

Attachments:
commit-msg.txt
post-commit.txt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions