diff options
author | Norbert Preining <preining@logic.at> | 2018-02-12 06:49:49 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2018-02-12 06:49:49 +0000 |
commit | d71e945ee716fd18d60a583f8269aa10061ca89a (patch) | |
tree | 49602464405595b3eb32f48c3353d215df31c27d /Master/tlpkg/TeXLive | |
parent | 4ee60ff0756dfc67d4732ca9b3c8e8053120d8da (diff) |
TLTREE: from git: support removed files (don't include them)
git-svn-id: svn://tug.org/texlive/trunk@46608 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLTREE.pm | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/Master/tlpkg/TeXLive/TLTREE.pm b/Master/tlpkg/TeXLive/TLTREE.pm index 6919da3b1cd..977642489aa 100644 --- a/Master/tlpkg/TeXLive/TLTREE.pm +++ b/Master/tlpkg/TeXLive/TLTREE.pm @@ -78,9 +78,10 @@ sub init_from_git { my $svnroot = $self->{'svnroot'}; my $retval = $?; my %files; + my %deletedfiles; my @lines; - my @foo = `cd $svnroot; git log --pretty=format:COMMIT=%h --name-only`; + my @foo = `cd $svnroot; git log --pretty=format:COMMIT=%h --no-renames --name-status`; if ($retval != 0) { $retval /= 256 if $retval > 0; tldie("TLTree: git log in $svnroot returned $retval, stopping.\n"); @@ -97,9 +98,27 @@ sub init_from_git { $rev++; next; } else { - # we only use the first occurrence of $f from the top, - # that is the most recent change - $files{$l} = $rev if (not(defined($files{$l}))); + # output is + # STATUS FILENAME + # where STATUS is as follows: + # Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, + # symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). + if ($l =~ m/^(A|C|D|M|R|T|U|X|B)\S*\s+(.*)$/) { + my $status = $1; + my $curfile = $2; + # + # check whether the file was already removed + if (!defined($files{$curfile}) && !defined($deletedfiles{$curfile})) { + # first occurrence of that file + if ($status eq "D") { + $deletedfiles{$curfile} = 1; + } else { + $files{$curfile} = $rev; + } + } + } else { + print STDERR "Unknown line in git output: >>$l<<\n"; + } } } |