summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-08-09 15:33:11 -0600
committerSimon Glass <sjg@chromium.org>2014-08-13 08:34:16 -0600
commite49f14af1349eef94e41b636320bbfcace7403b5 (patch)
treed20c6a3b16516ba6a58c3a3960eed1aad000b21c
parentcda2a611520e679495e7d2cf8e436b0df9afc675 (diff)
downloadu-boot-imx-e49f14af1349eef94e41b636320bbfcace7403b5.zip
u-boot-imx-e49f14af1349eef94e41b636320bbfcace7403b5.tar.gz
u-boot-imx-e49f14af1349eef94e41b636320bbfcace7403b5.tar.bz2
patman: Only use git's --no-decorate when available
Older versions of git (e.g. Ubuntu 10.04) do not support this flag. By default they do not decorate. So only enable this flag when supported. Suggested-by: Tom Rini <trini@ti.com> Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--tools/patman/gitutil.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index a8b0a1a..735c8dd 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -14,6 +14,9 @@ import terminal
import checkpatch
import settings
+# True to use --no-decorate - we check this in Setup()
+use_no_decorate = True
+
def LogCmd(commit_range, git_dir=None, oneline=False, reverse=False,
count=None):
"""Create a command to perform a 'git log'
@@ -33,7 +36,8 @@ def LogCmd(commit_range, git_dir=None, oneline=False, reverse=False,
cmd += ['log', '--no-color']
if oneline:
cmd.append('--oneline')
- cmd.append('--no-decorate')
+ if use_no_decorate:
+ cmd.append('--no-decorate')
if count is not None:
cmd.append('-n%d' % count)
if commit_range:
@@ -566,6 +570,9 @@ def Setup():
alias_fname = GetAliasFile()
if alias_fname:
settings.ReadGitAliases(alias_fname)
+ cmd = LogCmd(None, count=0)
+ use_no_decorate = (command.RunPipe([cmd], raise_on_error=False)
+ .return_code == 0)
def GetHead():
"""Get the hash of the current HEAD