All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aditya Garg <gargaditya08@live.com>
To: Junio C Hamano <gitster@pobox.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Cc: Eric Sunshine <sunshine@sunshineco.com>,
	"sandals@crustytoothpaste.net" <sandals@crustytoothpaste.net>,
	Julian Swagemakers <julian@swagemakers.org>,
	Jeff King <peff@peff.net>,
	Jacob Keller <jacob.e.keller@intel.com>,
	Zi Yao <ziyao@disroot.org>,
	Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Subject: [PATCH v6 0/2] send-email: fix threads breaking in case user edits emails and improvements to outlook ID fix.
Date: Thu, 29 May 2025 14:57:00 +0000	[thread overview]
Message-ID: <cover.1748529954.git.gargaditya08@live.com> (raw)
In-Reply-To: <cover.1748274404.git.gargaditya08@live.com>

Hi all,

This patch series fixes two minor issues with git-send-email.

The first patch fixes a bug that caused the message number to increase
when a user edits an email. As a result of this bug, threads would
break when a user edits an email.

The second patch improves the logging of the new message ID assigned by
Outlook when a user edits an email.

v2 - Change the bugfix logic used to fix the threading bug.
v3 - Add additional patch to improve the logging of the new
     message ID assigned by Outlook.
v4 - Completely rewrite the commit message of the first patch to
     explain the bug in detail and how it is fixed. Also, add
     example logs to explain the second patch.
v5 - Fix numerous spelling and grammatical errors in the commit
     message of the first patch.
v6 - Change the subject of the first patch.
   - Prefer using "increment" instead of "increase" in the commit
     message of the first patch.
   - Avoid decreasing the `$message_id_serial` variable in the first patch.

Aditya Garg (2):
  send-email: fix bug resulting in broken threads if a message is edited
  send-email: show the new message id assigned by outlook in the logs

 git-send-email.perl | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Range-diff against v5:
