Patchwork [1,of,7] tests: fix a bug in `f` that prevented calculating sha1sum on a file

login
register
mail settings
Submitter Matt Harbison
Date Dec. 21, 2017, 8:39 p.m.
Message ID <8675cce538f01075e9ef.1513888783@Envy>
Download mbox | patch
Permalink /patch/26385/
State Accepted
Headers show

Comments

Matt Harbison - Dec. 21, 2017, 8:39 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1513820472 18000
#      Wed Dec 20 20:41:12 2017 -0500
# Node ID 8675cce538f01075e9ef13c521d5c9db3e59e6f3
# Parent  44fd4cfc6c0ad3107cacad10c76ed38bd74948f4
tests: fix a bug in `f` that prevented calculating sha1sum on a file

Patch

diff --git a/tests/f b/tests/f
--- a/tests/f
+++ b/tests/f
@@ -59,7 +59,7 @@ 
         if isfile:
             if opts.type:
                 facts.append('file')
-            if opts.hexdump or opts.dump or opts.md5:
+            if opts.hexdump or opts.dump or opts.md5 or opts.sha1:
                 content = open(f, 'rb').read()
         elif islink:
             if opts.type:
diff --git a/tests/test-tools.t b/tests/test-tools.t
--- a/tests/test-tools.t
+++ b/tests/test-tools.t
@@ -38,6 +38,9 @@ 
   $ f foo
   foo:
 
+  $ f --sha1 foo
+  foo: sha1=f1d2d2f924e986ac86fdf7b36c94bcdf32beec15
+
 #if symlink
   $ f foo --mode
   foo: mode=644