diff --git a/hledger/Hledger/Cli/Version.hs b/hledger/Hledger/Cli/Version.hs index 17dac1531..6c4f66583 100644 --- a/hledger/Hledger/Cli/Version.hs +++ b/hledger/Hledger/Cli/Version.hs @@ -13,7 +13,7 @@ module Hledger.Cli.Version ( ) where -import GitHash (GitInfo, giHash, giCommitDate) +import GitHash (GitInfo, giHash, giCommitDate, giDirty) import System.Info (os, arch) import Data.List (intercalate) import Data.Maybe (fromMaybe) @@ -42,7 +42,8 @@ progname = "hledger" -- -- * Program name, OS and architecture are always shown. -- * The package version is always shown. --- * If there is git info at build time, the latest commit hash and commit date are shown. +-- * If there is git info at build time, the latest commit hash and commit date are shown, +-- and if the working copy has uncommitted changes a + sign is appended. -- * (TODO, requires adding --match support to githash: -- If there are tags matching THISPKG-[0-9]*, the latest one is used to calculate patch level -- (number of commits since tag), and if non-zero, it and the branch name are shown.) @@ -69,7 +70,7 @@ versionStringWith egitinfo prognam packagever = case words $ giCommitDate gitinfo of -- git log's date format is normally --date=default ("similar to --date=rfc2822") _weekday:mon:day:_localtime:year:_offset:_ -> - intercalate "-" [packagever , hash, date] + intercalate "-" $ [packagever, hash, date] ++ ["+" | giDirty gitinfo] where hash = 'g' : take 9 (giHash gitinfo) -- like git describe date = concat [year,mm,dd]