git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Marc Haber <mh+git@zugschlus.de>
Cc: git@vger.kernel.org
Subject: Re: How to check repository/working tree status from a script
Date: Thu, 21 May 2009 11:37:45 -0400	[thread overview]
Message-ID: <20090521153745.GA23463@coredump.intra.peff.net> (raw)
In-Reply-To: <20090521132457.GB5625@torres.zugschlus.de>

On Thu, May 21, 2009 at 03:24:57PM +0200, Marc Haber wrote:

> I am now looking for a solution for (b). I tried 
> 
> git log -n1 --pretty=oneline master..origin/master
> 
> but that seems to always give empty output even if a later issued git
> pull will actually pull in changes.

Try running "git fetch" beforehand, which will actually update
origin/master with what is on the remote.

Also, if you are just checking to see whether there is any output, you
can use the plumbing "git rev-list" instead of "git log". So something
like:

  git fetch origin || { echo >&2 unable to fetch; exit 1; }
  test -z "`git rev-list -1 master..origin/master`"

-Peff

  reply	other threads:[~2009-05-21 15:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-19 14:35 How to check repository/working tree status from a script Marc Haber
2009-05-19 15:34 ` Tony Finch
2009-05-19 16:00   ` Marc Haber
2009-05-19 16:16     ` Tony Finch
2009-05-20 14:28       ` Marc Haber
2009-05-19 16:18     ` Linus Torvalds
2009-05-19 16:29       ` Linus Torvalds
2009-05-20 14:27         ` Marc Haber
2009-05-20 11:10       ` Marc Haber
2009-05-20 11:19         ` Santi Béjar
2009-05-20 11:32         ` Johannes Sixt
2009-05-20 14:29           ` Marc Haber
2009-05-21 13:24 ` Marc Haber
2009-05-21 15:37   ` Jeff King [this message]
2009-05-23 20:39     ` Marc Haber

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=20090521153745.GA23463@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=mh+git@zugschlus.de \
    /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).