From 116d24d3e32ba262a4068021aa312d908e445ab2 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 7 Nov 2014 11:25:36 -0500 Subject: [PATCH] Ading tests, finding bugs. --- src | 10 +++++++--- srctest | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src b/src index 2bd61c8..380cfcb 100755 --- a/src +++ b/src @@ -363,6 +363,7 @@ class lifted: def commit_method(*args): "Commit changes to files." + args = list(args) comment = None if args[0] == '--': args.pop(0) @@ -370,18 +371,21 @@ def commit_method(*args): commentfp = sys.stdin.read() args.pop(0) elif args[0] == "-m": + args.pop(0) try: - comment = args[1] + comment = args[0] + args.pop(0) except IndexError: croak("commit -m requires a following string.") elif args[0] == "-f": + args.pop(0) try: - comment = open(args[1]).read() + comment = open(args[0]).read() + args.pop(0) except IndexError: croak("commit -f requires a following filename argument.") except OSError: croak("couldn't open %s." % args[1]) - args.pop(0) (revspec, args) = preamble("commit", args) if revspec is not None: croak("commit doesn't take a revision spec") diff --git a/srctest b/srctest index dbc6211..2dd968e 100755 --- a/srctest +++ b/srctest @@ -22,7 +22,10 @@ EOF src add testfile$$ >/dev/null check "add" -src commit -m "First comment" >/dev/null +src commit -m "First comment" >/dev/null testfile$$ check "commit" +src cat testfile$$ | diff testfile$$ - >/dev/null +check "diff" + # end -- 2.43.0