Jay Soffian <jaysoffian@xxxxxxxxx> writes: >> We might instead want to add a hook that is called from cherry-pick (and >> rebase will get a similar one) immediately after the command creates a new >> commit out of another commit, so that people can record the correspondence >> in notes namespace if they choose to. > > Hmfph. So I know some folks don't like polluting log messages (e.g., > the git-svn-id footer, or apparently, the cherry-pick -x message),... That reminds me of a slightly related topic. I've been running git-svn to follow (but never build) a project without metadata, exactly because I do not want the log message contamination. I am having a hard time mapping the commit object name back to the upstream subversion serial number. I ended up using this hacky script for that. It finds the svn uuid from the metadata file, and then finds ".rev_map.$uuid" files from all over the place to see if any of them contains a record that points at the git commit I am interested in. I really wish "git svn" has a built-in way to do something like that; perhaps I didn't look hard enough. -- >8 -- #!/usr/bin/perl -w use strict; use Carp qw/croak/; use Fcntl qw/:DEFAULT :seek/; use constant rev_map_fmt => 'NH40'; use File::Find; my $uuid = `git config -f .git/svn/.metadata svn-remote.svn.uuid`; chomp($uuid); # remotes/trunk sub find_version { my ($name, $sha1) = @_; my ($fh, $size); if (!sysopen($fh, "$name/.rev_map.$uuid", O_RDONLY)) { return undef; } if (!binmode $fh) { close($fh); return undef; } $size = (stat($fh))[7]; if (($size % 24) != 0) { close($fh); return undef; } while (sysread($fh, my $buf, 24) == 24) { my ($rev, $commit) = unpack(rev_map_fmt, $buf); if ($sha1 eq $commit) { close($fh); return $rev; } } close($fh); return undef; } my $top = ".git/svn/refs"; my $commit = $ARGV[0] || "HEAD"; my $sha1 = `git rev-parse $commit`; chomp($sha1); my $found; sub match_svn_revision { if (-f "$_/.rev_map.$uuid") { my $it = "$File::Find::dir/$_"; $it =~ s|^\Q$top\E/||; my $v = find_version($_, $sha1); if ($v) { $found = [$it, $v]; } $File::Find::prune = 1; } if ($found) { $File::Find::prune = 1; } } File::Find::find(\&match_svn_revision, $top); if ($found) { my ($origin, $rev) = @$found; $origin =~ s|^remotes/||; $origin =~ s|/|-|g; if ($origin eq 'trunk') { $origin = ''; } else { $origin = "-$origin"; } print "$rev$origin\n"; } -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html