chiark / gitweb /
dgit: clean: Do check the tree even when building in playtree
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Jan 2019 02:15:31 +0000 (02:15 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Jan 2019 13:36:45 +0000 (13:36 +0000)
If we might be doing quilt fixup, then the quilt fixup's attempt to
merge back into master might fail if there are uncommitted
debian/patches.  So it is sometimes wrong to just not clean at all.

We don't want the behaviour to depend on the source package format,
and ideally not on the clean mode.

Also, the user may have forgotten to `git add', in which case they
will thank us for spotting their mistake.

In the original design table in
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910705#56
says this for this case
/: disregarded
   would be fine to delete but
   ** better to trip ? **
** want opt to disregard **
but this was not implemented at the time.

So implement that now.

I think I have concluded that with -wg and -wgf the right way to turn
these new failures into successes is to have a way to have the clean
actually done.  If that is not wanted, one can say -wn instead.

This is particularly true given that ignoring the problem can produce
confusing failure, as seen in #914317.

So there will be a new --clean=git[-ff],always shortly.

Closes: #914317
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit
tests/lib-build-modes

diff --git a/dgit b/dgit
index 55c8070163c118f3925110785964ee2f1bb9ce88..22441d7e4b704d39da004c2a08dd30d6db4c3b2a 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -6238,7 +6238,6 @@ END
 }
 
 sub clean_tree_check () {
-    # Not yet fully implemented.
     # This function needs to not care about modified but tracked files.
     # That was done by check_not_dirty, and by now we may have run
     # the rules clean target which might modify tracked files (!)
@@ -6249,9 +6248,8 @@ sub clean_tree_check () {
        clean_tree_check_git_wd __
  "tree contains uncommitted files (NB dgit didn't run rules clean)";
     } elsif ($cleanmode =~ m{^git}) {
-       # If we were actually cleaning these files would be summarily
-       # deleted.  Since we're not, and not using the working tree
-       # anyway, we can just ignore them - nothing will use them.
+       clean_tree_check_git_wd __
+ "tree contains uncommitted files";
     } elsif ($cleanmode eq 'none') {
     } else {
        confess "$cleanmode ?";
index bc8b2aa8113a670072573a0d5381d1f9b671ab93..8c05af6f0cb4636d6e36e31916bb04a829dabfc4 100644 (file)
@@ -160,7 +160,7 @@ bm-compute-expected () {
                        ;;
        none|Cnone)     ;;
        Cdpkg-source*)  ;; # handled below
-       Cgit|Cgit-ff)   ;;
+       Cgit|Cgit-ff)   echo >&4 'BUILD-MODES PROGRAM git clean -dn' ;;
        *)              fail "t-compute-expected-run $cleanmode ??" ;;
        esac