From 6db4aee7df8f8fb92a870268b8bb60d02e332df2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 7 Jan 2020 12:29:37 -0400 Subject: [PATCH] use --no-abbrev instead of --abbrev=40 This avoids hardcoding the sha size, so when git uses sha256, it will output the full sha256 and not a truncation to 40 characters. I reviewed git's history, and while there have been some bugs with commands not supporting --no-abbrev (eg git diff --no-index --no-abbrev was broken in git 2.1), none of the commands git-annex uses will be impacted by those old bugs. --- Command/Log.hs | 2 +- Database/Keys.hs | 2 +- Git/DiffTree.hs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Command/Log.hs b/Command/Log.hs index 861229183f..397e6068d3 100644 --- a/Command/Log.hs +++ b/Command/Log.hs @@ -215,7 +215,7 @@ getGitLog fs os = do , Param "-z" , Param "--pretty=format:%ct" , Param "--raw" - , Param "--abbrev=40" + , Param "--no-abbrev" ] ++ os ++ [ Param $ Git.fromRef Annex.Branch.fullname , Param "--" diff --git a/Database/Keys.hs b/Database/Keys.hs index afbe7191d5..1c0858e50a 100644 --- a/Database/Keys.hs +++ b/Database/Keys.hs @@ -260,7 +260,7 @@ reconcileStaged qh = do , Param "--cached" , Param "--raw" , Param "-z" - , Param "--abbrev=40" + , Param "--no-abbrev" -- Optimization: Only find pointer files. This is not -- perfect. A file could start with this and not be a -- pointer file. And a pointer file that is replaced with diff --git a/Git/DiffTree.hs b/Git/DiffTree.hs index f87504ad0c..bfd1a7a1bc 100644 --- a/Git/DiffTree.hs +++ b/Git/DiffTree.hs @@ -77,14 +77,14 @@ diffFiles = getdiff (Param "diff-files") - is adjusted to be the same as diff-tree --raw._-} diffLog :: [CommandParam] -> Repo -> IO ([DiffTreeItem], IO Bool) diffLog params = getdiff (Param "log") - (Param "-n1" : Param "--abbrev=40" : Param "--pretty=format:" : params) + (Param "-n1" : Param "--no-abbrev" : Param "--pretty=format:" : params) {- Uses git show to get the changes made by a commit. - - Does not support merge commits, and will fail on them. -} commitDiff :: Sha -> Repo -> IO ([DiffTreeItem], IO Bool) commitDiff ref = getdiff (Param "show") - [ Param "--abbrev=40", Param "--pretty=", Param "--raw", Param (fromRef ref) ] + [ Param "--no-abbrev", Param "--pretty=", Param "--raw", Param (fromRef ref) ] getdiff :: CommandParam -> [CommandParam] -> Repo -> IO ([DiffTreeItem], IO Bool) getdiff command params repo = do