From 70d24c03026c8148eee3ae5ae92407214b02cb64 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 9 Mar 2020 13:31:51 -0400 Subject: [PATCH] add a comment about CWD While git ls-files can actually be used on a repo that is not in the cwd, it works inconsistently. For example, this fails: git --git-dir=../foo/.git --work-tree=../foo ls-files ../foo But change some of the paths to absolute and it will succeed. That seems like a bug in git. OTOH, this succeeds: git --git-dir=../foo/.git --work-tree=../foo ls-files But, that lists paths relative to the top of the --work-tree, rather than the usual listing them relative to the cwd. Because the cwd is not in the repo. And so anything parsing the ls-files output of that is likely to operate on files in the wrong location. Indeed, there is code in Upgrade/ that has this problem! --- CHANGELOG | 2 ++ Git/LsFiles.hs | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 43994931e1..201726b428 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,8 @@ git-annex (8.20200227) UNRELEASED; urgency=medium * git-annex config: Only allow configs be set that are ones git-annex actually supports reading from repo-global config, to avoid confusion. * Linux standalone: Use md5sum to shorten paths in .cache/git-annex/locales + * Fix a problem in auto-upgrade of a clone to v8 that caused a + message "fatal: is outside repository". -- Joey Hess Thu, 27 Feb 2020 00:44:11 -0400 diff --git a/Git/LsFiles.hs b/Git/LsFiles.hs index 952e997ea6..29d4ca3918 100644 --- a/Git/LsFiles.hs +++ b/Git/LsFiles.hs @@ -40,7 +40,13 @@ import System.Posix.Types import qualified Data.Map as M import qualified Data.ByteString.Lazy as L -{- Scans for files that are checked into git's index at the specified locations. -} +{- Lists files that are checked into git's index at the specified paths. + - With no paths, all files are listed. + - + - Paths are relative to the CWD. So this should only be used on the + - current Repo, not on clones. (Same goes for all the rest of this + - module!) + -} inRepo :: [RawFilePath] -> Repo -> IO ([RawFilePath], IO Bool) inRepo = inRepo' []