Make a temporary clone of the repository
Dependencies
- [2]
RFMRCLJXRemove empty parentheses after author name - [3]
RTQQLOCOUse real metadata, but no content yet - [4]
Y7VFVY6EInitial dummy version
Change contents
- edit in main.go at line 9
"path/filepath" - replacement in main.go at line 14
var repo = flag.String("repo", "", "path of the repository to export")var repo = flag.String("repo", ".", "path of the repository to export") - edit in main.go at line 35
func printErrorAndExit(description string, err error) {fmt.Fprintf(os.Stderr, "%T\n", err)msg := err.Error()if err, ok := err.(*exec.ExitError); ok && len(err.Stderr) > 0 {msg = string(err.Stderr)}fmt.Fprintln(os.Stderr, description, msg)os.Exit(2)} - replacement in main.go at line 48
if *repo != "" {err := os.Chdir(*repo)if err != nil {fmt.Fprintf(os.Stderr, "Error changing to directory of source repository: %v\n", err)os.Exit(2)}// Make a clone of the repository to work with, so that we don't mess up the original.tempDir, err := os.MkdirTemp("", "")if err != nil {printErrorAndExit("Error creating temporary directory:", err)}tempRepo := filepath.Join(tempDir, "repo")_, err = exec.Command("pijul", "clone", *repo, tempRepo).Output()if err != nil {printErrorAndExit("Error cloning the repository:", err)}if err := os.Chdir(tempRepo); err != nil {printErrorAndExit("Error changing to the clone of the repository:", err) - replacement in main.go at line 64
logCmd := exec.Command("pijul", "log", "--description", "--output-format=json")logBytes, err := logCmd.Output()logBytes, err := exec.Command("pijul", "log", "--description", "--output-format=json").Output() - replacement in main.go at line 66
fmt.Fprintf(os.Stderr, "Error running pijul log: %v\n", err)os.Exit(2)printErrorAndExit("Error running pijul log:", err) - replacement in main.go at line 72
fmt.Fprintf(os.Stderr, "Error parsing pijul log output: %v\n", err)os.Exit(2)printErrorAndExit("Error parsing pijul log output:", err) - edit in main.go at line 91
if !strings.Contains(author, "<") {author = "<" + author + ">"} - edit in main.go at line 108
}if err := os.RemoveAll(tempDir); err != nil {printErrorAndExit("Error removing temporary directory:", err)