Skip to content

Commit

Permalink
Fix #11: Issues with % in the log hook
Browse files Browse the repository at this point in the history
  • Loading branch information
msiemens committed Mar 23, 2014
1 parent aee432d commit 1801a86
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions PyGitUp/gitup.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,17 @@ def log(self, branch, remote):

# In addition, we replace occurences of $1 with %1 and so forth
# in case the user is used to Bash or sh.
# If there are occurences of %something, we'll replace it with
# %%something. This is the case when running something like
# 'git log --pretty=format:"%Cred%h..."'.
# Also, we replace a semicolon with a newline, because if you
# start with 'echo' on Windows, it will simply echo the
# semicolon and the commands behind instead of echoing and then
# running other commands

# Prepare log_hook
log_hook = re.sub(r'\$(\d+)', r'%\1', log_hook)
log_hook = re.sub(r'%(?!\d)', '%%', log_hook)
log_hook = re.sub(r'; ?', r'\n', log_hook)

# Write log_hook to an temporary file and get it's path
Expand Down

0 comments on commit 1801a86

Please sign in to comment.