feat: lint commit message from hash range#22
Open
JustBipin wants to merge 3 commits into
Open
Conversation
- remove projecet's git dependent tests from src/git_helpers.rs
* dev-dependency added: `serial_test = "3"` for blocking threads
- `tests/common/git_repo.rs` to create temporary git repo
- `src/git_helpers.rs`: replaced project's git dependent unittests
with integrationtests in tests/git_helpers.rs
- improved integration tests for --hash flag
- added integration tests for hash-range feature
- extend Cli argument constrains test
- mutual exclusion of message + --hash (opensource-nepal#12)
- from-hash and to-hash are exclusive to : message, hash, file - to-hash requires from-hash and from-hash only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--from-hashand--to-hashflags to lint all commit messages between two commits, inclusive.Usage
Feature
--from-hashand--to-hashflags added to the CLI--to-hashdefaults toHEADwhen not provided--to-hashrequires--from-hashand is mutually exclusive withmessage,--file, and--hashsrc/git_helpers.rs: addedget_commit_messages_from_hash_range()which fetches all commit messages in the range and prepends thefromcommit separately, sinceA..Bin git excludesATest infrastructure
tests/common/git_repo.rs: introducesTestRepo, a temporary git repo with minimal config for use in integration testsTestRepo::new()switches the process working directory into the temp repoDroprestores the original working directory whenTestRepogoes out of scopestatic Mutexis acquired on construction and released on drop, serializing all tests that useTestRepoto prevent race conditions on the process-global cwdserial_test = "3"added as a dev-dependencysrc/git_helpers.rsthat depended on the project repo's own git history replaced with integration tests intests/git_helpers.rsusingTestRepo, so tests are self-contained and repo-state independentIntegration tests added
tests/git_helpers.rs: full coverage ofget_commit_message_from_hashandget_commit_messages_from_hash_rangewith known commit messagestests/cli.rs: success and failure cases for--hash(exact hash, invalid message, ignored message) and--from-hash/--to-hash(invalid commit at from, middle, and to positions; ignored commits in range; single-commit range)tests/cli.rs: extended mutual exclusion tests covering all missing argument combinations (message + --hash,message + --from-hash,--hash + --from-hash,--to-hashwith non---from-hashinputs)TestCoverage: 97%
closes: #10, #12