Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Used git log instead of git show for last commit's timestamp

The reason for this was that git show included the whole changeset in
the output, but only the UTC timestamp was needed. By using git log
it is possible to get just the timestamp. The whole changeset can be
large, and can cause unicode encoding errors.
  • Loading branch information...
1 parent c63c62a commit 90985048fc1882483794e6734eb91401aefbe768 @akaariai akaariai committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/utils/
4 django/utils/
@@ -40,10 +40,10 @@ def get_git_changeset():
so it's sufficient for generating the development version numbers.
repo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
- git_show = subprocess.Popen('git show --pretty=format:%ct --quiet HEAD',
+ git_log = subprocess.Popen('git log --pretty=format:%ct --quiet -1 HEAD',
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=True, cwd=repo_dir, universal_newlines=True)
- timestamp = git_show.communicate()[0].partition('\n')[0]
+ timestamp = git_log.communicate()[0]
timestamp = datetime.datetime.utcfromtimestamp(int(timestamp))
except ValueError:

0 comments on commit 9098504

Please sign in to comment.
Something went wrong with that request. Please try again.