git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Boyd Stephen Smith Jr." <bss@iguanasuicide.net>
To: git@vger.kernel.org
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Alan <alan@clueserver.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] Make git revert warn the user when reverting a merge commit.
Date: Thu, 18 Dec 2008 21:24:11 -0600	[thread overview]
Message-ID: <200812182124.15568.bss@iguanasuicide.net> (raw)
In-Reply-To: <alpine.DEB.1.00.0812190353520.14632@racer>

[-- Attachment #1: Type: text/plain, Size: 1789 bytes --]

Blah, my --in-reply-to didn't work so this didn't thread right.

On Thursday 2008 December 18 20:57:57 you wrote:
> On Thu, 18 Dec 2008, Boyd Stephen Smith Jr. wrote:
> > +		do {
> > +			switch (action) {
> > +			case REVERT:
> > +				warning("revert on a merge commit may not do what you expect.");
> > +				continue;
> > +			case CHERRY_PICK:
> > +				/* Cherry picking a merge doesn't merge the history, but
> > +				 * I don't think many people expect that.
> > +				 */
> > +				continue;
> > +			}
> > +			/* Unhandled enum member. */
> > +			die("Unknown action on a merge commit.");
> > +		} while (0);
> > +
>
> Wow.  That must be one of the, uhm, less beautiful ways to write
>
> 		if (action == REVERT)
> 			warning("revert on a merge commit may not do what you "
> 				"expect.");
> 		else if (action != CHERRY_PICK)
> 			die("Unknown action on a merge commit.");

My way, a smart compiler will warn at compile time that there's a new enum 
member that needs to be handled.  Your way, no such compile-time warning will 
be emitted.  At runtime, they have the same behavior.  Athestically, I agree 
with you, but my way may have technical advantages.

I did check the CodingGuidelines and didn't see this construct mentioned.

> Besides, I am actually pretty much against this change.

I've never had a need to revert a merge commit, so it's not a big win either 
way for me.  I wrote the patch because alan@clueserver.org had the revert 
behavior bite him and Linus suggested a warning might be apropos.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@iguanasuicide.net                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2008-12-19  3:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-19  2:39 [PATCH] Make git revert warn the user when reverting a merge commit Boyd Stephen Smith Jr.
2008-12-19  2:57 ` Johannes Schindelin
2008-12-19  3:03   ` Junio C Hamano
2008-12-19  3:29     ` Boyd Stephen Smith Jr.
2008-12-19  3:55       ` Jay Soffian
2008-12-19  5:54         ` Boyd Stephen Smith Jr.
2008-12-19  6:35           ` Junio C Hamano
2008-12-19 18:07       ` Alan
2008-12-19  3:24   ` Boyd Stephen Smith Jr. [this message]
2008-12-20  7:08 ` Robin Rosenberg
2008-12-20 22:54   ` Boyd Stephen Smith Jr.
2008-12-20 23:31     ` Robin Rosenberg
2008-12-21  2:37       ` Junio C Hamano
2008-12-21  3:11         ` Boyd Stephen Smith Jr.
2008-12-21 10:09           ` Robin Rosenberg
2008-12-21 10:59             ` Junio C Hamano
2008-12-21 19:59             ` Boyd Stephen Smith Jr.
2008-12-21 20:23               ` Junio C Hamano
2008-12-21 21:13                 ` Boyd Stephen Smith Jr.
2008-12-21 22:17                   ` Junio C Hamano
2008-12-21 22:38                     ` Junio C Hamano
2008-12-21 22:40                     ` Robin Rosenberg
2008-12-21 22:46                       ` Junio C Hamano
2008-12-21 22:56                         ` Robin Rosenberg

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=200812182124.15568.bss@iguanasuicide.net \
    --to=bss@iguanasuicide.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=alan@clueserver.org \
    --cc=git@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 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 NNTP newsgroup(s).