fix git 1.7.7 breakage

* This version of git-annex only works with git 1.7.7 and newer.
  The breakage with old versions is subtle, and affects
  annex.numcopies .gitattributes settings, so be sure to upgrade git
  to 1.7.7. (Debian package now depends on that version.)
* Don't pass absolute paths to git show-attr, as it started following
  symlinks when that's done in 1.7.7. Instead, use relative paths,
  which show-attr only handles 100% correctly in 1.7.7. Closes: #645046

Unfortunatly I can find no way to work with the old and new gits, as
the old had bugs that require absolute paths, while the new doesn't like
them at all. And the behavior of git show-attr in 1.7.7. is the same as
eg, git add of an absolute path to a symlink, so seems entirely
intentional and not likely to change.
This commit is contained in:
Joey Hess 2011-10-11 22:52:55 -04:00
parent b505ba83e8
commit 9c04d1e523
3 changed files with 35 additions and 17 deletions

19
Git.hs
View file

@ -547,36 +547,23 @@ configMap = config
{- Efficiently looks up a gitattributes value for each file in a list. -}
checkAttr :: Repo -> String -> [FilePath] -> IO [(FilePath, String)]
checkAttr repo attr files = do
-- git check-attr wants files that are absolute (or relative to the
-- top of the repo). But we're passed files relative to the current
-- directory. Convert to absolute, and then convert the filenames
-- in its output back to relative.
cwd <- getCurrentDirectory
let top = workTree repo
let absfiles = map (absPathFrom cwd) files
(_, fromh, toh) <- hPipeBoth "git" (toCommand params)
_ <- forkProcess $ do
hClose fromh
hPutStr toh $ join "\0" absfiles
hPutStr toh $ join "\0" files
hClose toh
exitSuccess
hClose toh
s <- hGetContents fromh
return $ map (topair cwd top) $ lines s
(map topair . lines) <$> hGetContents fromh
where
params = gitCommandLine repo [Param "check-attr", Param attr, Params "-z --stdin"]
topair cwd top l = (relfile, value)
topair l = (file, value)
where
relfile
| startswith cwd' file = drop (length cwd') file
| otherwise = relPathDirToFile top' file
file = decodeGitFile $ join sep $ take end bits
value = bits !! end
end = length bits - 1
bits = split sep l
sep = ": " ++ attr ++ ": "
cwd' = cwd ++ "/"
top' = top ++ "/"
{- Some git commands output encoded filenames. Decode that (annoyingly
- complex) encoding. -}

31
debian/changelog vendored
View file

@ -1,5 +1,6 @@
git-annex (3.20110929) UNRELEASED; urgency=low
<<<<<<<
* Fix referring to remotes by uuid.
* New or changed repository descriptions in uuid.log now have a timestamp,
which is used to ensure the newest description is used when the uuid.log
@ -21,6 +22,36 @@ git-annex (3.20110929) UNRELEASED; urgency=low
* Add locking to avoid races when changing the git-annex branch.
* Various speed improvements gained by using ByteStrings.
* Contain the zombie hordes.
=======
* This version of git-annex only works with git 1.7.7 and newer.
The breakage with old versions is subtle, and affects
annex.numcopies .gitattributes settings, so be sure to upgrade git
to 1.7.7. (Debian package now depends on that version.)
* Don't pass absolute paths to git show-attr, as it started following
symlinks when that's done in 1.7.7. Instead, use relative paths,
which show-attr only handles 100% correctly in 1.7.7. Closes: #645046
* Various speed improvements gained by using ByteStrings.
* Fix referring to remotes by uuid.
* status: List all known repositories.
* When displaying a list of repositories, show git remote names
in addition to their descriptions.
* Contain the zombie hordes.
* Add locking to avoid races when changing the git-annex branch.
* New or changed repository descriptions in uuid.log now have a timestamp,
which is used to ensure the newest description is used when the uuid.log
has been merged.
* Note that older versions of git-annex will display the timestamp as part
of the repository description, which is ugly but otherwise harmless.
* Add timestamps to trust.log and remote.log too.
* git-annex-shell: Added the --uuid option.
* git-annex now asks git-annex-shell to verify that it's operating in
the expected repository.
* Note that this git-annex will not interoperate with remotes using
older versions of git-annex-shell.
* Now supports git's insteadOf configuration, to modify the url
used to access a remote. Note that pushInsteadOf is not used;
that and pushurl are reserved for actual git pushes. Closes: #644278
>>>>>>>
-- Joey Hess <joeyh@debian.org> Thu, 29 Sep 2011 18:58:53 -0400

2
debian/control vendored
View file

@ -29,7 +29,7 @@ Package: git-annex
Architecture: any
Section: utils
Depends: ${misc:Depends}, ${shlibs:Depends},
git | git-core,
git (>= 1:1.7.7),
uuid,
rsync,
wget | curl,