wip: commit progress on git manipulation

This commit is contained in:
Michael Smith 2025-04-16 01:58:36 +00:00
parent 135d5c8111
commit 6eef059e21
2 changed files with 24 additions and 6 deletions

View File

@ -125,11 +125,25 @@ func main() {
return
}
activeBranchName := head.Name().Short()
_, err = repo.Reference(plumbing.ReferenceName(activeBranchName), true)
fmt.Println("Found ", activeBranchName)
wt, err := repo.Worktree()
if err != nil {
errChan <- err
return
}
err = wt.Checkout(&git.CheckoutOptions{
Branch: plumbing.ReferenceName(activeBranchName),
Create: false,
Force: false,
Keep: true,
})
if err != nil {
errChan <- err
return
}
fmt.Println("Got here!")
}()
// Validate templates
@ -142,10 +156,14 @@ func main() {
wg.Wait()
close(errChan)
<-doneChan
if len(readmeValidationErrors) == 0 {
log.Println("All validation was successful")
return
}
fmt.Println("---\nEncountered the following problems")
for _, err := range readmeValidationErrors {
log.Println(err)
}
if len(readmeValidationErrors) != 0 {
os.Exit(1)
}
os.Exit(1)
}

View File

@ -93,8 +93,8 @@ func validateRepoStructure() error {
problems = append(problems, err)
}
// Todo: figure out what other directories and decide what other invariants
// we want to set for them
// Todo: figure out what other directories we want to make guarantees for
// and add them to this function
if len(problems) != 0 {
return validationPhaseError{
phase: validationPhaseFileStructureValidation,