automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-commit] [SCM] GNU Automake branch, maint, updated. v1.11-316-g


From: Peter Rosin
Subject: [Automake-commit] [SCM] GNU Automake branch, maint, updated. v1.11-316-g78992b3
Date: Tue, 01 Mar 2011 07:55:02 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=78992b3411196a4e9e66bffed5a6ab96aa9d648f

The branch, maint has been updated
       via  78992b3411196a4e9e66bffed5a6ab96aa9d648f (commit)
      from  d51e7b79713f909c235c9880f7f62c4b0c0910d0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 78992b3411196a4e9e66bffed5a6ab96aa9d648f
Author: Peter Rosin <address@hidden>
Date:   Tue Mar 1 08:25:24 2011 +0100

    test defs: unindent without temporary file
    
    * tests/defs.in (commented_sed_unindent_prog): Commented Sed program
    that strips the "proper" amount of leading whitespace.
    (unindent): Lazily strip comments from the above program and use it
    to unindent without using a temporary file.
    
    Signed-off-by: Peter Rosin <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog     |    8 ++++++++
 tests/defs.in |   27 +++++++++++++++++++--------
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 47bc9fc..6f67d36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-01  Peter Rosin  <address@hidden>
+
+       test defs: unindent without temporary file
+       * tests/defs.in (commented_sed_unindent_prog): Commented Sed program
+       that strips the "proper" amount of leading whitespace.
+       (unindent): Lazily strip comments from the above program and use it
+       to unindent without using a temporary file.
+
 2011-02-26  Stefano Lattarini  <address@hidden>
 
        libtool: suggest LT_INIT if LTLIBRARIES primary is used
diff --git a/tests/defs.in b/tests/defs.in
index fd0cc9c..2685112 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -440,6 +440,21 @@ AUTOMAKE_fails ()
   AUTOMAKE_run 1 ${1+"$@"}
 }
 
+commented_sed_unindent_prog='
+  /^$/b                    # Nothing to do for empty lines.
+  x                        # Get x<indent> into pattern space.
+  /^$/{                    # No prior x<indent>, go prepare it.
+    g                      # Copy this 1st non-blank line into pattern space.
+    s/^\(['"$tab"' ]*\).*/x\1/   # Prepare x<indent> in pattern space.
+  }                        # Now: x<indent> in pattern and <line> in hold.
+  G                        # Build x<indent>\n<line> in pattern space, and
+  h                        # duplicate it into hold space.
+  s/\n.*$//                # Restore x<indent> in pattern space, and
+  x                        # exchange with the above duplicate in hold space.
+  s/^x\(.*\)\n\1//         # Remove leading <indent> from <line>.
+  s/^x.*\n//               # Restore <line> when there is no leading <indent>.
+'
+
 # unindent [input files...]
 # -------------------------
 # Remove the "proper" amount of leading whitespace from the given files,
@@ -448,14 +463,10 @@ AUTOMAKE_fails ()
 # files.  If no input file is specified, standard input is implied.
 unindent ()
 {
-  cat ${1+"$@"} > deindent.tmp
-  indentation=`sed <deindent.tmp -n "
-    /[^ $tab].*$/{
-      s///p
-      q
-  }"`
-  sed "s/^$indentation//" deindent.tmp
-  rm -f deindent.tmp
+  if test x"$sed_unindent_prog" = x; then
+    sed_unindent_prog=`echo "$commented_sed_unindent_prog" | sed -e "s/  *# 
.*//"`
+  fi
+  sed "$sed_unindent_prog" ${1+"$@"}
 }
 
 # Turn on shell traces.


hooks/post-receive
-- 
GNU Automake



reply via email to

[Prev in Thread] Current Thread [Next in Thread]