All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: "David Tweed" <david.tweed@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: specifying "fast-forward" only in git-pull
Date: Wed, 28 Mar 2007 14:26:39 -0700	[thread overview]
Message-ID: <7vbqidf4a8.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <e1dab3980703281412m78c2481bj9b9f7ec885dbbe4f@mail.gmail.com> (David Tweed's message of "Wed, 28 Mar 2007 22:12:31 +0100")

"David Tweed" <david.tweed@gmail.com> writes:

> Hi, I'm looking through the documentation on git-pull and
> I see that I can specify a particular (sequence of) merge
> strategies, but I can't see a way to say "only do a fast
> forward, stopping if a fast forward doesn't apply".
> (Fast-forward doesn't appear to be a named strategy,
> which is why I can't use it with -s). Is there a way to
> do this?
>
> Rationale: I have a repository on several machines that
> are synchronised via usb-stick. 99.9% of the time a fast
> forward is all that is needed, and for scripting the
> synchronisation I'd like to restrict it so that only
> fast-forwards can happen automatically and everything
> else I have to do by invoking git myself.

Presumably you are scripting around "git pull" and wondering
if there is a way to let you say "git pull -s ffonly $stick".

Why don't you script around "git fetch" instead?

	#!/bin/sh
 	stick=$1
       
	git fetch "$stick"
        not_in_stick=$(git rev-list FETCH_HEAD..HEAD)
        if test -z "$not_in_stick"
        then
        	: stick fast forwards
                git merge FETCH_HEAD
	else
        	echo >&2 "Our HEAD has things the stick does not."
		exit 1
	fi

  reply	other threads:[~2007-03-28 21:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-28 21:12 specifying "fast-forward" only in git-pull David Tweed
2007-03-28 21:26 ` Junio C Hamano [this message]
2007-03-28 21:30 ` Shawn O. Pearce

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=7vbqidf4a8.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=david.tweed@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.