From: Karl Hasselström Date: Thu, 24 Jan 2008 08:08:21 GMT Subject: [StGit PATCH 4/4] Read default diff options from the user's config Message-ID: <20080124080810.25525.82689.stgit@yoghurt> In-Reply-To: <20080124075935.25525.24416.stgit@yoghurt> Signed-off-by: Karl Hasselström --- examples/gitconfig | 4 ++++ stgit/utils.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/examples/gitconfig b/examples/gitconfig index cd9b569..c16f786 100644 --- a/examples/gitconfig +++ b/examples/gitconfig @@ -95,6 +95,10 @@ # The maximum length of an automatically generated patch name #namelenth = 30 + # Extra options to pass to "git diff" (extend/override with + # -O/--diff-opts). For example, -M turns on rename detection. + #diff-opts = -M + [mail "alias"] # E-mail aliases used with the 'mail' command git = git@vger.kernel.org diff --git a/stgit/utils.py b/stgit/utils.py index 00776b0..69203dc 100644 --- a/stgit/utils.py +++ b/stgit/utils.py @@ -320,7 +320,8 @@ def make_diff_opts_option(): else: parser.values.diff_flags = [] return [optparse.make_option( - '-O', '--diff-opts', dest = 'diff_flags', default = [], + '-O', '--diff-opts', dest = 'diff_flags', + default = (config.get('stgit.diff-opts') or '').split(), action = 'callback', callback = diff_opts_callback, type = 'string', metavar = 'OPTIONS', help = 'extra options to pass to "git diff"')]