Fix upstream_commitish_search API upstream_commitish_search used to return a commit. If it succeeded The caller could find the tag in $tried[-1]. Both callers relied on this unpleasant and error-prone API. In 0bb8e2a87e3c8b5be0fce5c2491b292e9273056e Dgit::upstream_commitish_search: fail if more than one tag exists the algorithm was changed to keep looking, so it can reject ambiguous situations. The result is that $tried[-1] is entirely wrong in the success case. (This is spotted by the tagupl-baredebian test.) It would have been possible to fix this by making upstream_commitish_search synthesise a suitable return value for putting in $tried, but that is absurd. Instead give this function a sensible calling convention. It now returns a list of the tag name (for messages etc.) and the commitish (for use). Change both call sites. CC: Sean Whitton <spwhitton@spwhitton.name> Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit::upstream_commitish_search: fail if more than one tag exists We should not assume we know which the user wants to merge, as git-deborig does not. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name> Reported-by: David Bremner <bremner@debian.org> Reviewed-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit: Break out $tarball_f_ext_re. We are going to reuse this. No functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-playtree-setup: Rename from git-playtree-create The name is from when I thought it would actually mkdir. But it doesn't. No overall functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: Abolish now-unused $t_local_git_cfg playtree_setup arg This was there so that dgit's -c options would be honoured here. But now, we get this information via @git, which dgit adds -c options to, which we pass to git-playtree-create by invoking it via git. So this is no longer used and can be abolished. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-playtree-setup: Rewrite in shell and call it from Perl We want this because git-debpush is going to want this functionality but doesn't want to include (or have a copy of) Dgit.pm. The installation arrangements are rather ugly. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk> Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Dgit.pm: Provide @git This clears the way for some parts of Dgit.pm to honour dgit's git invocation conventions. No functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Update copyright notices in many files Mostly, adding 2019. Also adding some missing credits to Sean Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: printcmd: Print in one go Sometimes this message is used to report failure of `git fetch' etc. But when such operations fail, they may interleave output from the remote git, which typically prints fatal: The remote end hung up unexpectedly (referring to the local end as the `remote' end, from its point of view), after the the local end printed its message and failed. This sets up a race between Dgit.pm's printcmd and the message from the remote. If we're really unlucky, the remote's message interrupts the output from printcmd. We can avoid the within-line interleaving - at least, the interruption of our message - by printing the whole message in one go, so do that. (Strictly, the approach we use here only ensures that the message appears in a single write(2) call if it fits in the stdio buffer.) One of our test cases (tagupl) depends on this message not being split and has a small chance of failing without this fix. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: resolve_upstream_version: Report tag, where sensible This affect what is show in commit messages (including the parseable parts) made by dgit and git-debrebase. Now they prefer to refer to the tag name if the caller specified refs/tags/ and the tag name is a nice one. This is not expected to make much difference for human callers (who will probably not explicitly qualify their tag refs). But it will make a difference for scripts. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: reflog_cache_insert: Use ensurepath for the reflog Otherwise quilt fixup can fail in a too-fresh git tree. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: Provide `ensurepath' Like `ensuredir' but also a bit like a more controlled `mkdir -p'. We use make_path from File::Path. It dies on failure. No caller yet. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: Move $suite_re from dgit Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: read_tree_*: Treat '' as meaning 'delete this' No functional change with existing callers. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: resolve_upstream_version: Return a message too No functional change for existing callers. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: Move hash_commit from dgit No functional change other than to no longer honour @git. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: Move make_commit (git-commit-tree wrapper) from gdr No functional change other than to no longer honour @git. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Rename various *make_commit* to *hash_commit* This avoids a subroutine name clash with make_commit in gdr. No functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: Move read-tree wrappers from git-debrebase No functional change other than to no longer honour @git. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Dgit.pm: Move resolve_upstream_version from git-debrebase No functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>