Fix export of subdir of a branch.
Seems I forgot to fully test that feature when documenting it. git rev-parse needs a colon after a branch to de-reference the tree it points to, rather than the commit. But that had it adding an extra colon when the user specified "branch:subdir". So, check if there is a colon before adding one. This commit was sponsored by Francois Marier on Patreon.
This commit is contained in:
parent
edafe8621e
commit
24883e01cd
3 changed files with 21 additions and 2 deletions
|
@ -136,8 +136,13 @@ delete oldvalue ref = run
|
|||
|
||||
{- Gets the sha of the tree a ref uses. -}
|
||||
tree :: Ref -> Repo -> IO (Maybe Sha)
|
||||
tree ref = extractSha <$$> pipeReadStrict
|
||||
[ Param "rev-parse", Param (fromRef ref ++ ":") ]
|
||||
tree (Ref ref) = extractSha <$$> pipeReadStrict
|
||||
[ Param "rev-parse", Param ref' ]
|
||||
where
|
||||
ref' = if ':' `isInfixOf` ref
|
||||
then ref
|
||||
-- de-reference commit objects to the tree
|
||||
else ref ++ ":"
|
||||
|
||||
{- Checks if a String is a legal git ref name.
|
||||
-
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue