Murmele / Gittyup

Understand your Git history!
https://murmele.github.io/Gittyup
MIT License
1.37k stars 107 forks source link

Templates doesn't insert filenames #658

Closed redactedscribe closed 7 months ago

redactedscribe commented 8 months ago

Templates is unintuitive, probably because it's broken.

Selecting one from the list doesn't update the commit message to include the currently staged files: Clicking a "Chore" template with chore: %| ${files:2} as its template value will insert "chore: " (no filenames).

v1.3.0

Murmele commented 7 months ago

image

For me it works fine. Did you stage? It uses as files the filenames of the staged section

redactedscribe commented 7 months ago

Create 2 templates:

tmpl1: chore: %| ${files:1} tmpl2: chore: %| ${files:2}

Then stage 3 files. Commit message is chore: .gitignore, and 2 more files.

Select tmpl2. Commit message is now chore:.

Selecting tmpl1, no change, then tmpl2 again, no change; still chore:.

The message needs to be manually cleared and a file un/staged to get the commit message to reappear with the filenames listed. But what's inserted is tmpl1's template even though tmpl2 was selected last.

It seems to be broken and unpredictable.

Murmele commented 7 months ago

What do you mean

But what's inserted is tmpl1's template even though tmpl2 was selected last.

Did you move tmpl1 as first in the list?

redactedscribe commented 7 months ago

No. I guess that's not how it works then (my expectation was that it would use the last one which I picked). At that point I would have to repick tmpl2, but as noted, currently only chore: is inserted.

Murmele commented 7 months ago

Ah now I understand, you choose it manually not automatically. I was able to reproduce

Murmele commented 7 months ago

image

No files are passed when doing it manually. I have to check

Murmele commented 7 months ago

This will fix your issue:

https://github.com/Murmele/Gittyup/pull/667

redactedscribe commented 7 months ago

Thank you.