git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Haber <mh+git@zugschlus.de>
To: git@vger.kernel.org
Subject: Re: How to check repository/working tree status from a script
Date: Sat, 23 May 2009 22:39:26 +0200	[thread overview]
Message-ID: <20090523203926.GA24004@torres.zugschlus.de> (raw)
In-Reply-To: <20090521153745.GA23463@coredump.intra.peff.net>

On Thu, May 21, 2009 at 11:37:45AM -0400, Jeff King wrote:
> 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.

I slowly begin to grasp how git works. Thanks for enlightening.

> 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`"

if ! git fetch origin; then
  echo >&2 "unable to fetch"
  exit 1
fi
if git rev-list -1 master..origin/master | grep -q . ; then
  echo >&2 "unmerged changes on remote repository"
  exit 1
fi

Works fine. Thanks.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 3221 2323190

Bitte beachten Sie, daß dem [m.E. grundgesetzwidrigen] Gesetz zur
Vorratsdatenspeicherung zufolge, seit dem 1. Januar 2008 jeglicher
elektronische Kontakt (E-Mail, Telefongespräche, SMS, Internet-
Telefonie, Mobilfunk, Fax) mit mir oder anderen Nutzern verdachts-
unabhängig für den automatisierten geheimen Zugriff durch Strafver-
folgungs- u. Polizeivollzugsbehörden, die Bundesanstalt für Finanz-
dienstleistungsaufsicht, Zollkriminal- und Zollfahndungsämter,die
Zollverwaltung zur Schwarzarbeitsbekämpfung, Notrufabfragestellen,
Verfassungsschutzbehörden, den Militärischen Abschirmdienst, Bundes-
nachrichtendienst sowie 52 Staaten wie beispielsweise Aserbeidschan
oder die USA sechs Monate lang gespeichert wird, einschließlich der
Kommunikation mit Berufsgeheimnisträgern wie Ärzten, Journalisten und
Anwälten. Mehr Infos zur totalen Protokollierung Ihrer Kommunikations-
daten auf www.vorratsdatenspeicherung.de. (leicht verändert übernommen
kopiert von www.lawblog.de)

      reply	other threads:[~2009-05-23 20:39 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
2009-05-23 20:39     ` Marc Haber [this message]

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=20090523203926.GA24004@torres.zugschlus.de \
    --to=mh+git@zugschlus.de \
    --cc=git@vger.kernel.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.
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).