Skip to content

Update Evergit to version 0.2.1 with enhanced features#19

Merged
IanSkelskey merged 15 commits intomainfrom
dev
Jun 26, 2025
Merged

Update Evergit to version 0.2.1 with enhanced features#19
IanSkelskey merged 15 commits intomainfrom
dev

Conversation

@IanSkelskey
Copy link
Copy Markdown
Owner

@IanSkelskey IanSkelskey commented Jun 26, 2025

This pull request introduces improvements to Git utility functions and their associated tests, focusing on better handling of repository paths, enhanced error handling, and expanded test coverage. Key changes include the addition of a getGitRootDir function to ensure all Git commands are executed from the repository root, improved handling of detached HEAD states and unconfigured Git user details, and comprehensive integration tests for various scenarios.

Git Utility Enhancements:

  • Centralized Repository Path Handling: Added getGitRootDir to determine the root directory of the Git repository and updated all Git commands to use the -C flag for consistent execution from the repository root. (src/util/git.ts, [1] [2] [3] [4] [5] [6]
  • Improved Error Handling: Enhanced getCurrentBranchName to handle detached HEAD states and new repositories with no commits, and added fallback mechanisms for branch name determination. (src/util/git.ts, src/util/git.tsL105-R193)
  • Validation for Git User Configuration: Added checks to ensure user.name and user.email are configured, with detailed instructions provided if missing. (src/cmd/commit.ts, src/cmd/commit.tsR134-R154)

Test Suite Expansion:

  • Integration Tests for New Features: Added tests for getGitRootDir, handling of new repositories, detection of ignored files, and staging/unstaging functionality. (tests/util/git.test.ts, [1] [2] [3] [4] [5] [6]
  • Enhanced Test Coverage: Expanded tests to cover scenarios like unconfigured Git user details, special characters in commit messages, and buffer overflow errors in getDiffForStagedFiles. (tests/util/git.test.ts, tests/util/git.test.tsR103-R258)

These changes improve reliability and maintainability of the Git utilities while ensuring robust testing for edge cases.

IanSkelskey and others added 12 commits June 25, 2025 22:50
Introduce getGitRootDir function to consistently determine the Git root directory for executing Git commands. This change modifies existing Git utility functions to use the -C flag with the root directory, ensuring that all operations execute in the correct repository context, which enhances reliability when scripts are run from subdirectories.

Release-Note: Add support for executing Git commands from any subdirectory within a repository

Signed-off-by: Ian Skelskey <[email protected]>
Introduce a new integration test for the `getGitRootDir` utility function. This test verifies the function correctly returns the root directory of the Git repository by comparing normalized directory paths. This enhancement ensures that path inconsistencies due to different operating systems do not affect test outcomes.

Release-Note: add integration test for getGitRootDir utility function

Signed-off-by: Ian Skelskey <[email protected]>
- Incorporated comprehensive tests covering git operations: staging, unstaging, listing changes, and handling remote repositories.
- Introduced tests for special character handling in commit messages, remote detection, and user info retrieval.
- Provided tests for buffer overflow scenarios and upstream branch setup.

Release-Note: Enhance integration test coverage for git utilities

Signed-off-by: Ian Skelskey <[email protected]>
Enhance error handling in `getCurrentBranchName` by trailing commas for execSync calls configuration - Clean up whitespace for consistent formatting - Ensure errors are captured and a default branch is used where relevant

Release-Note: improve error handling in branch name retrieval function

Signed-off-by: Ian Skelskey <[email protected]>
Clean up whitespace inconsistencies in the Git utilities integration tests - Remove trailing spaces and ensure uniform spacing throughout the test file for better readability - Simplify setup process by ensuring clear separation between logical sections

Signed-off-by: Ian Skelskey <[email protected]>
Ensure `getUserInfo` handles cases where Git user name or email is not configured by providing detailed error messages and guidance for setting these values. Update `getName` and `getEmail` functions to properly handle errors when Git user information is not set.

- Add error handling to `getName` and `getEmail` to return empty strings if Git is not configured.
- Extend `getUserInfo` to suggest configuration commands when name or email is missing.
- Add integration tests to verify behavior when Git user configurations are missing.

Release-Note: Improve user guidance for missing Git config in commit process

Signed-off-by: Ian Skelskey <[email protected]>
@IanSkelskey
Copy link
Copy Markdown
Owner Author

close #18 #9 #8

Version 0.2.1 introduces several key improvements:
- Enhanced error handling and support for new repositories in `getCurrentBranchName`.
- Added integration tests and refactored Git utilities tests for consistency.
- Introduced git root directory support in Git functions.
- Improved code quality with prettier formatting.

Release-Note: Update includes enhanced error handling, testing, and new git directory support.

Signed-off-by: Ian Skelskey <[email protected]>
@IanSkelskey IanSkelskey changed the title Add git root directory support to Git functions Update Evergit to version 0.2.1 with enhanced features Jun 26, 2025
This commit updates the GitHub Actions workflow to utilize `actions/upload-artifact@v4` instead of the previous version. This change is intended to leverage improvements and fixes available in the newer version of the action.

Release-Note: update GitHub Action to upload-artifact@v4

Signed-off-by: Ian Skelskey <[email protected]>
@IanSkelskey IanSkelskey merged commit 64a22cc into main Jun 26, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant