git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] prohibit "svn dcommit" on remote-tracking-branches

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 15, 2012, 21:23 UTC
Message-ID
<20120415212358.GA5813@burratino>
In-Reply-To
<20120415185535.GA9150@mathe-macht-spass.de>

(dropping cc to debian bug) Hi Christian,

Christian Engwer wrote:
> a) prohibit commit if a remote-tracking branch is used
> b) allow commit if --commit-url is used
> c) allow commit if the allow-dcommit flag is true in .git/config

As I mentioned before, I really do want to be able to dcommit from my current branch, even if it is not called "master" and is set up, intentionally or not, to pull from a remote git repository. I would be a bit bewildered if git required me to say "yes, please do perform the action I already requested of you" in order to do that, and I do not think I am the only one.

On the other hand, I believe it would be useful to be able to prevent _all_ rebasing on some branches to avoid fat-finger accidents. It would be especially useful for new users who do not know how to recover. This includes the rebasing performed using "git rebase" or "git reset" by "git svn rebase".

Therefore I would be much happier to see git svn learn a pre-dcommit hook (see githooks(5)) that can handle multiple situations than the check that follows the particular policy you have specified above.

That said. I am reluctant to make the following comment because I really would love to have that pre-dcommit hook and I do not want to take away a use case for it. ;-)

Until some interested person introduces a pre-dcommit hook, would it make sense in your deployment to add a wrapper around "git svn dcommit" (let's call it git-commit-to-svn) on the $PATH that performs the check itself, so the user experience would be as follows?

    $ git commit-to-svn
    fatal: this branch is set up to push to git, not to svn
    hint: switch to a new branch before pushing
    hint: or use "git commit-to-svn --force" to override this check

That already works. It does not require any change to git. What do you think?

Just my two cents, Jonathan

Previous: Christian Engwer
Message 5 of 5 in “prohibit "svn dcommit" on remote-tracking-branches”
  1. prohibit "svn dcommit" on remote-tracking-branchesChristian Engwer, Apr 4, 2012
  2. Eric WongApr 10, 2012
  3. Christian EngwerApr 15, 2012
  4. Christian EngwerApr 15, 2012
  5. Jonathan NiederApr 15, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.