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

[PATCH] git svn : hook before 'git svn dcommit'

From
FHFrédéric Heitzmann <frederic.heitzmann@gmail.com>
Date
Jul 2, 2011, 12:48 UTC
Message-ID
<4E0F1383.8080804@gmail.com>
The 'pre-svn-dcommit' hook si called before 'git svn dcommit', which aborts
if return value is not zero.
---
  git-svn.perl |   19 +++++++++++++++++++
  1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 89f83fd..e70afae 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -396,6 +396,23 @@ sub init_subdir {
         $_repository = Git->repository(Repository => $ENV{GIT_DIR});
  }

+sub pre_svn_dcommit_hook {
+       my $hook = "$ENV{GIT_DIR}/hooks/pre-svn-dcommit";
+       return 0 if ! -e $hook || ! -x $hook;
+
+       system($hook);
+       if ($? == -1) {
+               print "[pre_svn_dcommit_hook] failed to execute $hook: 
$!\n";
+               return 1;
+       } elsif ($? & 127) {
+               printf "[pre_svn_dcommit_hook] child died with signal 
%d, %s coredump\n",
+               ($? & 127),  ($? & 128) ? 'with' : 'without';
+               return 1;
+       } else {
+               return $? >> 8;
+       }
+}
+
  sub cmd_clone {
         my ($url, $path) = @_;
         if (!defined $path &&
@@ -518,6 +535,8 @@ sub cmd_dcommit {
                 command(['checkout', $head], STDERR => 0);
         }

+       return if pre_svn_dcommit_hook();
+
         my @refs;
         my ($url, $rev, $uuid, $gs) = working_head_info('HEAD', \@refs);
         unless ($gs) {
Next: Matthieu Moy
Message 1 of 11 in “git svn : hook before 'git svn dcommit'”
  1. git svn : hook before 'git svn dcommit'Frédéric Heitzmann, Jul 2, 2011
  2. Matthieu MoyJul 2, 2011
  3. Frédéric HeitzmannJul 2, 2011
  4. Matthieu MoyJul 2, 2011
  5. git svn : hook before 'git svn dcommit'Frédéric Heitzmann, Jul 3, 2011
  6. 1/2 git svn : hook before 'git svn dcommit'Frédéric Heitzmann, Jul 3, 2011
  7. 2/2 git svn : documentation of 'pre-svn-dcommit'Frédéric Heitzmann, Jul 3, 2011
  8. Matthieu MoyJul 3, 2011
  9. Frédéric HeitzmannJul 4, 2011
  10. git svn : hook before 'git svn dcommit'Frédéric Heitzmann, Jul 5, 2011
  11. git svn : hook before 'git svn dcommit'Frédéric Heitzmann, Jul 9, 2011

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.