Skip to content

Commit

Permalink
Add aliases for all Elegant Git commands
Browse files Browse the repository at this point in the history
The aliases will be created based on the dynamic loading of all available
commands. This solves a problem with obsolete aliases configuration as
well as simplifies maintenance.

This change should not have any side effects.
  • Loading branch information
extsoft committed Oct 4, 2019
1 parent 5186eaf commit e3ecb44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libexec/git-elegant-acquire-repository
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,5 @@ default() {
_core_autocrlf_darwinlinux _core_autocrlf_windows _pull_rebase \
_rebase_autoStash _credential_helper_darwin
__remove-old-aliases
__aliases-configuration "pull" "clear-local" $(git elegant commands | grep work)
__aliases-configuration $(git elegant commands)
}
9 changes: 5 additions & 4 deletions tests/git-elegant-acquire-repository.bats
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ teardown() {

@test "'acquire-repository': aliases configuration works as expected" {
check git-elegant acquire-repository
[[ "${lines[@]}" =~ "==>> git config --local alias.start-work elegant start-work" ]]
[[ "${lines[@]}" =~ "==>> git config --local alias.save-work elegant save-work" ]]
[[ "${lines[@]}" =~ "==>> git config --local alias.deliver-work elegant deliver-work" ]]
[[ "${lines[@]}" =~ "==>> git config --local alias.accept-work elegant accept-work" ]]
for next in $(git-elegant commands); do
echo "Test aliasing of '${next}' command"
[[ "${lines[@]}" =~ "==>> git config --local alias.${next} elegant ${next}" ]]
echo "Tested successfully!"
done
}

@test "'acquire-repository': local aliases are removed as expected" {
Expand Down

0 comments on commit e3ecb44

Please sign in to comment.