1:  5103ea4034 ! 1:  d965439f76 send-email: fix bug resulting in increased message number if a message is edited
    @@ Metadata
     Author: Aditya Garg <gargaditya08@live.com>
     
      ## Commit message ##
    -    send-email: fix bug resulting in increased message number if a message is edited
    +    send-email: fix bug resulting in broken threads if a message is edited
     
         Whenever we send a thread of emails using send-email, a message number
         is internally assigned to each email. This number is used to track the
         order of the emails in the thread. Whenever a new message is processed
    -    in a thread, the current script logic increases the message number by
    +    in a thread, the current script logic increments the message number by
         one, which is intended.
     
         But, if a message is edited and then resent, its message number again
    -    gets increased. This is because the script uses the same logic to
    +    gets incrmented. This is because the script uses the same logic to
         process the edited message, which it uses to send the next message.
     
    -    This minor bug is usually harmless, unless some special situations arise.
    -    One such situation is when the first message in a thread is edited
    -    and resent, and an `--in-reply-to` argument is also passed to send-email.
    +    This minor bug is usually harmless, unless a special situations arises.
    +    That situation is when the first message in a thread is edited and
    +    resent, and an `--in-reply-to` argument is also passed to send-email.
         In this case, if the user has chosen shallow threading, the threading
         does not work as expected, and all messages become replies to the
         Message-ID specified in the `--in-reply-to` argument.
    @@ Commit message
         greater than 1, and the whole set of conditions is false. Therefore, the
         `$in_reply_to` variable remains as the first message's ID. This is what
         we expect in shallow threading. But if the user edits the first message
    -    and resends it, the `$message_num` variable gets increased by 1, and
    +    and resends it, the `$message_num` variable gets incremented by 1, and
         thus the condition `$message_num == 1` becomes false. This means that
         the `$in_reply_to` variable is not set to the first message's ID. As a
         result the next message in the thread is not a reply to the first
    @@ Commit message
         variable is set to the first message's ID, and the threading works
         as expected, regardless of the message number.
     
    -    Just like the `$message_num` variable, the `$message_id_serial` variable
    -    also increases by 1 whenever a new message is sent. This variable
    -    displays the message number in the Message-ID of the email.
    -
         To fix this bug, we need to ensure that the `$message_num` variable is
    -    not increased by 1 when a message is edited and resent. We do this by
    -    decreasing both the `$message_num` and `$message_id_serial` variables
    -    by 1 whenever the request to edit a message is received. This way, the
    -    next message in the thread will have the same message number as the
    -    edited message. Therefore the threading will work as expected.
    +    not incremented by 1 when a message is edited and resent. We do this by
    +    decreasing the `$message_num` variable by 1 whenever the request to edit
    +    a message is received. This way, the next message in the thread will
    +    have the same message number as the edited message. Therefore the
    +    threading will work as expected.
     
         The same logic has also been applied in case the user drops a single
         message from the thread by choosing the "[n]o" option during
    @@ git-send-email.perl: sub send_message {
     +			# the next message is treated as the successor to the
     +			# previously sent message, and not the skipped message.
     +			$message_num--;
    -+			$message_id_serial--;
      			return 0;
      		} elsif (/^e/i) {
     +			# Since the same message will be sent again, we need to
    @@ git-send-email.perl: sub send_message {
     +			# different message sent after the original non-edited
     +			# message.
     +			$message_num--;
    -+			$message_id_serial--;
      			return -1;
      		} elsif (/^q/i) {
      			cleanup_compose_files();
2:  6f2668de07 = 2:  caf46596a7 send-email: show the new message id assigned by outlook in the logs
-- 
2.49.0.635.g48fa2f4343


  parent reply	other threads:[~2025-05-29 14:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-26 15:51 [PATCH v4 0/2] send-email: fix threads breaking in case user edits emails and improvements to outlook ID fix Aditya Garg
2025-05-26 15:51 ` [PATCH v4 1/2] send-email: fix bug resulting in increased message number if a message is edited Aditya Garg
2025-05-26 15:51 ` [PATCH v4 2/2] send-email: show the new message id assigned by outlook in the logs Aditya Garg
2025-05-28  6:39 ` [PATCH v5 0/2] send-email: fix threads breaking in case user edits emails and improvements to outlook ID fix Aditya Garg
2025-05-28  6:39   ` [PATCH v5 1/2] send-email: fix bug resulting in increased message number if a message is edited Aditya Garg
2025-05-28 22:52     ` Junio C Hamano
2025-05-29  3:26       ` Aditya Garg
2025-05-28  6:39   ` [PATCH v5 2/2] send-email: show the new message id assigned by outlook in the logs Aditya Garg
2025-05-29 14:57 ` Aditya Garg [this message]
2025-05-29 14:57   ` [PATCH v6 1/2] send-email: fix bug resulting in broken threads if a message is edited Aditya Garg
2025-05-29 14:57   ` [PATCH v6 2/2] send-email: show the new message id assigned by outlook in the logs Aditya Garg
2025-05-29 16:01     ` Junio C Hamano
2025-05-29 16:18       ` Aditya Garg
2025-06-04 12:32         ` Junio C Hamano
2025-06-04 12:55           ` Aditya Garg
2025-06-04 12:55 ` [PATCH v7 0/2] send-email: fix threads breaking in case user edits emails and improvements to outlook ID fix Aditya Garg
2025-06-04 12:55   ` [PATCH v7 1/2] send-email: fix bug resulting in broken threads if a message is edited Aditya Garg
2025-06-04 12:55   ` [PATCH v7 2/2] send-email: show the new message id assigned by outlook in the logs Aditya Garg
2025-06-04 16:31   ` [PATCH v7 0/2] send-email: fix threads breaking in case user edits emails and improvements to outlook ID fix Junio C Hamano

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

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

  git send-email \
    --in-reply-to=cover.1748529954.git.gargaditya08@live.com \
    --to=gargaditya08@live.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jacob.e.keller@intel.com \
    --cc=julian@swagemakers.org \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    --cc=sunshine@sunshineco.com \
    --cc=ziyao@disroot.org \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.