summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2012-02-10 13:45:09 -0500
committerOwen W. Taylor <otaylor@fishsoup.net>2012-02-10 13:47:09 -0500
commit8c0d2f64a733c61b7ba0c736686b6a9354a5b9df (patch)
tree7e0b64fd51f258e7588b685c4694afa971b703cd
parent9b039f99c357b36cf3c0b68806d3a729390fad78 (diff)
downloadgit-bz-8c0d2f64a733c61b7ba0c736686b6a9354a5b9df.tar.gz
Don't strip leading space from the commit body
If we strip leading space from the body, we'll unindent the first line of the body, which could break aligment. Based on a patch by Stef Walter <stefw@gnome.org>
-rwxr-xr-xgit-bz19
1 files changed, 15 insertions, 4 deletions
diff --git a/git-bz b/git-bz
index 462df46..7d8d804 100755
--- a/git-bz
+++ b/git-bz
@@ -129,6 +129,7 @@ def git_run(command, *args, **kwargs):
quiet = False
input = None
return_stderr = False
+ strip = True
for (k,v) in kwargs.iteritems():
if k == '_quiet':
quiet = True
@@ -136,6 +137,8 @@ def git_run(command, *args, **kwargs):
interactive = True
elif k == '_return_stderr':
return_stderr = True
+ elif k == '_strip':
+ strip = v
elif k == '_input':
input = v
elif v is True:
@@ -163,10 +166,15 @@ def git_run(command, *args, **kwargs):
if interactive:
return None
- elif return_stderr:
- return output.strip(), error.strip()
else:
- return output.strip()
+ if strip:
+ output = output.strip()
+ error = error.strip()
+
+ if return_stderr:
+ return output, error
+ else:
+ return output
# Wrapper to allow us to do git.<command>(...) instead of git_run()
class Git:
@@ -228,7 +236,10 @@ def get_patch(commit):
return git.format_patch(commit.id + "^.." + commit.id, stdout=True, M=True)
def get_body(commit):
- return git.log(commit.id + "^.." + commit.id, pretty="format:%b")
+ body = git.log(commit.id + "^.." + commit.id, pretty="format:%b", _strip=False)
+ # Preserve leading space, which tends to be indents, but strip off
+ # the trailing newline and any other insignificant space at the end.
+ return body.rstrip()
def commit_is_merge(commit):
contents = git.cat_file("commit", commit.id)