git.pm 796 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/perl
  2. # git support for dpkg-source
  3. package Dpkg::Source::VCS::git;
  4. use strict;
  5. use warnings;
  6. use Dpkg;
  7. use Dpkg::Gettext;
  8. push (@INC, $dpkglibdir);
  9. require 'controllib.pl';
  10. sub populate_tarball {
  11. my $srcdir=shift;
  12. my $tardir=shift;
  13. # TODO check for uncommitted files
  14. # TODO run git-gc --prune first
  15. # TODO support for creating a shallow clone for those cases where
  16. # uploading the whole repo history is not desired
  17. system("cp -a $srcdir/.git $tardir");
  18. $? && subprocerr("cp -a $srcdir/.git $tardir");
  19. }
  20. sub initialize_repo {
  21. my $srcdir=shift;
  22. # TODO disable git hooks
  23. # XXX git should be made to run in quiet mode here, but
  24. # lacks a good way to do it. Bug filed.
  25. system("cd $srcdir && git-reset --hard");
  26. $? && subprocerr("cd $srcdir && git-reset --hard");
  27. }
  28. 1