Skip to content

Commit

Permalink
Git alias fix for windows and tests (#626)
Browse files Browse the repository at this point in the history
* Git alias fix for windows and tests

* Fix the alias expression for python 2 compliance

* Add tests
  • Loading branch information
atbagga authored May 27, 2019
1 parent 86317ba commit a5a6690
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion azure-devops/azext_devops/dev/common/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ def _get_alias_key(alias):


def _get_alias_value(command):
return '!f() { exec az ' + command + ' \"$@\"; }; f'
mime = '.cmd' if sys.platform.lower().startswith('win') else ''
return '!f() { exec az' + mime + ' ' + command + ' \"$@\"; }; f'


_git_remotes = {}
Expand Down
12 changes: 12 additions & 0 deletions tests/test_gitAliasTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
import subprocess
from azure.cli.testsdk import ScenarioTest

class TestGitAliasing(ScenarioTest):
def test_git_aliases_pr_repo(self):
self.cmd('az devops configure --use-git-aliases')
repo_help = subprocess.check_output('git repo -h', shell=True)
pr_help = subprocess.check_output('git pr -h', shell=True)

0 comments on commit a5a6690

Please sign in to comment.