Re: git-log to go forward instead of reverse?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



merlyn@xxxxxxxxxxxxxx (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 ;-)



-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]