git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Fabian Ruch <bafain@gmail.com>
To: git@vger.kernel.org
Cc: Michael Haggerty <mhagger@alum.mit.edu>,
	Thomas Rast <tr@thomasrast.ch>, Jeff King <peff@peff.net>,
	Peter Krefting <peter@softwolves.pp.se>,
	Phil Hord <phil.hord@gmail.com>
Subject: [PATCH v2 02/23] rebase -i: allow squashing empty commits without complaints
Date: Thu,  7 Aug 2014 01:59:09 +0200	[thread overview]
Message-ID: <16751a4402233b6c2925bf00d7ecebdccedd0eef.1407368621.git.bafain@gmail.com> (raw)
In-Reply-To: <cover.1407368621.git.bafain@gmail.com>

The to-do list commands `squash` and `fixup` apply the changes
introduced by the named commit to the tree but instead of creating
a new commit on top of the current head it replaces the previous
commit with a new commit that records the updated tree. If the
result is an empty commit git-rebase stops with the error message

   You asked to amend the most recent commit, but doing so would make
   it empty. You can repeat your command with --allow-empty, or you can
   remove the commit entirely with "git reset HEAD^".

This message is not very helpful because neither does git-rebase
support an option `--allow-empty` nor does the messages say how to
resume the rebase. Firstly, change the error message to

   The squash result is empty and --keep-empty was not specified.

   You can remove the squash commit now with

     git reset HEAD^

   Once you are down, run

     git rebase --continue

If the user wishes to squash a sequence of commits into one
commit, f. i.

   pick A
   squash Revert "A"
   squash A'

, it does not matter for the end result that the first squash
result, or any sub-sequence in general, is going to be empty. The
squash message is not affected at all by which commits are created
and only the commit created by the last line in the sequence will
end up in the final history. Secondly, print the error message
only if the whole squash sequence produced an empty commit.

Lastly, since an empty squash commit is not a failure to rewrite
the history as planned, issue the message above as a mere warning
and interrupt the rebase with the return value zero. The
interruption should be considered as a notification with the
chance to undo it on the spot. Specifying the `--keep-empty`
option tells git-rebase to keep empty squash commits in the
rebased history without notification.

Add tests.

Reported-by: Peter Krefting <peter@softwolves.pp.se>
Signed-off-by: Fabian Ruch <bafain@gmail.com>
---
Hi,

Peter Krefting is cc'd as the author of the bug report "Confusing
error message in rebase when commit becomes empty" discussed on the
mailing list in June. Phil Hord and Jeff King both participated in
the problem discussion which ended with two proposals by Jeff.

Jeff King writes:
>   1. Always keep such empty commits. A user who is surprised by them
>      being empty can then revisit them. Or drop them by doing another
>      rebase without --keep-empty.
> 
>   2. Notice ourselves that the end-result of the whole squash is an
>      empty commit, and stop to let the user deal with it.

This patch chooses the second alternative. Either way seems OK. The
crucial consensus of the discussion was to silently throw away empty
interim commits.

   Fabian

 git-rebase--interactive.sh    | 20 +++++++++++---
 t/t3404-rebase-interactive.sh | 62 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 3 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 3222bf6..8820eac 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -549,7 +549,7 @@ do_next () {
 		squash|s|fixup|f)
 			# This is an intermediate commit; its message will only be
 			# used in case of trouble.  So use the long version:
-			do_with_author output git commit --allow-empty-message \
+			do_with_author output git commit --allow-empty-message --allow-empty \
 				--amend --no-verify -F "$squash_msg" \
 				${gpg_sign_opt:+"$gpg_sign_opt"} ||
 				die_failed_squash $sha1 "$rest"
