zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: <zsh-workers@zsh.org>
Subject: Re: fc -lr broken in current git?
Date: Mon, 30 Apr 2012 13:46:14 +0100	[thread overview]
Message-ID: <20120430134614.2104cda8@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <4F9E806D.9030206@gmail.com>

On Mon, 30 Apr 2012 14:07:09 +0200
Hauke Petersen <hkptrsn@googlemail.com> wrote:
> fc -lr seems to be problematic in current git:

Yes, it doesn't take account of the -r flag.

I wonder if a better fix is only to check the order when actually
executing code, which is where the problems happened.

Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.256
diff -p -u -r1.256 builtin.c
--- Src/builtin.c	7 Mar 2012 06:10:42 -0000	1.256
+++ Src/builtin.c	30 Apr 2012 12:45:12 -0000
@@ -1641,7 +1641,7 @@ static int
 fclist(FILE *f, Options ops, zlong first, zlong last,
        struct asgment *subs, Patprog pprog)
 {
-    int fclistdone = 0;
+    int fclistdone = 0, wrong_order;
     zlong tmp;
     char *s, *tdfmt, *timebuf;
     Histent ent;
@@ -1651,8 +1651,11 @@ fclist(FILE *f, Options ops, zlong first
 	tmp = last;
 	last = first;
 	first = tmp;
+	wrong_order = (last > first);
+    } else {
+	wrong_order = (first > last);
     }
-    if (first > last) {
+    if (wrong_order) {
 	zwarnnam("fc", "history events are in wrong order, aborted");
 	if (f != stdout)
 	    fclose(f);

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog


  reply	other threads:[~2012-04-30 12:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-30 12:07 Hauke Petersen
2012-04-30 12:46 ` Peter Stephenson [this message]
2012-05-03  9:17   ` Peter Stephenson
2012-05-03 15:24     ` Bart Schaefer

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=20120430134614.2104cda8@pwslap01u.europe.root.pri \
    --to=peter.stephenson@csr.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).