From nobody Mon Feb 13 06:15:45 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PFYxF4RRrz3rBmm; Mon, 13 Feb 2023 06:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PFYxF3vmqz4FkM; Mon, 13 Feb 2023 06:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676268945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JWl/2Q5mj331yPe9grSN3jYaC2yLjpKlNLrCa+sZEHk=; b=rYNwbXCjtq4QteEin00OsGdN4DhNWX7GSH/sxHskzJHtps3i/UOldlsI46iExR1rKYW/VU VbxWewP4ino0YKb3LVnIo+TsSsq6VrmsebBxgaKEY5zsMojg5pkqjkBprF4tVJ7wVRLVuj fpvV+9ni6UqSDAhUiPj58QKsg33G5vdeaVim9f9pQgWPMmpFlS8UPZi7mlYfHBntwAjnw4 OVnyBq19C3vWQvcTFuvHDrwkoHkhdyl6Pd1clzdp8p8az0ktW2yqKmeXRC6u+jXbomG6nL urQtrr6SEjV40ynfZTfBrYSziI85j1SCagmgMQUGZJmGPZKDA1tEmbpaGoSiOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676268945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JWl/2Q5mj331yPe9grSN3jYaC2yLjpKlNLrCa+sZEHk=; b=QX8fx3tSpP8GKpymRheddruzuiiSFuNKd7EJVg/V+x0FMrkHFR+3vU6ju4dtkxbqhFpdyJ a2uy/x1sdbK9sovFIDqXYIlLOHjKACKm+rlwS/2mebdrgVcjluK/wd2UHMTjebOl2+DOcA jDe/wo0EFmejm0SoLfYlfOGagt6tUN2iP1V4IN4Bdlv4MQErvpmVWZLoEMGgY4kwABxILf tsL+gQznV/ORXcRPrV/LdMI6ZQm9jxkfA+nGtQxLAU7Uci7isHzvqoEFegSgni3pIwObnY qmAWYjhOrWESIOGJ4Scd5z9QosqasuM257nwyT8cMJQSgymlqtOomDDqUxq4nw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676268945; a=rsa-sha256; cv=none; b=lHTtMk60m1tZkLuFPI5QeWhNcZpweKEy4h/a5LjspkwKvTlKcKEoy4C5CaoEQ0HO52hqoI Z3qkKThoxdr0WzjktXP4RNlP9XNV18ybBVhLLIvjsWlC6P8wbZCDSs/sjBFdHastBWnuem dokhdzKZ80aOQtgfnmQK80dWMIXkbiEPZ1dHxeBKW4gln6yJ/KNh3aUzdSh2JnFAXejbG3 Do4jduXvEPgpIajG5x0pqe4R+sxbGCZeSOem0UZJrIjpwXkVfFFjYDC/vSmELDtb8g/4kU CpmQojqkKHz1lOXceXJs1Yw45lKLVIk9jNyriGZB2dVihi3DFT61P1eOUW0LqA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PFYxF2zrGz16nw; Mon, 13 Feb 2023 06:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31D6FjrP081744; Mon, 13 Feb 2023 06:15:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31D6FjNG081743; Mon, 13 Feb 2023 06:15:45 GMT (envelope-from git) Date: Mon, 13 Feb 2023 06:15:45 GMT Message-Id: <202302130615.31D6FjNG081743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 7e688ed49348 - main - patch: omit filename if the prompt was ignored List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7e688ed493482c5346d969e7667856d8ced8d87a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=7e688ed493482c5346d969e7667856d8ced8d87a commit 7e688ed493482c5346d969e7667856d8ced8d87a Author: Kyle Evans AuthorDate: 2023-01-24 16:46:01 +0000 Commit: Kyle Evans CommitDate: 2023-02-13 06:15:08 +0000 patch: omit filename if the prompt was ignored When a file is missing, patch(1) will prompt for a filename to try and patch it. If we're doing a dry-run, we'll output that the patch to the source file was either ignored/failed. If you ignore the prompt in a dry-run (i.e. just hit enter), we'll output: X out of X hunks ignored while patching (null) Let's improve the aesthetics a bit and just omit the last part if the prompt was ignored: X out of X hunks ignored Unfortunately we can't really test this without expect(1) because both force and batch mode will use the first best guess, which is wiped out by the "File to patch:" prompt. We could record the initially derived bestguess there and use *that*, but given that this is only possible in an interactive session I think it's fine to just omit the filename rather than adding a fair amount of complexity (which could also break other scenarios I haven't considered yet).. Reviewed by: des Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D38179 --- usr.bin/patch/patch.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index a23fc82d3d90..48d3bd37fe5b 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -463,9 +463,13 @@ main(int argc, char *argv[]) if (!check_only) say("%d out of %d hunks %s--saving rejects to %s\n", failed, hunk, skip_rest_of_patch ? "ignored" : "failed", rejname); - else + else if (filearg[0] != NULL) say("%d out of %d hunks %s while patching %s\n", failed, hunk, skip_rest_of_patch ? "ignored" : "failed", filearg[0]); + else + /* File prompt ignored, just note # hunks. */ + say("%d out of %d hunks %s\n", + failed, hunk, skip_rest_of_patch ? "ignored" : "failed"); if (!check_only && move_file(TMPREJNAME, rejname) < 0) trejkeep = true; }