summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2018-08-20 00:24:18 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-08-20 00:24:19 +0100
commitd82657683a77446101a644dec66fd0b83d18bf95 (patch)
treebcb8330be414025119cad7495e6c8233c57f8e78
parent849364df60ca1dfedfbd23597fdab6a98881cb19 (diff)
git-debrebase: Provide hints for unprocessable commits
Depending on the apparent branch ffq state. Closes:#905005. In particular, if it doesn't look like this branch was ever used with gdr, suggest that the user is on the wrong branch, or needs to use convert-from-*. Closes:#905279. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rw-r--r--debian/changelog3
-rwxr-xr-xgit-debrebase39
2 files changed, 41 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 058ce00..3fe4ea8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -23,6 +23,9 @@ dgit (6.7~) unstable; urgency=medium
debrebase-last indicate that we are already in gdr format.
* git-debrebase: convert-from-*: leave debrebase-last refs to
hint to everyone that this is now a gdr branch.
+ * git-debrebase: Provide hints for unprocessable commits, depending
+ on the apparent branch ffq state, including possible suggestion
+ to use convert-from-*. Closes:#905005. Closes:#905279.
--
diff --git a/git-debrebase b/git-debrebase
index 484fcdc..4bfe095 100755
--- a/git-debrebase
+++ b/git-debrebase
@@ -441,7 +441,44 @@ sub record_gdrlast ($$;$) {
sub fail_unprocessable ($) {
my ($msg) = @_;
- fail $msg;
+ changedir $maindir;
+ my ($ffqs, $ffqm, $symref, $ffq_prev, $gdrlast) = ffq_prev_branchinfo();
+
+ my $mangled = <<END;
+Branch/history seems mangled - no longer in gdr format.
+See ILLEGAL OPERATIONS in git-debrebase(5).
+END
+ chomp $mangled;
+
+ if (defined $ffqm) {
+ fail <<END;
+$msg
+Is this meant to be a gdr branch? $ffqm
+END
+ } elsif (git_get_ref $ffq_prev) {
+ fail <<END;
+$msg
+$mangled
+Consider git-debrebase scrap, to throw away your recent work.
+END
+ } elsif (!git_get_ref $gdrlast) {
+ fail <<END;
+$msg
+Branch does not seem to be meant to be a git-debrebase branch?
+Wrong branch, or maybe you needed git-debrebase convert-from-*.
+END
+ } elsif (is_fast_fwd $gdrlast, git_rev_parse 'HEAD') {
+ fail <<END;
+$msg
+$mangled
+END
+ } else {
+ fail <<END;
+$msg
+Branch/history mangled, and diverged since last git-debrebase.
+Maybe you reset to, or rebased from, somewhere inappropriate.
+END
+ }
};
sub gbp_pq_export ($$$) {