v0.7.5 - Miroir depot git et detection fichiers non suivis
Changements : - Detection des fichiers non suivis (untracked) dans chaque depot - Affichage "X fichier(s) en trop" dans le statut - Popup de confirmation listant les fichiers avant suppression (git clean -fd) - Suppression auto des fichiers en trop via "Tout mettre a jour" - Verification du depot distant via git ls-remote avant de proposer le clone - Affichage "Depot introuvable" si l'URL pointe vers un repo inexistant Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
41
git.go
41
git.go
@@ -16,16 +16,18 @@ import (
|
||||
)
|
||||
|
||||
type RepoResult struct {
|
||||
Name string
|
||||
Path string
|
||||
URL string
|
||||
Pending bool
|
||||
UpToDate bool
|
||||
Offline bool
|
||||
NeedsClone bool
|
||||
Error string
|
||||
NewCommits int
|
||||
LocalChanges int
|
||||
Name string
|
||||
Path string
|
||||
URL string
|
||||
Pending bool
|
||||
UpToDate bool
|
||||
Offline bool
|
||||
NeedsClone bool
|
||||
Error string
|
||||
NewCommits int
|
||||
LocalChanges int
|
||||
UntrackedFiles int
|
||||
UntrackedList []string // liste des fichiers non suivis
|
||||
}
|
||||
|
||||
func runGit(args []string, cwd string, timeout time.Duration) (code int, stdout string, stderr string) {
|
||||
@@ -115,10 +117,17 @@ func checkRepo(cfg RepoConfig) RepoResult {
|
||||
|
||||
_, status, _ := runGit([]string{"status", "--porcelain"}, local, 5*time.Second)
|
||||
if status != "" {
|
||||
res.LocalChanges = len(strings.Split(strings.TrimSpace(status), "\n"))
|
||||
for _, line := range strings.Split(strings.TrimSpace(status), "\n") {
|
||||
if strings.HasPrefix(line, "?? ") {
|
||||
res.UntrackedFiles++
|
||||
res.UntrackedList = append(res.UntrackedList, strings.TrimPrefix(line, "?? "))
|
||||
} else {
|
||||
res.LocalChanges++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res.UpToDate = res.NewCommits == 0 && res.LocalChanges == 0
|
||||
res.UpToDate = res.NewCommits == 0 && res.LocalChanges == 0 && res.UntrackedFiles == 0
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -154,6 +163,14 @@ func doCheckout(res RepoResult) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func doClean(res RepoResult) error {
|
||||
code, _, stderr := runGit([]string{"clean", "-fd"}, res.Path, 60*time.Second)
|
||||
if code != 0 {
|
||||
return fmt.Errorf("%s", stderr)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ── Progression Git ───────────────────────────────────────────────────────────
|
||||
|
||||
// ProgressInfo contient l'état de progression d'une opération git.
|
||||
|
||||
Reference in New Issue
Block a user