Closed sinkovitsd closed 2 weeks ago
Update:
The line that throws the error is this (in pkg/classroom/classroom/go):
return strings.Split(gr.FullName, "/")[1]
Inserting a Printf
, I find that the error is thrown when gr.FullName
is empty.
I'm not sure why this is, but it seems like it may have to do with students who have accepted the assignment but have not pushed it.
Anyway, I was able to insert an if statement into student-repos.go to simply ignore this repository if the name is missing or malformed. The following would be the new lines 93 to 107 of student-repos.go. Perhaps later I'll figure out how to contribute this.
if len(strings.Split(acceptAssignment.Repository.FullName, "/")) > 1 {
clonePath := filepath.Join(fullPath, acceptAssignment.Repository.Name())
if _, err := os.Stat(clonePath); os.IsNotExist(err) {
fmt.Printf("Cloning into: %v\n", clonePath)
_, _, err := gh.Exec("repo", "clone", acceptAssignment.Repository.FullName, "--", clonePath)
totalCloned++
if err != nil {
log.Fatal(err)
return
}
} else {
fmt.Printf("Skip existing repo: %v use gh classroom pull to get new commits\n", clonePath)
}
}
}
I made my contribution a few months back (#59) and may be able to help you move yours along.
fixes #69
in the title or description)Looks like you have Go all set on your end. So your first item is done.
Did you make a fork of this repo when you made your changes or simply a clone? If it was a clone, you cannot sync your changes back. Just make a fork of the repo, apply your changes in the forked repo then commit, sync and PR (pull request) from there.
If you don't know how to make a PR, the easiest way is on the GitHub website after you've synced your commit. There will be a big, inviting banner with a big, unavoidable button 😃 .
Once you've made the PR, the maintainers of this extension are pretty friendly about guiding you along the process.
I'm new to GitHub classroom CLI. It worked flawlessly for the first two assignments, but the third and fourth assignments crash when I try to clone them using
gh classroom clone student-repos
. (The fifth worked fine, oddly.) It doesn't matter if I choose from the menu or explicitly access the assignment by its id. using-a
.What happens is that it clones some number of them but then crashes with a peculiar error:
panic: runtime error: index out of range [1] with length 1
It always crashes in the same place for a particular assignment, but one assignment clones 19 before crashing and the other only clones 4.