chiark / gitweb /
dgit: Do not generate bogus commits
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 4 Jan 2017 21:47:53 +0000 (21:47 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 4 Jan 2017 22:11:08 +0000 (22:11 +0000)
There were two places in the code where ill-formed commits were
generated: both psedumerges.

One is in dgit import-dsc, a fairly minor problem.

The other is in --overwrite and is very bad because that's an
important option.

Nothing in git seems to notice, unless you run git-fsck.  Even a git
server does not, by default.  However, some other popular git servers
do reject these broken commits.

I have tested this changes with git-fsck (by using the test suite
patches which follow in this series) and now everything seems fine.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index 1e7c923eea6e8070b3f2254af6f8a85570d05aa4..9d3584fb7e0abd96b420e70a3f24def0b78ee20e 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -3538,7 +3538,7 @@ tree $tree
 parent $dgitview
 parent $archive_hash
 author $authline
-commiter $authline
+committer $authline
 
 $msg_msg
 
@@ -5944,10 +5944,14 @@ END
            progress "Import, merging.";
            my $tree = cmdoutput @git, qw(rev-parse), "$newhash:";
            my $version = getfield $dsc, 'Version';
+           my $clogp = commit_getclogp $newhash;
+           my $authline = clogp_authline $clogp;
            $newhash = make_commit_text <<END;
 tree $tree
 parent $newhash
 parent $oldhash
+author $authline
+committer $authline
 
 Merge $package ($version) import into $dstbranch
 END