summaryrefslogtreecommitdiff
path: root/0001-filepath.HasPrefix-doesn-t-work.-why-Microsoft-sucks.patch
blob: b1280ca6892beb717de04b8d03f1db9fc924eeab (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
From c7066e1766c9c7bd04358a58312c52eae9637cc1 Mon Sep 17 00:00:00 2001
From: Jeff Carr <[email protected]>
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