Skip to content

Commit

Permalink
Merge pull request #44 from spadgos/diff-in-commit-msg
Browse files Browse the repository at this point in the history
Diff in commit message
  • Loading branch information
kemayo committed Jan 17, 2012
2 parents cd68b6a + d40e53e commit 442b357
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions git.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,14 +383,16 @@ def porcelain_status_done(self, result):
self.panel("Nothing to commit")
return
# Okay, get the template!
self.run_command(['git', 'status'], self.status_done)
self.run_command(['git', 'diff', '--staged'], self.diff_done)

def status_done(self, result):
def diff_done(self, result):
template = "\n".join([
"",
"# Please enter the commit message for your changes. Lines starting",
"# with '#' will be ignored, and an empty message aborts the commit.",
"# with '#' and everything after the 'END' statement below will be ",
"# ignored, and an empty message aborts the commit.",
"# Just close the window to accept your message.",
"# END--------------",
result.strip()
])
msg = self.window.new_file()
Expand All @@ -403,7 +405,7 @@ def status_done(self, result):

def message_done(self, message):
# filter out the comments (git commit doesn't do this automatically)
lines = [line for line in message.split("\n")
lines = [line for line in message.split("\n# END---")[0].split("\n")
if not line.lstrip().startswith('#')]
message = '\n'.join(lines)
# write the temp file
Expand Down

0 comments on commit 442b357

Please sign in to comment.