Skip to content

Add git staged files utility functions (v2.2.6)#41

Merged
AntonioCS merged 1 commit intomainfrom
feature/mb-staged-files-utility
Jan 3, 2026
Merged

Add git staged files utility functions (v2.2.6)#41
AntonioCS merged 1 commit intomainfrom
feature/mb-staged-files-utility

Conversation

@AntonioCS
Copy link
Owner

Summary

  • Add core/util/git.mk with utility functions for working with git staged files
  • mb_staged_files - returns staged files, optionally filtered by extension
  • mb_run_on_staged - runs command only if staged files exist (single git call)
  • mb_git_available - checks git availability at load time
  • Graceful handling when git is not installed

Usage

# Get staged PHP files
$(call mb_staged_files,php)

# Get all staged files
$(call mb_staged_files)

# Run phpstan only on staged PHP files
$(call mb_run_on_staged,php,vendor/bin/phpstan analyse)

# Run prettier on all staged files
$(call mb_run_on_staged,,prettier --write)

Test plan

  • Tests added for all functions
  • All 180 assertions passing

Trello: https://trello.com/c/BfsJm1JU

- Add core/util/git.mk with mb_staged_files and mb_run_on_staged functions
- mb_staged_files: returns staged files, optionally filtered by extension
- mb_run_on_staged: runs command only if staged files exist (single git call)
- mb_git_available: checks git availability at load time
- Graceful handling when git is not installed
@AntonioCS AntonioCS merged commit a5528c0 into main Jan 3, 2026
1 check passed
@AntonioCS AntonioCS deleted the feature/mb-staged-files-utility branch January 3, 2026 19:39
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