wrong path. funcknuts
This commit is contained in:
parent
c7066e1766
commit
f2ba4cab9c
|
@ -0,0 +1,121 @@
|
||||||
|
From c7066e1766c9c7bd04358a58312c52eae9637cc1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeff Carr <jcarr@wit.com>
|
||||||
|
Date: Fri, 27 Dec 2024 23:03:00 -0600
|
||||||
|
Subject: [PATCH] filepath.HasPrefix() doesn't work. why? Microsoft sucks
|
||||||
|
|
||||||
|
for those of you that are new here and care about
|
||||||
|
writing free software. this is something to remind you
|
||||||
|
to NEVER EVER EVER trust Microsoft to do anything but
|
||||||
|
try to make things worse. The are opposed and will always
|
||||||
|
be opposed to making Linux work. The suck and are horrible
|
||||||
|
villians in this story. Never trust them and do not
|
||||||
|
support them. Always use the GPL vs BSD license for this
|
||||||
|
reason also. They will steal anything BSD and use it
|
||||||
|
in their proprietary products and not give anything back
|
||||||
|
to anyone. They are complete jerks.
|
||||||
|
---
|
||||||
|
patch.Make.go | 70 ++++++++-------------------------------------------
|
||||||
|
1 file changed, 11 insertions(+), 59 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/patch.Make.go b/patch.Make.go
|
||||||
|
index cca74c4..97d325d 100644
|
||||||
|
--- a/patch.Make.go
|
||||||
|
+++ b/patch.Make.go
|
||||||
|
@@ -102,67 +102,16 @@ func (pset *Patchs) makePatchSetNew(repo *gitpb.Repo) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
- return pset.addPatchFiles(repoDir)
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-// var pset *Patchs
|
||||||
|
-
|
||||||
|
-func (f *Forge) MakePatchSet() (*Patchs, error) {
|
||||||
|
- pset := new(Patchs)
|
||||||
|
- dir, err := os.MkdirTemp("", "forge")
|
||||||
|
- if err != nil {
|
||||||
|
- return nil, err
|
||||||
|
- }
|
||||||
|
- defer os.RemoveAll(dir) // clean up
|
||||||
|
-
|
||||||
|
- all := f.Repos.SortByFullPath()
|
||||||
|
- for all.Scan() {
|
||||||
|
- repo := all.Next()
|
||||||
|
- userb := repo.GetUserBranchName()
|
||||||
|
- develb := repo.GetDevelBranchName()
|
||||||
|
-
|
||||||
|
- if develb == "" {
|
||||||
|
- continue
|
||||||
|
- }
|
||||||
|
- if userb == "" {
|
||||||
|
- continue
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- repoDir := filepath.Join(dir, repo.GetGoPath())
|
||||||
|
- err := os.MkdirAll(repoDir, 0755)
|
||||||
|
- if err != nil {
|
||||||
|
- return nil, err
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- // git format-patch branch1..branch2
|
||||||
|
- cmd := []string{"git", "format-patch", "-o", repoDir, develb + ".." + userb}
|
||||||
|
- r := repo.Run(cmd)
|
||||||
|
- if r.Error != nil {
|
||||||
|
- log.Info("git format-patch", repo.FullPath)
|
||||||
|
- log.Info("git format-patch", cmd)
|
||||||
|
- log.Info("git format-patch error", r.Error)
|
||||||
|
- return nil, r.Error
|
||||||
|
- }
|
||||||
|
- if r.Exit != 0 {
|
||||||
|
- log.Info("git format-patch", repo.FullPath)
|
||||||
|
- log.Info("git format-patch", cmd)
|
||||||
|
- log.Info("git format-patch exit", r.Exit)
|
||||||
|
- return nil, r.Error
|
||||||
|
- }
|
||||||
|
- if len(r.Stdout) == 0 {
|
||||||
|
- continue
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- pset.addPatchFiles(repoDir)
|
||||||
|
- }
|
||||||
|
- return pset, nil
|
||||||
|
+ return pset.addPatchFiles(repo.GetGoPath())
|
||||||
|
}
|
||||||
|
|
||||||
|
// process each file in pDir/
|
||||||
|
-func (p *Patchs) addPatchFiles(pDir string) error {
|
||||||
|
- // log.Info("ADD PATCH FILES ADDED DIR", pDir)
|
||||||
|
+func (p *Patchs) addPatchFiles(psetDir string) error {
|
||||||
|
+ tmpDir := p.TmpDir
|
||||||
|
+ log.Info("ADD PATCH FILES ADDED DIR", tmpDir)
|
||||||
|
+ fullDir := filepath.Join(tmpDir, psetDir)
|
||||||
|
var baderr error
|
||||||
|
- filepath.Walk(pDir, func(path string, info os.FileInfo, err error) error {
|
||||||
|
+ filepath.Walk(fullDir, func(path string, info os.FileInfo, err error) error {
|
||||||
|
if err != nil {
|
||||||
|
// Handle possible errors, like permission issues
|
||||||
|
fmt.Fprintf(os.Stderr, "error accessing path %q: %v\n", path, err)
|
||||||
|
@@ -173,7 +122,10 @@ func (p *Patchs) addPatchFiles(pDir string) error {
|
||||||
|
if info.IsDir() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
- // log.Info("TESTING FILE", path)
|
||||||
|
+ log.Info("IS THIS A FULL PATH ?", path)
|
||||||
|
+ log.Info("trim this from path ?", fullDir)
|
||||||
|
+ log.Info("trim this from path ?", psetDir)
|
||||||
|
+ log.Info("trim this from path ?", tmpDir)
|
||||||
|
data, err := os.ReadFile(path)
|
||||||
|
if err != nil {
|
||||||
|
log.Info("addPatchFile() failed", path)
|
||||||
|
@@ -181,7 +133,7 @@ func (p *Patchs) addPatchFiles(pDir string) error {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
patch := new(Patch)
|
||||||
|
- patch.Filename = path
|
||||||
|
+ patch.Filename = psetDir
|
||||||
|
patch.Data = data
|
||||||
|
p.Patchs = append(p.Patchs, patch)
|
||||||
|
// log.Info("ADDED PATCH FILE", path)
|
||||||
|
--
|
||||||
|
2.45.2
|
||||||
|
|
|
@ -133,10 +133,10 @@ func (p *Patchs) addPatchFiles(psetDir string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
patch := new(Patch)
|
patch := new(Patch)
|
||||||
patch.Filename = psetDir
|
patch.Filename, _ = filepath.Rel(p.TmpDir, path)
|
||||||
patch.Data = data
|
patch.Data = data
|
||||||
p.Patchs = append(p.Patchs, patch)
|
p.Patchs = append(p.Patchs, patch)
|
||||||
// log.Info("ADDED PATCH FILE", path)
|
log.Info("ADDED PATCH FILE", path)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
return baderr
|
return baderr
|
||||||
|
|
Loading…
Reference in New Issue