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>,
	Zi Yao <ziyao@disroot.org>, Jeff King <peff@peff.net>,
	Jacob Keller <jacob.e.keller@intel.com>,
	Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Subject: [PATCH v5 0/2] send-email: fix threads breaking in case user edits emails and improvements to outlook ID fix.
Date: Wed, 28 May 2025 06:39:31 +0000	[thread overview]
Message-ID: <cover.1748414082.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.

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

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

Range-diff:
1:  63addf9d9b ! 1:  5103ea4034 send-email: fix bug resulting in increased message number if a message is edited
    @@ Commit message
     
         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
    -    process the edited message, which is uses the send the next message.
    +    process the edited message, which it uses to send the next message.
     
    -    This minor bug is usually harmless unless some special situations arise.
    +    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.
    -    In this case if the user has chosen shallow threading, the threading
    -    does not work as expected, and all messaged become as replies to the
    +    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.
     
         The reason for this bug is hidden in the code for threading itself.
    @@ Commit message
                 }
         }
     
    -    Here $message_num is the current message number, and $in_reply_to is
    +    Here `$message_num` is the current message number, and `$in_reply_to` is
         the Message-ID of the message to which the current message is a reply.
         In case `--in-reply-to` is specified, the `$in_reply_to` variable
         is set to the value of the `--in-reply-to` argument.
    @@ Commit message
         In case we specify an `--in-reply-to` argument, and have shallow
         threading, the only condition that can make this true is
         `$message_num == 1`, which is true for the first message in a thread.
    -    Thus the $in_reply_to variable gets set to the first message's ID.
    +    Thus, the `$in_reply_to` variable gets set to the first message's ID.
         For subsequent messages, the `$message_num` variable is always
    -    greater than 1, and the whole set of conditions is false, and thus the
    -    $in_reply_to variable remains as the first message's ID. This is what
    -    we expect in shallow threading. But, in case the user edits the first
    -    message and resends it, the `$message_num` variable gets increased 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,
    -    and thus the next message in the thread is not a reply to the first
    -    message, but to the `--in-reply-to` argument, effectively breaking
    -    the threading.
    +    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
    +    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
    +    message, but to the `--in-reply-to` argument, effectively breaking the
    +    threading.
     
         In case the user does not specify an `--in-reply-to` argument, the
    -    !defined $in_reply_to condition is true, and thus the `$in_reply_to`
    +    `!defined $in_reply_to` condition is true, and thus the `$in_reply_to`
         variable is set to the first message's ID, and the threading works
    -    as expected, irrespective of what the message number is.
    +    as expected, regardless of the message number.
     
    -    Just like $message_num, $message_id_serial variable also increases by 1
    -    whenever a new message is sent. This variable displays the message
    -    number is the Message-ID of the email.
    +    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.
     
    -    So, in order 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 the $message_num and $message_id_serial
    -    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, and thus the threading will work as expected.
    +    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.
     
         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
2:  72b3cd1bfb = 2:  6f2668de07 send-email: show the new message id assigned by outlook in the logs
-- 
2.43.0


  parent reply	other threads:[~2025-05-28  6:39 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 ` Aditya Garg [this message]
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 ` [PATCH v6 0/2] send-email: fix threads breaking in case user edits emails and improvements to outlook ID fix Aditya Garg
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.1748414082.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.