summaryrefslogtreecommitdiff
path: root/git/cmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/cmd.py')
-rw-r--r--git/cmd.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 050efaed..46d809c7 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -19,6 +19,7 @@ import sys
import threading
from collections import OrderedDict
from textwrap import dedent
+import warnings
from git.compat import (
defenc,
@@ -902,8 +903,14 @@ class Git(LazyMixin):
def transform_kwargs(self, split_single_char_options=True, **kwargs):
"""Transforms Python style kwargs into git command line options."""
+ # Python 3.6 preserves the order of kwargs and thus has a stable
+ # order. For older versions sort the kwargs by the key to get a stable
+ # order.
+ if sys.version_info[:2] < (3, 6):
+ kwargs = OrderedDict(sorted(kwargs.items(), key=lambda x: x[0]))
+ warnings.warn("Python 3.5 support is deprecated. It does not preserve the order\n" +
+ "for key-word arguments. Thus they will be sorted!!")
args = []
- kwargs = OrderedDict(sorted(kwargs.items(), key=lambda x: x[0]))
for k, v in kwargs.items():
if isinstance(v, (list, tuple)):
for value in v: