Fix task assingment
Change-Id: Id6df2c34fae9e2ae283819ddbdb972cc60464abf
diff --git a/server/tm/git_tm/git_task_manager.go b/server/tm/git_tm/git_task_manager.go
index 6a8735e..5c43828 100644
--- a/server/tm/git_tm/git_task_manager.go
+++ b/server/tm/git_tm/git_task_manager.go
@@ -29,7 +29,7 @@
return &GitTaskManager{
git: git,
repoPath: repoPath,
- tasksDir: filepath.Join(repoPath, "tasks"),
+ tasksDir: repoPath,
logger: logger,
}
}
@@ -42,7 +42,7 @@
return &GitTaskManager{
git: git,
repoPath: repoPath,
- tasksDir: filepath.Join(repoPath, "tasks"),
+ tasksDir: repoPath,
logger: logger,
}
}
@@ -229,17 +229,21 @@
}
// commitTaskChange commits a task change to git
-func (gtm *GitTaskManager) commitTaskChange(taskID, operation string) error {
+func (gtm *GitTaskManager) commitTaskChange(taskID, operation string, owner tm.Owner) error {
ctx := context.Background()
// Add the task file
- if err := gtm.git.Add(ctx, []string{filepath.Join("tasks", taskID+".md")}); err != nil {
+ if err := gtm.git.Add(ctx, []string{filepath.Join(gtm.tasksDir, taskID+".md")}); err != nil {
return fmt.Errorf("failed to add task file: %w", err)
}
// Commit the change
message := fmt.Sprintf("task: %s - %s", taskID, operation)
- if err := gtm.git.Commit(ctx, message, git.CommitOptions{}); err != nil {
+ if err := gtm.git.Commit(ctx, message, git.CommitOptions{
+ Author: &git.Author{
+ Name: owner.Name,
+ },
+ }); err != nil {
return fmt.Errorf("failed to commit task change: %w", err)
}
@@ -286,7 +290,7 @@
}
// Commit to git
- if err := gtm.commitTaskChange(taskID, "created"); err != nil {
+ if err := gtm.commitTaskChange(taskID, "created", task.Owner); err != nil {
return nil, err
}
@@ -363,7 +367,7 @@
}
// Commit to git
- if err := gtm.commitTaskChange(id, "updated"); err != nil {
+ if err := gtm.commitTaskChange(id, "updated", task.Owner); err != nil {
return nil, err
}