remote tailing 's' from log --raw-data
authorJoey Hess <joeyh@joeyh.name>
Thu, 4 May 2023 15:53:38 +0000 (11:53 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 4 May 2023 15:53:38 +0000 (11:53 -0400)
log: When --raw-date is used, display only seconds from the epoch, as
documented, omitting a trailing "s" that was included in the output
before.

Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
CHANGELOG
Command/Log.hs

index d3de618e969890ce0ffb47e08f53b95e7b281585..5a8daf83a46fe82ffcd04ed771be4685329b9b54 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -38,6 +38,9 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
   * initremote: Avoid creating a remote that is not encrypted when gpg is
     broken.
   * rmurl, unannex: Support --json and --json-error-messages.
+  * log: When --raw-date is used, display only seconds from the epoch, as
+    documented, omitting a trailing "s" that was included in the output
+    before.
 
  -- Joey Hess <id@joeyh.name>  Sat, 08 Apr 2023 13:57:18 -0400
 
index 869090f4263cb5631f6a6b8fabdd64d0ca8fc512..e7079b11fc0f6f14cad5aee9f7ff1f46046c5ce0 100644 (file)
@@ -162,7 +162,7 @@ showLog outputter cs = forM_ cs $ \c -> do
 
 mkOutputter :: UUIDDescMap -> TimeZone -> LogOptions -> FilePath -> Outputter
 mkOutputter m zone o file
-       | rawDateOption o = normalOutput lookupdescription file show
+       | rawDateOption o = normalOutput lookupdescription file rawTimeStamp
        | gourceOption o = gourceOutput lookupdescription file
        | otherwise = normalOutput lookupdescription file (showTimeStamp zone)
   where
@@ -292,3 +292,6 @@ parseTimeStamp = utcTimeToPOSIXSeconds . fromMaybe (giveup "bad timestamp") .
 showTimeStamp :: TimeZone -> POSIXTime -> String
 showTimeStamp zone = formatTime defaultTimeLocale rfc822DateFormat 
        . utcToZonedTime zone . posixSecondsToUTCTime
+
+rawTimeStamp :: POSIXTime -> String
+rawTimeStamp t = filter (/= 's') (show t)