[Top][All Lists]

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

Re: VC mode and git

From: Eli Zaretskii
Subject: Re: VC mode and git
Date: Fri, 27 Mar 2015 10:35:46 +0300

> Date: Thu, 26 Mar 2015 23:09:04 -0400
> From: Richard Stallman <address@hidden>
> Cc: address@hidden, address@hidden, address@hidden, address@hidden
>   > Just to elaborate: neither vc-bzr nor vc-git nor vc-hg (the DVCS
>   > interfaces) push on commit but our advertised bzr setup made bzr itself
>   > push on commit by default (because it was a bound branch).
> If Git has no feature comparable to a bound branch, that seems like a defect
> compared with Bzr.

Personally, I agree, but the majority out there don't.  Until a
motivated individual steps forward and adds this to Git, I don't think
we can hope to have such a feature.

> Perhaps we should supply that feature.

You mean, in Emacs?  I don't think we can.  The commit in a bound
branch was committing and pushing atomically, and I don't see how can
you do that by calling two separate Git commands.

>   > In the same way, you could set up a git post-commit hook that pushes if
>   > you wish by placing a scipt with contents
>   > --8<---------------cut here---------------start------------->8---
>   > #!/bin/sh
>   > git push
>   > --8<---------------cut here---------------end--------------->8---
>   > in .git/hooks/post-commit/.
> That recommendation is rather cumbersome compared to our former
> recommendations for Bzr, but that change would be a step up
> in our Git recommendations for people starting with Git.

I don't recommend it, certainly not with this script, for 2 reasons:

  . using the script, the commit+push are not an atomic operation, so
    the commit could succeed, but the following push could fail,
    leaving your repository out of sync

  . it will be hard (or even impossible) to do a local commit without
    pushing, because the hook will always be run; you need the local
    commit for when you merge and resolve conflicts and in other

So, unless someone comes with a smarter hook script that overcomes the
above deficiencies, I strongly recommend against using it.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]