Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package glow for openSUSE:Factory checked in 
at 2023-06-14 16:31:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/glow (Old)
 and      /work/SRC/openSUSE:Factory/.glow.new.15902 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "glow"

Wed Jun 14 16:31:25 2023 rev:3 rq:1093089 version:1.5.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/glow/glow.changes        2023-06-04 
16:42:59.706269905 +0200
+++ /work/SRC/openSUSE:Factory/.glow.new.15902/glow.changes     2023-06-14 
16:32:35.051664916 +0200
@@ -1,0 +2,7 @@
+Tue Jun 13 13:54:56 UTC 2023 - Soc Virnyl Estela <[email protected]>
+
+- Add fix-gitignore-bypass.patch.
+  * This patch will fix where setting `--all` to see hidden files
+    does not work for gitignore-ed files.
+
+-------------------------------------------------------------------

New:
----
  fix-gitignore-bypass.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ glow.spec ++++++
--- /var/tmp/diff_new_pack.jzPpNh/_old  2023-06-14 16:32:36.315672685 +0200
+++ /var/tmp/diff_new_pack.jzPpNh/_new  2023-06-14 16:32:36.319672711 +0200
@@ -36,6 +36,7 @@
 Source2:        README.suse-maint.md
 #
 Patch1:         fix-for-go-117.patch
+Patch2:         
https://patch-diff.githubusercontent.com/raw/charmbracelet/glow/pull/504.patch#/fix-gitignore-bypass.patch
 BuildRequires:  golang-packaging
 BuildRequires:  zstd
 BuildRequires:  golang(API) >= 1.17

++++++ fix-gitignore-bypass.patch ++++++
>From f2fc75e04cb80239cb499be19b74484f039f4e2f Mon Sep 17 00:00:00 2001
From: aitva <[email protected]>
Date: Fri, 26 May 2023 15:00:57 +0200
Subject: [PATCH] fix: --all bypass .gitignore rules (#285)

---
 ui/filesearch.go | 86 ++++++++++++++++++++++++++++++++++++++++++++++++
 ui/ui.go         | 13 ++++----
 2 files changed, 93 insertions(+), 6 deletions(-)
 create mode 100644 ui/filesearch.go

diff --git a/ui/filesearch.go b/ui/filesearch.go
new file mode 100644
index 00000000..4dd86c0e
--- /dev/null
+++ b/ui/filesearch.go
@@ -0,0 +1,86 @@
+package ui
+
+import (
+       "os"
+       "path/filepath"
+       "strings"
+
+       "github.com/muesli/gitcha"
+)
+
+type searchResult struct {
+       Path string
+       Info os.FileInfo
+}
+
+// findFilesExcept search a folder returns the files matching the pattern in
+// list. It excludes files matching the rules from .gitignore or pattern in
+// ignorePatterns.
+func findFilesExcept(path string, list []string, ignorePatterns []string) 
(chan searchResult, error) {
+       tmpCh, err := gitcha.FindFilesExcept(path, list, ignorePatterns)
+       if err != nil {
+               return nil, err
+       }
+
+       ch := make(chan searchResult)
+       go func() {
+               for tmp := range tmpCh {
+                       ch <- searchResult{
+                               Path: tmp.Path,
+                               Info: tmp.Info,
+                       }
+               }
+       }()
+
+       return ch, nil
+}
+
+// findFiles search a folder recursively and returns files matching the pattern
+// in list.
+func findFiles(path string, list []string) (chan searchResult, error) {
+       path, err := filepath.Abs(path)
+       if err != nil {
+               return nil, err
+       }
+       path, err = filepath.EvalSymlinks(path)
+       if err != nil {
+               return nil, err
+       }
+       st, err := os.Stat(path)
+       if err != nil {
+               return nil, err
+       }
+       if !st.IsDir() {
+               return nil, err
+       }
+
+       ch := make(chan searchResult)
+       go func() {
+               defer close(ch)
+
+               _ = filepath.Walk(path, func(path string, info os.FileInfo, err 
error) error {
+                       for _, v := range list {
+                               matched := 
strings.EqualFold(filepath.Base(path), v)
+                               if !matched {
+                                       matched, _ = 
filepath.Match(strings.ToLower(v), strings.ToLower(filepath.Base(path)))
+                               }
+
+                               if matched {
+                                       res, err := filepath.Abs(path)
+                                       if err == nil {
+                                               ch <- searchResult{
+                                                       Path: res,
+                                                       Info: info,
+                                               }
+                                       }
+
+                                       // only match each path once
+                                       return nil
+                               }
+                       }
+                       return nil
+               })
+       }()
+
+       return ch, nil
+}
diff --git a/ui/ui.go b/ui/ui.go
index df7e37f8..67387c4e 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -72,7 +72,7 @@ type (
        keygenSuccessMsg       struct{}
        initLocalFileSearchMsg struct {
                cwd string
-               ch  chan gitcha.SearchResult
+               ch  chan searchResult
        }
 )
 
@@ -176,7 +176,7 @@ type model struct {
 
        // Channel that receives paths to local markdown files
        // (via the github.com/muesli/gitcha package)
-       localFileFinder chan gitcha.SearchResult
+       localFileFinder chan searchResult
 }
 
 // unloadDocument unloads a document from the pager. Note that while this
@@ -505,12 +505,13 @@ func findLocalFiles(m model) tea.Cmd {
                        log.Println("local directory is:", cwd)
                }
 
-               var ignore []string
-               if !m.common.cfg.ShowAllFiles {
-                       ignore = ignorePatterns(m)
+               var ch chan searchResult
+               if m.common.cfg.ShowAllFiles {
+                       ch, err = findFiles(cwd, markdownExtensions)
+               } else {
+                       ch, err = findFilesExcept(cwd, markdownExtensions, 
ignorePatterns(m))
                }
 
-               ch, err := gitcha.FindFilesExcept(cwd, markdownExtensions, 
ignore)
                if err != nil {
                        if debug {
                                log.Println("error finding local files:", err)

Reply via email to