diff options
author | Dave Borowitz <dborowitz@google.com> | 2012-10-31 12:27:27 -0700 |
---|---|---|
committer | Dave Borowitz <dborowitz@google.com> | 2012-10-31 12:27:27 -0700 |
commit | b42b4746af736cdc4e9309c150ec3bff704d19d3 (patch) | |
tree | bda62589c57f591aa68b0c8d98fea5c5941a1c22 | |
parent | e21526754be58523c673d29731ee01d80e0ffc31 (diff) | |
download | git-repo-b42b4746af736cdc4e9309c150ec3bff704d19d3.tar.gz |
project: Require git >= 1.7.2 for setting config on command line
This option causes the git call to fail, which probably indicates a
programming error; callers should check the git version and change the
call appropriately if -c is not available. Failing loudly is preferable
to failing silently in the general case.
For an example of correctly checking at the call site, see I8fd313dd.
If callers prefer to fail silently, they may set GIT_CONFIG_PARAMETERS
in the environment rather than using the config kwarg to pass
configuration.
Change-Id: I0de18153d44d3225cd3031e6ead54461430ed334
-rw-r--r-- | project.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -25,7 +25,7 @@ import sys | |||
25 | import time | 25 | import time |
26 | 26 | ||
27 | from color import Coloring | 27 | from color import Coloring |
28 | from git_command import GitCommand | 28 | from git_command import GitCommand, git_require |
29 | from git_config import GitConfig, IsId, GetSchemeFromUrl, ID_RE | 29 | from git_config import GitConfig, IsId, GetSchemeFromUrl, ID_RE |
30 | from error import GitError, HookError, UploadError | 30 | from error import GitError, HookError, UploadError |
31 | from error import ManifestInvalidRevisionError | 31 | from error import ManifestInvalidRevisionError |
@@ -1987,6 +1987,9 @@ class Project(object): | |||
1987 | raise TypeError('%s() got an unexpected keyword argument %r' | 1987 | raise TypeError('%s() got an unexpected keyword argument %r' |
1988 | % (name, k)) | 1988 | % (name, k)) |
1989 | if config is not None: | 1989 | if config is not None: |
1990 | if not git_require((1, 7, 2)): | ||
1991 | raise ValueError('cannot set config on command line for %s()' | ||
1992 | % name) | ||
1990 | for k, v in config.iteritems(): | 1993 | for k, v in config.iteritems(): |
1991 | cmdv.append('-c') | 1994 | cmdv.append('-c') |
1992 | cmdv.append('%s=%s' % (k, v)) | 1995 | cmdv.append('%s=%s' % (k, v)) |