Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH 2/2] vcs_info quilt: Pass patch subject lines to gen-applied-string



Daniel Shahaf wrote on Thu, Oct 22, 2015 at 12:30:57 +0000:
> The format used is '${patchname} ${subject}', which is analogous to the
> git backend.
> ---
> This seems to work with both Debian and Fedora source packages.  In
> Debian the first line sometimes starts with "Description:" (DEP-3 format
> patches); perhaps that prefix should be removed, but for now I've erred
> on the side of conservatism and left the first line unmunged.

I've updated the patch to fix a few problems:

- Fix filtering of (---|Index:) — the condition was always false
- Don't leak error to terminal if the patch file doesn't exist
  (eg after 'quilt new')
- Add "?" as subject if the patch has none

Interdiff:

diff -u b/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt
--- b/Functions/VCS_Info/VCS_INFO_quilt
+++ b/Functions/VCS_Info/VCS_INFO_quilt
@@ -149,14 +149,28 @@
       () {
         local i line
         for ((i=1; i<=$#applied; i++)); do
-          read -r line < "$patches/$applied[$i]" &&
-          [[ line != (#b)(---|Index:) ]] &&
+          if [[ -f "$patches/$applied[$i]" ]] &&
+             read -r line < "$patches/$applied[$i]" &&
+             [[ $line != (#b)(---|Index:)* ]] &&
+             true
+            ;
+          then
             applied[$i]+=" $line"
+          else
+            applied[$i]+=" ?"
+          fi
         done
         for ((i=1; i<=$#unapplied; i++)); do
-          read -r line < "$patches/$unapplied[$i]" &&
-          [[ line != (#b)(---|Index:) ]] &&
+          if [[ -f "$patches/$unapplied[$i]" ]] &&
+             read -r line < "$patches/$unapplied[$i]" &&
+             [[ $line != (#b)(---|Index:)* ]] &&
+             true
+            ;
+          then
             unapplied[$i]+=" $line"
+          else
+            unapplied[$i]+=" ?"
+          fi
         done
       }
     fi



Messages sorted by: Reverse Date, Date, Thread, Author