App-Git-Autofixup
view release on metacpan or search on metacpan
git-autofixup view on Meta::CPAN
lines => $lines,
});
# The next line after a hunk could be a header for the next commit
# or hunk.
redo if defined $line;
}
}
return @hunks;
}
# Dequote and unescape filenames that appear in diff output.
#
# If the filename is otherwise "normal" but contains spaces it's followed by a
# trailing tab, and if it contains uncommon control characters or non-ASCII
# characters, then the filename gets surrounded in double-quotes and non-ASCII
# characters get replaced with octal escape sequences.
#
# For details about exactly what gets quoted, see the sq_lookup array in
# git/quote.c.
#
# Assume --no-prefix or similar has been used and the diff doesn't include
# src/dst prefixes.
sub dequote_diff_filename {
$_ = shift;
s/\t$//m; # Remove trailing tab.
if (startswith($_, '"')) {
s/^"|"$//gm; # Remove surrounding quotes.
# Replace octal and control character escapes.
s/\\((?:\d{3})|(?:[abtnvfr"\\]))/"qq(\\$1)"/eeg;
}
return $_;
}
sub git_cmd {
return ('git', @GIT_OPTIONS, @_);
}
# With a linear git history there'll be a single merge base that's easy to
( run in 0.409 second using v1.01-cache-2.11-cpan-c21f80fb71c )