Skip to content

MissingObjectException in repos with git alternates #178

@azolotko

Description

@azolotko

It seems JGit's RevWalk doesn't support Git alternates. This leads to sbt-git being unable to load projects checked out by TeamCity's VCS root that has "Use mirrors" mechanism enabled. For example,

$ pwd
/data/buildagent/work/aee92f3311be76c5

$ ls .git/objects/a8/04e5fbec3088c2890667aa46712c96b02b5dea
ls: cannot access .git/objects/a8/04e5fbec3088c2890667aa46712c96b02b5dea: No such file or directory

$ cat .git/objects/info/alternates
/data/homedir/buildAgent/system/git/git-0C318551.git/objects

$ ls /data/homedir/buildAgent/system/git/git-0C318551.git/objects/a8/04e5fbec3088c2890667aa46712c96b02b5dea
/data/homedir/buildAgent/system/git/git-0C318551.git/objects/a8/04e5fbec3088c2890667aa46712c96b02b5dea
org.eclipse.jgit.errors.MissingObjectException: Missing unknown a804e5fbec3088c2890667aa46712c96b02b5dea
at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:163)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:234)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:859)
at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:772)
at com.typesafe.sbt.git.JGit.$anonfun$headCommitDate$1(JGit.scala:115)
at scala.Option.map(Option.scala:230)
at com.typesafe.sbt.git.JGit.headCommitDate(JGit.scala:114)
at com.typesafe.sbt.SbtGit$.$anonfun$buildSettings$8(SbtGit.scala:117)
at com.typesafe.sbt.git.DefaultReadableGit.withGit(ReadableGit.scala:42)
at com.typesafe.sbt.SbtGit$.$anonfun$buildSettings$7(SbtGit.scala:117)
at scala.Function1.$anonfun$compose$1(Function1.scala:49)
at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:228)
at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:170)
at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87)
at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:99)
at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions