readTicketDescriptionForRepo function
Reads the ticket description for the repository at repoDir, or null
when the repository is not part of a ticket.
The ticket.json file lives in the ticket folder, which is an ancestor of
the repository (<ticket>/<org>/<repo>), so the ancestors are walked upward
until a ticket.json file answers or the filesystem root is reached.
Implementation
String? readTicketDescriptionForRepo(Directory repoDir) {
var current = repoDir.absolute;
while (true) {
final description = readTicketDescription(current);
if (description != null) {
return description;
}
final parent = current.parent;
if (parent.path == current.path) {
return null;
}
current = parent;
}
}