Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-githash for openSUSE:Factory 
checked in at 2021-10-12 21:48:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-githash (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-githash.new.2443 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-githash"

Tue Oct 12 21:48:58 2021 rev:7 rq:921706 version:0.1.6.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-githash/ghc-githash.changes  2021-07-05 
22:22:54.245757179 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-githash.new.2443/ghc-githash.changes        
2021-10-12 21:50:17.243951951 +0200
@@ -1,0 +2,12 @@
+Mon Sep 20 07:11:36 UTC 2021 - [email protected]
+
+- Update githash to version 0.1.6.2.
+  ## 0.1.6.2
+
+  * Fixed bugs; now this library's Template Haskell functions are much more
+    likely on recompilation to detect Git update that doesn't affect workspace:
+    e.g. `git switch -c <new_branch>` (equivalently
+    `git checkout -b <new_branch>`) and `git commit --amend --only`.
+    Implemented in [#23](https://github.com/snoyberg/githash/pull/23).
+
+-------------------------------------------------------------------

Old:
----
  githash-0.1.6.1.tar.gz

New:
----
  githash-0.1.6.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-githash.spec ++++++
--- /var/tmp/diff_new_pack.BCoLPi/_old  2021-10-12 21:50:17.755952684 +0200
+++ /var/tmp/diff_new_pack.BCoLPi/_new  2021-10-12 21:50:17.759952690 +0200
@@ -19,7 +19,7 @@
 %global pkg_name githash
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.1.6.1
+Version:        0.1.6.2
 Release:        0
 Summary:        Compile git revision info into Haskell projects
 License:        BSD-3-Clause

++++++ githash-0.1.6.1.tar.gz -> githash-0.1.6.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/githash-0.1.6.1/ChangeLog.md 
new/githash-0.1.6.2/ChangeLog.md
--- old/githash-0.1.6.1/ChangeLog.md    2021-06-23 12:29:50.000000000 +0200
+++ new/githash-0.1.6.2/ChangeLog.md    2021-09-19 07:27:50.000000000 +0200
@@ -1,5 +1,13 @@
 # ChangeLog for githash
 
+## 0.1.6.2
+
+* Fixed bugs; now this library's Template Haskell functions are much more
+  likely on recompilation to detect Git update that doesn't affect workspace:
+  e.g. `git switch -c <new_branch>` (equivalently
+  `git checkout -b <new_branch>`) and `git commit --amend --only`.
+  Implemented in [#23](https://github.com/snoyberg/githash/pull/23).
+
 ## 0.1.6.1
 
 * [Support template-haskell 2.17](https://github.com/snoyberg/githash/pull/22)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/githash-0.1.6.1/githash.cabal 
new/githash-0.1.6.2/githash.cabal
--- old/githash-0.1.6.1/githash.cabal   2021-06-23 12:30:12.000000000 +0200
+++ new/githash-0.1.6.2/githash.cabal   2021-09-19 07:27:57.000000000 +0200
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           githash
-version:        0.1.6.1
+version:        0.1.6.2
 synopsis:       Compile git revision info into Haskell projects
 description:    Please see the README and documentation at 
<https://www.stackage.org/package/githash>
 category:       Development
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/githash-0.1.6.1/src/GitHash.hs 
new/githash-0.1.6.2/src/GitHash.hs
--- old/githash-0.1.6.1/src/GitHash.hs  2021-06-23 12:29:01.000000000 +0200
+++ new/githash-0.1.6.2/src/GitHash.hs  2021-09-19 07:27:50.000000000 +0200
@@ -63,6 +63,7 @@
 import qualified Data.ByteString as B
 import qualified Data.ByteString.Char8 as B8
 import Data.Typeable (Typeable)
+import Data.Word (Word8)
 import Language.Haskell.TH
 import Language.Haskell.TH.Syntax
 import Language.Haskell.TH.Syntax.Compat
@@ -130,6 +131,23 @@
 
 -- | Get a list of files from within a @.git@ directory.
 getGitFilesRegular :: FilePath -> IO [FilePath]
+-- [Note: Current implementation's limitation]
+-- the current implementation doesn't work right if:
+-- 1. the current branch's name contains Non-ASCII character (due to 
@B8.unpack@),
+-- 2. the current branch is only in .git/packed-refs, or
+-- 3. the current branch is a symbolic ref to another reference.
+-- In these cases, the file with the name `ref` in the following
+-- code cannot be found in the filesystem (in the cases 1 & 2),
+-- or can be found but will not be updated on commit (in the case 3).
+-- As a result, if a module uses @tGitInfo@ as TH macro
+-- and the target git repo is in one of the conditions 1--3
+-- at the time of compilation, content-change-free commits will fail to
+-- trigger recompilation.
+--
+-- [Note: reftable]
+-- In the near future, the technology called reftable may replace the
+-- Git's reference management. This function's implementation does not
+-- work with reftable, and therefore will need to be updated.
 getGitFilesRegular git = do
   -- a lot of bookkeeping to record the right dependencies
   let hd         = git </> "HEAD"
@@ -144,12 +162,12 @@
       Right hdRef -> do
         -- the HEAD file either contains the hash of a detached head
         -- or a pointer to the file that contains the hash of the head
-        case B.splitAt 5 hdRef of
+        case B.splitAt 5 $ B.takeWhile (not . isSmallASCIIControl) hdRef of
           -- pointer to ref
           ("ref: ", relRef) -> do
             let ref = git </> B8.unpack relRef
             refExists <- doesFileExist ref
-            return $ if refExists then [ref] else []
+            return $ if refExists then [hd,ref] else [hd]
           -- detached head
           _hash -> return [hd]
   -- add the index if it exists to set the dirty flag
@@ -162,6 +180,15 @@
   let files3 = if packedExists then [packedRefs] else []
 
   return $ concat [files1, files2, files3]
+  where
+    -- This is to quickly strip newline characters
+    -- from the content of .git/HEAD.
+    -- Git references don't include ASCII control char bytes:
+    -- 0x00 -- 0x1F and 0x7F.
+    -- .git/HEAD may contain some ASCII control bytes LF (0xA) and
+    -- CR (0xD) before EOF, which should be ignored.
+    isSmallASCIIControl :: Word8 -> Bool
+    isSmallASCIIControl = (<0x20)
 
 -- | Get a list of dependent files from a @.git@ file representing a
 -- git-worktree.

Reply via email to