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 return
} }
activeBranchName := head.Name().Short() activeBranchName := head.Name().Short()
_, err = repo.Reference(plumbing.ReferenceName(activeBranchName), true) fmt.Println("Found ", activeBranchName)
wt, err := repo.Worktree()
if err != nil { if err != nil {
errChan <- err errChan <- err
return 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 // Validate templates
@ -142,10 +156,14 @@ func main() {
wg.Wait() wg.Wait()
close(errChan) close(errChan)
<-doneChan <-doneChan
if len(readmeValidationErrors) == 0 {
log.Println("All validation was successful")
return
}
fmt.Println("---\nEncountered the following problems")
for _, err := range readmeValidationErrors { for _, err := range readmeValidationErrors {
log.Println(err) 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) problems = append(problems, err)
} }
// Todo: figure out what other directories and decide what other invariants // Todo: figure out what other directories we want to make guarantees for
// we want to set for them // and add them to this function
if len(problems) != 0 { if len(problems) != 0 {
return validationPhaseError{ return validationPhaseError{
phase: validationPhaseFileStructureValidation, phase: validationPhaseFileStructureValidation,