git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: merlyn@stonehenge.com (Randal L. Schwartz)
Cc: git@vger.kernel.org
Subject: Re: git-log to go forward instead of reverse?
Date: Mon, 10 Jul 2006 13:26:11 -0700	[thread overview]
Message-ID: <7vpsgdb40s.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <86mzbhntxu.fsf@blue.stonehenge.com> (Randal L. Schwartz's message of "10 Jul 2006 12:25:33 -0700")

merlyn@stonehenge.com (Randal L. Schwartz) writes:

> Well, this is for a "I'm connected to the net right now: please
> refresh all of my git mirrors" script:
>
>         ## (code here to cd to the right dir omitted)
>                 git-fetch
>                 if git-status | grep -v 'nothing to commit'

git-status exits non-zero for "nothing to commit" case, so do
not grep its output, but check the status of the command, to see
if your tree is in a good shape to do a pull.

>                 then echo UPDATE SKIPPED
>                 else
>                     if git-pull . origin | egrep -v 'up-to-date'
>                     then git-log --pretty=short ORIG_HEAD..HEAD | cat
>                     fi
>                 fi
>
> The log is just so I can quickly eyeball the interesting changes.

Do we not leave ORIG_HEAD when we are already up-to-date?  If so
that would be confusing...  No, we do leave ORIG_HEAD no matter
what, so you do not have to have this inner if to grep
up-to-date (on the other hand, you might want to do intelligent
things when git-pull fails).  So just drop the if and say
something like:

	else
        	PAGER= ; export PAGER
                git pull . origin &&
                git log --pretty ORIG_HEAD..HEAD |
                git shortlog
	fi

> The "cat"
> is to keep git-log from starting a pager.  (If there's a switch that does
> *that* that I've overlooked, that'd be good too.)

BTW,

        PAGER=cat
        export PAGER

This should work as more efficiently -- see pager.c ;-)

  parent reply	other threads:[~2006-07-10 20:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-10 18:42 git-log to go forward instead of reverse? Randal L. Schwartz
2006-07-10 19:01 ` Linus Torvalds
2006-07-10 19:06   ` Randal L. Schwartz
2006-07-10 19:20     ` Linus Torvalds
2006-07-10 19:25       ` Randal L. Schwartz
2006-07-10 20:09         ` Linus Torvalds
2006-07-10 20:16           ` Randal L. Schwartz
2006-07-10 21:45           ` Junio C Hamano
2006-07-10 20:26         ` Junio C Hamano [this message]
2006-07-10 20:31           ` Randal L. Schwartz
2006-07-10 19:26       ` Linus Torvalds

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=7vpsgdb40s.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=merlyn@stonehenge.com \
    /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.
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).