@@ -558,18 +558,32 @@ do_next () {
 			# This is the final command of this squash/fixup group
 			if test -f "$fixup_msg"
 			then
-				do_with_author git commit --allow-empty-message \
+				do_with_author git commit --allow-empty-message --allow-empty \
 					--amend --no-verify -F "$fixup_msg" \
 					${gpg_sign_opt:+"$gpg_sign_opt"} ||
 					die_failed_squash $sha1 "$rest"
 			else
 				cp "$squash_msg" "$GIT_DIR"/SQUASH_MSG || exit
 				rm -f "$GIT_DIR"/MERGE_MSG
-				do_with_author git commit --amend --no-verify -F "$GIT_DIR"/SQUASH_MSG -e \
+				do_with_author git commit --allow-empty --amend --no-verify -F "$GIT_DIR"/SQUASH_MSG -e \
 					${gpg_sign_opt:+"$gpg_sign_opt"} ||
 					die_failed_squash $sha1 "$rest"
 			fi
 			rm -f "$squash_msg" "$fixup_msg"
+			if test -z "$keep_empty" && is_empty_commit HEAD
+			then
+				echo "$sha1" >"$state_dir"/stopped-sha
+				warn "The squash result is empty and --keep-empty was not specified."
+				warn
+				warn "You can remove the squash commit now with"
+				warn
+				warn "  git reset HEAD^"
+				warn
+				warn "Once you are down, run"
+				warn
+				warn "  git rebase --continue"
+				exit 0
+			fi
 			;;
 		esac
 		record_in_rewritten $sha1
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 9c71835..a95cb2a 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -237,6 +237,68 @@ test_expect_success 'retain authorship' '
 	git show HEAD | grep "^Author: Twerp Snog"
 '
 
+test_expect_success 'setup squash/fixup reverted and fixed feature' '
+	git checkout -b reverted-feature master &&
+	test_commit feature &&
+	git revert feature &&
+	git checkout -b fixed-feature reverted-feature &&
+	test_commit featurev2
+'
+
+test_expect_success 'fixup fixed feature (empty interim commit)' '
+	git checkout -b fixup-fixed-feature fixed-feature &&
+	set_fake_editor &&
+	FAKE_LINES="1 fixup 2 fixup 3" git rebase -i master &&
+	git log --oneline master.. >actual &&
+	test_line_count = 1 actual &&
+	git diff --exit-code featurev2
+'
+
+test_expect_success 'squash fixed feature (empty interim commit)' '
+	git checkout -b squash-fixed-feature fixed-feature &&
+	set_fake_editor &&
+	FAKE_LINES="1 squash 2 squash 3" git rebase -i master &&
+	git log --oneline master.. >actual &&
+	test_line_count = 1 actual &&
+	git diff --exit-code featurev2
+'
+
+test_expect_success 'fixup reverted feature (empty final commit)' '
+	git checkout -b fixup-reverted-feature reverted-feature &&
+	set_fake_editor &&
+	FAKE_LINES="1 fixup 2" git rebase -i master &&
+	git reset HEAD^ &&
+	git rebase --continue &&
+	test_cmp_rev master HEAD
+'
+
+test_expect_success 'squash reverted feature (empty final commit)' '
+	git checkout -b squash-reverted-feature reverted-feature &&
+	set_fake_editor &&
+	FAKE_LINES="1 squash 2" git rebase -i master &&
+	git reset HEAD^ &&
+	git rebase --continue &&
+	test_cmp_rev master HEAD
+'
+
+test_expect_success 'fixup reverted feature (empty final commit with --keep-empty)' '
+	git checkout -b fixup-keep-reverted-feature reverted-feature &&
+	set_fake_editor &&
+	FAKE_LINES="1 fixup 2" git rebase -i --keep-empty master &&
+	git log --oneline master.. >actual &&
+	test_line_count = 1 actual &&
+	git diff --exit-code master
+'
+
+test_expect_success 'squash reverted feature (empty final commit with --keep-empty)' '
+	git checkout -b squash-keep-reverted-feature reverted-feature &&
+	set_fake_editor &&
+	FAKE_LINES="1 squash 2" git rebase -i --keep-empty master &&
+	git log --oneline master.. >actual &&
+	test_line_count = 1 actual &&
+	git diff --exit-code master
+'
+
 test_expect_success 'squash' '
 	git reset --hard twerp &&
 	echo B > file7 &&
-- 
2.0.1

  parent reply	other threads:[~2014-08-07  0:00 UTC|newest]

Thread overview: 148+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19  3:28 [RFC PATCH 0/7] rebase -i: Implement `reword` and `squash` in terms of `do_pick` Fabian Ruch
2014-07-02 17:47 ` [PATCH RFC v2 00/19] Enable options --signoff, --reset-author for pick, reword Fabian Ruch
2014-07-02 17:47   ` [PATCH RFC v2 01/19] rebase -i: Failed reword prints redundant error message Fabian Ruch
2014-07-08 20:31     ` Junio C Hamano
2014-07-10 14:30       ` Andrew Wong
2014-07-10 16:35         ` Fabian Ruch
2014-07-10 17:04           ` Andrew Wong
2014-07-02 17:47   ` [PATCH RFC v2 02/19] rebase -i: reword complains about empty commit despite --keep-empty Fabian Ruch
2014-07-08 20:37     ` Junio C Hamano
2014-07-09 18:02       ` Fabian Ruch
2014-07-02 17:47   ` [PATCH RFC v2 03/19] rebase -i: reword executes pre-commit hook on interim commit Fabian Ruch
2014-07-08 20:43     ` Junio C Hamano
2014-07-13 11:00       ` Fabian Ruch
2014-07-02 17:47   ` [PATCH RFC v2 04/19] rebase -i: Teach do_pick the option --edit Fabian Ruch
2014-07-02 17:47   ` [PATCH RFC v2 05/19] rebase -i: Implement reword in terms of do_pick Fabian Ruch
2014-08-04 15:16     ` Matthieu Moy
2014-08-04 15:45       ` Fabian Ruch
2014-07-02 17:47   ` [PATCH RFC v2 06/19] rebase -i: Stop on root commits with empty log messages Fabian Ruch
2014-07-08 22:26     ` Junio C Hamano
2014-07-10  9:29       ` Fabian Ruch
2014-07-10 16:57         ` Junio C Hamano
2014-07-10 17:33         ` Junio C Hamano
2014-07-02 17:47   ` [PATCH RFC v2 07/19] rebase -i: The replay of root commits is not shown with --verbose Fabian Ruch
2014-07-08 22:29     ` Junio C Hamano
2014-07-11 13:46     ` Fabian Ruch
2014-07-15  9:29       ` Chris Webb
2014-07-02 17:48   ` [PATCH RFC v2 08/19] rebase -i: Root commits are replayed with an unnecessary option Fabian Ruch
2014-07-08 22:32     ` Junio C Hamano
2014-07-18  9:16       ` Fabian Ruch
2014-07-18 16:52         ` Junio C Hamano
2014-07-19 18:14           ` Fabian Ruch
2014-07-02 17:48   ` [PATCH RFC v2 09/19] rebase -i: Commit only once when rewriting picks Fabian Ruch
2014-07-02 17:48   ` [PATCH RFC v2 10/19] rebase -i: Do not die in do_pick Fabian Ruch
2014-07-02 17:48   ` [PATCH RFC v2 11/19] rebase -i: Teach do_pick the option --amend Fabian Ruch
2014-07-02 17:48   ` [PATCH RFC v2 12/19] rebase -i: Teach do_pick the option --file Fabian Ruch
2014-07-02 17:48   ` [PATCH RFC v2 13/19] rebase -i: Prepare for squash in terms of do_pick --amend Fabian Ruch
2014-07-02 17:48   ` [PATCH RFC v2 14/19] rebase -i: Implement squash in terms of do_pick Fabian Ruch
2014-07-02 17:48   ` [PATCH RFC v2 15/19] rebase -i: Explicitly distinguish replay commands and exec tasks Fabian Ruch
2014-07-10 20:03     ` Junio C Hamano
2014-07-02 17:48   ` [PATCH RFC v2 16/19] rebase -i: Parse to-do list command line options Fabian Ruch
2014-07-02 17:48   ` [PATCH RFC v2 17/19] rebase -i: Teach do_pick the option --reset-author Fabian Ruch
2014-07-02 17:48   ` [PATCH RFC v2 18/19] rebase -i: Teach do_pick the option --signoff Fabian Ruch
2014-07-02 17:48   ` [PATCH RFC v2 19/19] rebase -i: Enable options --signoff, --reset-author for pick, reword Fabian Ruch
2014-07-03 10:33   ` [PATCH RFC v2 00/19] " Michael Haggerty
2014-07-08 20:45   ` Junio C Hamano
2014-07-09 16:08     ` Fabian Ruch
2014-07-18 12:10       ` Thomas Rast
2014-07-28 23:18 ` [PATCH v1 " Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 01/19] rebase -i: failed reword prints redundant error message Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 02/19] rebase -i: allow rewording an empty commit without complaints Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 03/19] rebase -i: reword executes pre-commit hook on interim commit Fabian Ruch
2014-08-01 23:47     ` Jeff King
2014-08-04 18:51       ` Fabian Ruch
2014-08-06 21:46         ` Jeff King
2014-07-28 23:18   ` [PATCH v1 04/19] rebase -i: teach do_pick the option --edit Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 05/19] rebase -i: implement reword in terms of do_pick Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 06/19] rebase -i: allow replaying commits with empty log messages Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 07/19] rebase -i: log the replay of root commits Fabian Ruch
2014-08-02  0:04     ` Jeff King
2014-08-04 21:21       ` Fabian Ruch
2014-08-06 22:01         ` Jeff King
2014-07-28 23:18   ` [PATCH v1 08/19] rebase -i: root commits are replayed with an unnecessary option Fabian Ruch
2014-08-02  0:13     ` Jeff King
2014-08-04 21:31       ` Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 09/19] rebase -i: commit only once when rewriting picks Fabian Ruch
2014-08-02  0:22     ` Jeff King
2014-08-07  0:24       ` Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 10/19] rebase -i: do not die in do_pick Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 11/19] rebase -i: teach do_pick the option --amend Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 12/19] rebase -i: teach do_pick the option --file Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 13/19] rebase -i: prepare for squash in terms of do_pick --amend Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 14/19] rebase -i: implement squash in terms of do_pick Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 15/19] rebase -i: explicitly distinguish replay commands and exec tasks Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 16/19] rebase -i: parse to-do list command line options Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 17/19] rebase -i: teach do_pick the option --reset-author Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 18/19] rebase -i: teach do_pick the option --signoff Fabian Ruch
2014-07-28 23:18   ` [PATCH v1 19/19] rebase -i: enable options --signoff, --reset-author for pick, reword Fabian Ruch
2014-08-02 13:52   ` [PATCH v1 00/19] Enable " Jeff King
2014-08-04  8:37     ` Fabian Ruch
2014-08-06 23:59 ` [PATCH v2 00/23] " Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 01/23] rebase -i: allow replaying commits with empty log messages Fabian Ruch
2014-08-06 23:59   ` Fabian Ruch [this message]
2014-08-07  7:16     ` [PATCH v2 02/23] rebase -i: allow squashing empty commits without complaints Peter Krefting
2014-08-07 22:03     ` Eric Sunshine
2014-08-11  7:01       ` Fabian Ruch
2014-08-13 19:24     ` Phil Hord
2014-08-06 23:59   ` [PATCH v2 03/23] rebase -i: allow rewording " Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 04/23] rebase -i: hide interactive command messages in verbose mode Fabian Ruch
2014-08-08 19:09     ` Thomas Rast
2014-08-11  8:26       ` Fabian Ruch
2014-08-11 18:22         ` Thomas Rast
2014-08-06 23:59   ` [PATCH v2 05/23] rebase -i: failed reword prints redundant error message Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 06/23] commit: allow disabling pre-commit and commit-msg separately Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 07/23] rebase -i: squash skips commit-msg hook Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 08/23] rebase -i: reword executes pre-commit hook on interim commit Fabian Ruch
2014-08-08 19:09     ` Thomas Rast
2014-08-11  8:45       ` Fabian Ruch
2014-08-11 18:22         ` Thomas Rast
2014-08-06 23:59   ` [PATCH v2 09/23] rebase -i: teach do_pick the option --edit Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 10/23] rebase -i: implement reword in terms of do_pick Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 11/23] rebase -i: log the replay of root commits Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 12/23] rebase -i: root commits are replayed with an unnecessary option Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 13/23] rebase -i: commit only once when rewriting picks Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 14/23] rebase -i: do not die in do_pick Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 15/23] rebase -i: teach do_pick the option --amend Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 16/23] rebase -i: teach do_pick the option --file Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 17/23] rebase -i: prepare for squash in terms of do_pick --amend Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 18/23] rebase -i: implement squash in terms of do_pick Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 19/23] rebase -i: explicitly distinguish replay commands and exec tasks Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 20/23] rebase -i: parse to-do list command line options Fabian Ruch
2014-08-08 19:10     ` Thomas Rast
2014-08-11 20:56       ` Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 21/23] rebase -i: teach do_pick the option --reset-author Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 22/23] rebase -i: teach do_pick the option --signoff Fabian Ruch
2014-08-06 23:59   ` [PATCH v2 23/23] rebase -i: enable options --signoff, --reset-author for pick, reword Fabian Ruch
2014-08-08 19:10     ` Thomas Rast
2014-08-12 21:04       ` Fabian Ruch
2014-08-13 12:47     ` Michael Haggerty
2014-08-14 17:24       ` Fabian Ruch
2014-09-21 16:59       ` Fabian Ruch
2014-08-18 21:22 ` [PATCH v3 00/27] Enable options --signoff, --reset-author for pick, reword, edit Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 01/27] rebase -i: allow replaying commits with empty log messages Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 02/27] rebase -i: allow squashing empty commits without complaints Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 03/27] rebase -i: allow rewording " Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 04/27] fake_editor: leave standard output unchanged Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 05/27] rebase -i: hide interactive command messages in verbose mode Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 06/27] rebase -i: discard redundant message when rewording fails Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 07/27] commit: allow disabling pre-commit and commit-msg separately Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 08/27] rebase -i: verify squash messages using commit-msg Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 09/27] rebase -i: do not verify reworded patches using pre-commit Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 10/27] rebase -i: teach do_pick the option --edit Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 11/27] rebase -i: implement reword in terms of do_pick Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 12/27] rebase -i: log the replay of root commits Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 13/27] rebase -i: do not use -C when --no-edit is sufficient Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 14/27] rebase -i: commit only once when rewriting picks Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 15/27] rebase -i: do not die in do_pick Fabian Ruch
2014-08-18 21:22   ` [PATCH v3 16/27] rebase -i: teach do_pick the option --amend Fabian Ruch
2014-08-18 21:23   ` [PATCH v3 17/27] rebase -i: teach do_pick the option --file Fabian Ruch
2014-08-18 21:23   ` [PATCH v3 18/27] rebase -i: remove no-op do_with_author git commit --amend Fabian Ruch
2014-08-18 21:23   ` [PATCH v3 19/27] rebase -i: prepare for squash in terms of do_pick --amend Fabian Ruch
2014-08-18 21:23   ` [PATCH v3 20/27] rebase -i: implement squash in terms of do_pick Fabian Ruch
2014-08-18 21:23   ` [PATCH v3 21/27] rebase -i: explicitly distinguish replay commands and exec tasks Fabian Ruch
2014-08-18 21:23   ` [PATCH v3 22/27] rebase -i: parse to-do list command line options Fabian Ruch
2014-08-18 21:23   ` [PATCH v3 23/27] rebase -i: teach do_pick the option --reset-author Fabian Ruch
2014-08-18 21:23   ` [PATCH v3 24/27] rebase -i: teach do_pick the option --signoff Fabian Ruch
2014-08-18 21:23   ` [PATCH v3 25/27] rebase -i: do not overwrite user author information Fabian Ruch
2014-08-18 21:23   ` [PATCH v3 26/27] rebase -i: refuse to commit when resuming with updated head Fabian Ruch
2014-08-18 21:23   ` [PATCH v3 27/27] rebase -i: enable --signoff, --reset-author for pick, reword, edit Fabian Ruch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16751a4402233b6c2925bf00d7ecebdccedd0eef.1407368621.git.bafain@gmail.com \
    --to=bafain@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    --cc=peff@peff.net \
    --cc=peter@softwolves.pp.se \
    --cc=phil.hord@gmail.com \
    --cc=tr@thomasrast.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).