Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count the files for multi-file changes #38

Closed
MichaelCurrin opened this issue Apr 27, 2021 · 14 comments · Fixed by #48 or #53
Closed

Count the files for multi-file changes #38

MichaelCurrin opened this issue Apr 27, 2021 · 14 comments · Fixed by #48 or #53
Labels
enhancement New feature or request

Comments

@MichaelCurrin
Copy link
Owner

MichaelCurrin commented Apr 27, 2021

e.g.

  • update 3 files in foo
  • update 16 files and delete 2 files

Relates to #13

@MichaelCurrin
Copy link
Owner Author

@MichaelCurrin
Copy link
Owner Author

Consider a threshold - maybe 4 files or less lists the names otherwise breaks out as counts

Or maybe check the length of the generated message and then fallback to generating the count one.

@glassesUSA
Copy link

Any idea when this will be available?

@MichaelCurrin
Copy link
Owner Author

I haven't though about this one for a while. I can find time this weekend.

If I make PR, would you be able to review it and/or try it out locally before the next release?

@glassesUSA
Copy link

Sure will do!

@MichaelCurrin
Copy link
Owner Author

I have some work in progress on draft linked PR. So far handles exactly one file so not useful yet LOL. But following TDD with tests firsts and one file is the easiest to start with.

@MichaelCurrin
Copy link
Owner Author

MichaelCurrin commented Jul 11, 2021

I'll update here when it's ready for review

@MichaelCurrin
Copy link
Owner Author

MichaelCurrin commented Jul 13, 2021

@glassesUSA i made some good progress. I have a function that can generate

create 1 file, update 2 files and delete 1 file

I have two areas I'd like your input on. See if you agree and if there are any scenarios or behaviors that you want to suggest.

Conventional commit

How about the prefix before the message should always be feat if you add or update a file?

And if you only move or rename, it is refactor.

If you only delete files, then it is chore.

BTW I have an idea to implement pressing the button twice to go from feat to fix in a follow up. #50

When to count files

I was wondering when it makes sense to apply the create x files bit.

I'm thinking:

  • the old functionality can be used if the changes are the same e.g. create 4 files then that remains create foo.js, bar.txt, fizz.js and buzz.js
  • But whenever changes are mixed, then use the count approach. Like create 1 file and delete 2 files. This replaces the old "Various changes to x, y and z" message.
  • and another use for count approach is if there are more than 4 files. e.g. create 5 files or delete 5 files.

The more than 4 is easy to do initially. I'm thinking later generate the named files and if the message is more than 50 characters then regenerate a message using counts. #49

@glassesUSA
Copy link

Sounds good to me!

@MichaelCurrin
Copy link
Owner Author

@glassesUSA I've put through 2 PRs and have the code working well installed in my IDE

I'm not doing a release yet so that I have time to use it some more, but you can try it out by cloning the repo and running the following:

make install
make ext      # build and install extension

For the second PR that was merged.

Please see the test cases for these functions for high-level message handling. See if you think I covered a good mix of cases.

  _msgNamed,
  _msgCount,
  _msgFromChanges,

The _msgFromChanges function uses a constant set at 5 and will use _msgCount for 5 or more files.

https://github.com/MichaelCurrin/auto-commit-msg/blob/master/src/test/prepareCommitMsg.test.ts


In the first PR that was merged, I set up count.ts module. There are a bunch of low-level tests for countMsg here.

See https://github.com/MichaelCurrin/auto-commit-msg/blob/master/src/test/generate/count.test.ts

The countMsg function is used internally by _msgCount, so you'll see some overlap.


I've linked some follow-up issues here, in particular to add conv commit support.

#49 #50 #52 #55

@MichaelCurrin
Copy link
Owner Author

This came in useful today

Screen Shot 2021-07-19 at 10 02 54 am

@MichaelCurrin
Copy link
Owner Author

I didn't see a response but I have been using this code the last week and it works fine for me. So am making a new release and closing this issue.

@glassesUSA
Copy link

Apologies was running a different repo that required a specific naming convention for requests so didn't have time to test. Glad it seems to be working!

@MichaelCurrin
Copy link
Owner Author

MichaelCurrin commented Jul 25, 2021

Please see release with downloadable file

https://github.com/MichaelCurrin/auto-commit-msg/releases/tag/v0.20.0

@MichaelCurrin MichaelCurrin unpinned this issue Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants