Sean Whitton writes ("Re: Bug#1108378: git-debpush: should warn for superfluous quilt mode option on command line"): > On Tue 01 Jul 2025 at 02:46pm +01, Ian Jackson wrote: > > But implementing this may be nontrivial. quilt mode archaeology is > > complex, and currently it is allowed to crash whenever it can't figure > > things out. I think this proposal involves distinguishing "something > > is unexpected about the git structure which means that we cannot > > determine the quilt mode automatically" from "something is seriously > > wrong and we should crash even if the user specified --quilt". > > Hmm, I think you must have misread my suggestion.
I don't think so. I think I'm just being Dr Error Handling again... > I just mean that this code: > > > # If the user didn't supply a quilt mode, look for it in a previous > > # tag made by this script > > if [ "x$quilt_mode" = x ] && [ "$format" = "3.0 (quilt)" ]; then > > set +o pipefail # perl will SIGPIPE git-cat-file(1) here > > if [ "x$last_debian_tag" != x ]; then > > quilt_mode=$(git cat-file -p $(git rev-parse "$last_debian_tag") \ > > | perl -wne'/^\[dgit.*--quilt=([a-z+]+).*\]$/ > > or next; > > print "$1\n"; exit') > > fi > > set -o pipefail > > fi > > should be run even if the user *did* supply a quilt mode, and if they > are different it's a failed check. This code can fail due to (for example) the tag named by last_debian_tag not existing, or having weird syntax. In that case, if the user supplied --quilt=, that's silently fine: we failed to check the user's work, but the anomaly is presumably why the user is passing that option. To put it in type threory terms in Rust syntax. Before: fn determine_quilt_mode_automatically(...) -> Result<QuiltMode, FatalError> After: fn determine_quilt_mode_automatically(...) -> Rdsult<Result<QuiltMode, CouldNotDetermineQuiltMode>, FatalError> This means that every program call needs to be considered for whether failure of this program (or perhpas, *this kind* of failure of this program) is "expected" (-> CouldNotDetermineQuiltMode, might be silently ignored) or "unexpedcted" (-> FatalError, always crash). That is doable but it's not trivial. Ian. -- Ian Jackson <ijack...@chiark.greenend.org.uk> These opinions are my own. Pronouns: they/he. If I emailed you from @fyvzl.net or @evade.org.uk, that is a private address which bypasses my fierce spamfilter.