git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[StGit PATCH 4/4] Read default diff options from the user's config

From
Karl Hasselström <kha@treskal.com>
Date
Jan 24, 2008, 08:08 UTC
Message-ID
<20080124080810.25525.82689.stgit@yoghurt>
In-Reply-To
<20080124075935.25525.24416.stgit@yoghurt>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
 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"')]
Previous: Karl HasselströmNext: Karl Hasselström
Message 8 of 10 in “stgit: config option for diff-opts”
  1. Jon SmirlJan 23, 2008
  2. Karl HasselströmJan 23, 2008
  3. Yann DirsonJan 24, 2008
  4. 0/4 --diff-opts in config fileKarl Hasselström, Jan 24, 2008
  5. 1/4 Remove unused default valuesKarl Hasselström, Jan 24, 2008
  6. 2/4 Refactor --diff-opts handlingKarl Hasselström, Jan 24, 2008
  7. 3/4 Let "stg show" use the unified --diff-opts handlingKarl Hasselström, Jan 24, 2008
  8. 4/4 Read default diff options from the user's configKarl Hasselström, Jan 24, 2008
  9. Karl HasselströmJan 24, 2008
  10. Jon SmirlJan 24, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.