Skip to content

Commit 6eef059

Browse files
committed
wip: commit progress on git manipulation
1 parent 135d5c8 commit 6eef059

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

cmd/readmevalidation/main.go

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,25 @@ func main() {
125125
return
126126
}
127127
activeBranchName := head.Name().Short()
128-
_, err = repo.Reference(plumbing.ReferenceName(activeBranchName), true)
128+
fmt.Println("Found ", activeBranchName)
129+
130+
wt, err := repo.Worktree()
131+
if err != nil {
132+
errChan <- err
133+
return
134+
}
135+
err = wt.Checkout(&git.CheckoutOptions{
136+
Branch: plumbing.ReferenceName(activeBranchName),
137+
Create: false,
138+
Force: false,
139+
Keep: true,
140+
})
129141
if err != nil {
130142
errChan <- err
131143
return
132144
}
145+
146+
fmt.Println("Got here!")
133147
}()
134148

135149
// Validate templates
@@ -142,10 +156,14 @@ func main() {
142156
wg.Wait()
143157
close(errChan)
144158
<-doneChan
159+
if len(readmeValidationErrors) == 0 {
160+
log.Println("All validation was successful")
161+
return
162+
}
163+
164+
fmt.Println("---\nEncountered the following problems")
145165
for _, err := range readmeValidationErrors {
146166
log.Println(err)
147167
}
148-
if len(readmeValidationErrors) != 0 {
149-
os.Exit(1)
150-
}
168+
os.Exit(1)
151169
}

cmd/readmevalidation/repoStructure.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ func validateRepoStructure() error {
9393
problems = append(problems, err)
9494
}
9595

96-
// Todo: figure out what other directories and decide what other invariants
97-
// we want to set for them
96+
// Todo: figure out what other directories we want to make guarantees for
97+
// and add them to this function
9898
if len(problems) != 0 {
9999
return validationPhaseError{
100100
phase: validationPhaseFileStructureValidation,

0 commit comments

Comments
 (0)