blob: ae1e92ab784dd48a78b31b4a0b0420b7a0c29c02 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>
package git2c
import "fmt"
func (c *Client) InitRepo(repoPath, hooksPath string) error {
if err := c.writer.WriteData([]byte(repoPath)); err != nil {
return fmt.Errorf("sending repo path failed: %w", err)
}
if err := c.writer.WriteUint(15); err != nil {
return fmt.Errorf("sending command failed: %w", err)
}
if err := c.writer.WriteData([]byte(hooksPath)); err != nil {
return fmt.Errorf("sending hooks path failed: %w", err)
}
status, err := c.reader.ReadUint()
if err != nil {
return fmt.Errorf("reading status failed: %w", err)
}
if status != 0 {
return Perror(status)
}
return nil
}
|