From: Per Cederqvist <cederp@opera•com>
To: Jeff Sipek <jeffpc@josefsipek•net>
Cc: git@vger•kernel.org
Cc: ceder@lysator•liu.se
Subject: [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation.
Date: Wed, 14 Mar 2012 14:34:38 +0100 [thread overview]
Message-ID: <87399bpaq9.fsf@opera.com> (raw)
Fix the compatibility function sha1 so that it reads from
stdin (and not a file with a zero-length file name) when
no argument is supplied.
Signed-off-by: Per Cederqvist <cederp@opera•com>
---
os.Darwin | 7 ++++++-
os.Linux | 7 ++++++-
os.SunOS | 7 ++++++-
3 files changed, 18 insertions(+), 3 deletions(-)
Note: I have tested both versions of the sha1 function, but only on
Linux as I don't have access to a Mac.
/ceder
diff --git a/os.Darwin b/os.Darwin
index 470f5fb..acf6b68 100644
--- a/os.Darwin
+++ b/os.Darwin
@@ -27,7 +27,12 @@ head_n()
# usage: sha1 [file]
sha1()
{
- openssl dgst -sha1 "$1" | sed "s,SHA1.\(.*\).= \(.*\),\2 \1,"
+ if [ $# = 1 ]
+ then
+ openssl dgst -sha1 "$1" | sed "s,SHA1.\(.*\).= \(.*\),\2 \1,"
+ else
+ openssl dgst -sha1 | sed 's,$, -,'
+ fi
}
# usage: cp_a <src> <dst>
diff --git a/os.Linux b/os.Linux
index 30b9cb0..aaebf88 100644
--- a/os.Linux
+++ b/os.Linux
@@ -30,7 +30,12 @@ head_n()
# usage: sha1 [file]
sha1()
{
- sha1sum "$1"
+ if [ $# = 1 ]
+ then
+ sha1sum "$1"
+ else
+ sha1sum
+ fi
}
# usage: cp_a <src> <dst>
diff --git a/os.SunOS b/os.SunOS
index 30b9cb0..aaebf88 100644
--- a/os.SunOS
+++ b/os.SunOS
@@ -30,7 +30,12 @@ head_n()
# usage: sha1 [file]
sha1()
{
- sha1sum "$1"
+ if [ $# = 1 ]
+ then
+ sha1sum "$1"
+ else
+ sha1sum
+ fi
}
# usage: cp_a <src> <dst>
--
1.7.9
next reply other threads:[~2012-03-14 13:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-14 13:34 Per Cederqvist [this message]
2012-03-14 14:21 ` [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation Jeff Sipek
2012-03-14 14:27 ` Andreas Schwab
2012-03-15 8:42 ` Per Cederqvist
2012-03-15 9:49 ` Andreas Schwab
2012-03-15 9:56 ` John Szakmeister
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87399bpaq9.fsf@opera.com \
--to=cederp@opera$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=jeffpc@josefsipek$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox