git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Theodore Tso <tytso@mit.edu>
Cc: Junio C Hamano <junkio@cox.net>, git <git@vger.kernel.org>
Subject: Re: git push to a non-bare repository
Date: Sun, 18 Mar 2007 23:47:55 -0400	[thread overview]
Message-ID: <20070319034755.GH20658@spearce.org> (raw)
In-Reply-To: <20070319033340.GG11371@thunk.org>

Theodore Tso <tytso@mit.edu> wrote:
> Ah, so that's controlled by receive.denyNonFastForwards, right?  Cool,
> I missed that.  Thanks!!
> 
> Documentation/config.txt doesn't say it defaults to true, but from
> your comments that is the default?

Ah, my bad, it defaults to false:

  static int deny_non_fast_forwards = 0;

I should have known better, as I run a 1.5.x (aka 'next') server
for a workgroup and I never have that set, but use instead a complex
update hook that decides if a fast-forward is required or not.
 
> > > 	* Only accept the push if there are no locally modified files
> > > 		that would be affected when the working directory is
> > > 		updated to reflect the new HEAD
> > 
> > If git-runstatus exits to indicate the tree is clean (nothing to
> > commit) then a simple `read-tree -m -u HEAD $new` should update
> > the working directory and index, right?
> 
> What git-runstatus will allow me to do is to abort if there are any
> local modifications, regardless of whether or not they would conflict
> with the working tree update.  The key phrase in my criteria was no
> locally modified files "THAT WOULD BE AFFECTED".

  git-diff $old $new | git-apply --index ?

If the patch does not apply, nothing gets updated.  If it does apply,
the index is also updated and stat data updated.

OK, it doesn't quite handle every case, as sometimes a patch will
reject but the internal 3-way merge from xdiff that is called by
merge-recursive will succeed, but this does protect your working
tree and doesn't require making a temporary copy.


Of course another possible approach is to stuff the entire working
directory into a temporary tree, and then merge.  If the merge
doesn't work, you can reset to the temporary tree.  Unfortunately the
working directory is "in flux" during that process... its not atomic.

-- 
Shawn.

  reply	other threads:[~2007-03-19  3:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-18 17:31 git push to a non-bare repository Matthieu Moy
2007-03-18 19:47 ` Junio C Hamano
2007-03-18 21:51   ` Sam Vilain
2007-03-18 22:01     ` Jakub Narebski
2007-03-18 22:18     ` Junio C Hamano
2007-03-19  2:00 ` Theodore Tso
2007-03-19  1:55   ` Junio C Hamano
2007-03-19  2:21     ` Shawn O. Pearce
2007-03-19  2:47       ` Theodore Tso
2007-03-19  2:56         ` Shawn O. Pearce
2007-03-19  3:21           ` Theodore Tso
2007-03-19  3:53             ` Shawn O. Pearce
2007-03-19  4:08               ` Nicolas Pitre
2007-03-19  6:25                 ` Theodore Tso
2007-03-19  6:44                   ` Junio C Hamano
2007-03-19 15:20                     ` Nicolas Pitre
2007-03-19 15:16                   ` Nicolas Pitre
2007-03-19 23:58               ` Sam Vilain
2007-03-20  0:49                 ` Junio C Hamano
2007-03-20  0:54                   ` Junio C Hamano
2007-03-19  3:33           ` Theodore Tso
2007-03-19  3:47             ` Shawn O. Pearce [this message]
2007-03-19  4:14               ` Junio C Hamano
2007-03-19  9:19   ` Matthieu Moy
2007-03-19 10:01     ` Jakub Narebski
2007-03-21 17:20     ` Neil Schemenauer
2007-03-19 12:44 ` Sergio Callegari

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=20070319034755.GH20658@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=tytso@mit.edu \
    /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).