{"thread":{"id":"20920","subject":"[PATCH] git-push: Accept -n as a synonym for --dry-run.","startedAt":"2009-09-13T00:05:02Z","lastAt":"2009-09-13T17:07:23Z","messageCount":8,"participants":["Nelson Elhage","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"123012","messageId":"1252800302-26560-1-git-send-email-nelhage@mit.edu","threadId":"20920","inReplyTo":null,"subject":"[PATCH] git-push: Accept -n as a synonym for --dry-run.","fromName":"Nelson Elhage","fromEmail":"nelhage@mit.edu","sentAt":"2009-09-13T00:05:02Z","receivedAt":"2009-09-13T00:05:02Z","isPatch":true,"sender":{"key":"nelhage@mit.edu","avatar":"https://avatars.githubusercontent.com/u/16725?v=4"},"body":"'-n' is the standard way to specify a dry run for other git commands,\nso make 'git-push' accept it as well.\n---\n Documentation/git-push.txt |    3 ++-\n builtin-push.c             |    4 ++--\n 2 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-push.txt b/Documentation/git-push.txt\nindex 58d2bd5..ba6a8a2 100644\n--- a/Documentation/git-push.txt\n+++ b/Documentation/git-push.txt\n@@ -9,7 +9,7 @@ git-push - Update remote refs along with associated objects\n SYNOPSIS\n --------\n [verse]\n-'git push' [--all | --mirror | --tags] [--dry-run] [--receive-pack=<git-receive-pack>]\n+'git push' [--all | --mirror | --tags] [-n | --dry-run] [--receive-pack=<git-receive-pack>]\n \t   [--repo=<repository>] [-f | --force] [-v | --verbose]\n \t   [<repository> <refspec>...]\n \n@@ -82,6 +82,7 @@ nor in any Push line of the corresponding remotes file---see below).\n \tif the configuration option `remote.<remote>.mirror` is\n \tset.\n \n+-n::\n --dry-run::\n \tDo everything except actually send the updates.\n \ndiff --git a/builtin-push.c b/builtin-push.c\nindex 787011f..5e5f3ad 100644\n--- a/builtin-push.c\n+++ b/builtin-push.c\n@@ -10,7 +10,7 @@\n #include \"parse-options.h\"\n \n static const char * const push_usage[] = {\n-\t\"git push [--all | --mirror] [--dry-run] [--porcelain] [--tags] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [-v] [<repository> <refspec>...]\",\n+\t\"git push [--all | --mirror] [-n | --dry-run] [--porcelain] [--tags] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [-v] [<repository> <refspec>...]\",\n \tNULL,\n };\n \n@@ -182,7 +182,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)\n \t\tOPT_BIT( 0 , \"mirror\", &flags, \"mirror all refs\",\n \t\t\t    (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),\n \t\tOPT_BOOLEAN( 0 , \"tags\", &tags, \"push tags\"),\n-\t\tOPT_BIT( 0 , \"dry-run\", &flags, \"dry run\", TRANSPORT_PUSH_DRY_RUN),\n+\t\tOPT_BIT('n' , \"dry-run\", &flags, \"dry run\", TRANSPORT_PUSH_DRY_RUN),\n \t\tOPT_BIT( 0,  \"porcelain\", &flags, \"machine-readable output\", TRANSPORT_PUSH_PORCELAIN),\n \t\tOPT_BIT('f', \"force\", &flags, \"force updates\", TRANSPORT_PUSH_FORCE),\n \t\tOPT_BOOLEAN( 0 , \"thin\", &thin, \"use thin pack\"),\n-- \n1.6.3.1.499.ge7b8da\n"},{"id":"123020","messageId":"7vfxar5zsi.fsf@alter.siamese.dyndns.org","threadId":"20920","inReplyTo":"1252800302-26560-1-git-send-email-nelhage@mit.edu","subject":"Re: [PATCH] git-push: Accept -n as a synonym for --dry-run.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-13T02:44:29Z","receivedAt":"2009-09-13T02:44:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nelson Elhage <nelhage@MIT.EDU> writes:\n\n> '-n' is the standard way to specify a dry run for other git commands,\n> so make 'git-push' accept it as well.\n> ---\n\nSign-off?\n\nIndeed -n is used in many places for --dry-run, but it is not _the_\nstandard way.\n\ncommit, push (as you identified), reflog, and send-email have --dry-run\nbut -n is not a synonym for it.  Some of them even use -n as a shorthand\nfor a more often used option than --dry-run.\n\nSo the justification should be more like \"push does not any other option\nthat deserves a short-and-sweet -n better, it will not have any such\noption in the future, and --dry-run is very often used that it deserves to\nuse -n as its short-hand.\"\n\nI tend to agree with the first two points, but I am not sure about the\nthird point.  Do people dry-push that often?\n"},{"id":"123025","messageId":"20090913034031.GO4275@mit.edu","threadId":"20920","inReplyTo":"7vfxar5zsi.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-push: Accept -n as a synonym for --dry-run.","fromName":"Nelson Elhage","fromEmail":"nelhage@mit.edu","sentAt":"2009-09-13T03:40:31Z","receivedAt":"2009-09-13T03:40:31Z","isPatch":true,"sender":{"key":"nelhage@mit.edu","avatar":"https://avatars.githubusercontent.com/u/16725?v=4"},"body":"On Sat, Sep 12, 2009 at 07:44:29PM -0700, Junio C Hamano wrote:\n> Sign-off?\n\nSigned-off-by: Nelson Elhage <nelhage@mit.edu>\n\n(I can resend the entire patch, but I'll resend with a new commit\nmessage if appropriate after any discussion plays itself out).\n\n> \n> Indeed -n is used in many places for --dry-run, but it is not _the_\n> standard way.\n> \n> commit, push (as you identified), reflog, and send-email have --dry-run\n> but -n is not a synonym for it.  Some of them even use -n as a shorthand\n> for a more often used option than --dry-run.\n\nCan you point to an example of a git command supporting --dry-run, and\nusing -n for something else? I personally would find that confusing,\nsince -n is a common alias for dry-run both inside and outside of git\n(c.f. make, rsync, libtool). I guess patch(1) has that property, but\nnone of your examples from git use -n to mean something else.\n\nIn fact, reflog already supports '-n' to mean dry-run, it's just not\ndocumented. I'll send along a documentation patch to fix that.\n\nI got the claim that -n was \"standard\" from parse-options.h, which\ndefines OPT__DRY_RUN, which defines both -n and --dry-run switches at\nthe same time. Given the number of commands that treat them as\nsynonymous, I think it would be a win for UI consistency to make them\nsynonymous everywhere.\n\n> \n> So the justification should be more like \"push does not any other option\n> that deserves a short-and-sweet -n better, it will not have any such\n> option in the future, and --dry-run is very often used that it deserves to\n> use -n as its short-hand.\"\n> \n> I tend to agree with the first two points, but I am not sure about the\n> third point.  Do people dry-push that often?\n\nI personally use --dry-run almost every time I push, which is what\ninspired this patch. Especially now that the push.default can change\nthe behavior of push from repo to repo, I want to be sure I know what\nI'm about to push. The recent 'git push --confirm' thread suggests I\nam not the only person with this concern.\n"},{"id":"123027","messageId":"20090913035421.GP4275@mit.edu","threadId":"20920","inReplyTo":"20090913034031.GO4275@mit.edu","subject":"Re: [PATCH] git-push: Accept -n as a synonym for --dry-run.","fromName":"Nelson Elhage","fromEmail":"nelhage@mit.edu","sentAt":"2009-09-13T03:54:21Z","receivedAt":"2009-09-13T03:54:21Z","isPatch":true,"sender":{"key":"nelhage@mit.edu","avatar":"https://avatars.githubusercontent.com/u/16725?v=4"},"body":"On Sat, Sep 12, 2009 at 11:40:31PM -0400, Nelson Elhage wrote:\n> On Sat, Sep 12, 2009 at 07:44:29PM -0700, Junio C Hamano wrote:\n> Can you point to an example of a git command supporting --dry-run, and\n> using -n for something else? I personally would find that confusing,\n> since -n is a common alias for dry-run both inside and outside of git\n> (c.f. make, rsync, libtool). I guess patch(1) has that property, but\n> none of your examples from git use -n to mean something else.\n\nOops, I missed 'commit' in your list, which I see (as of recently) has\nthat property. In that case, though, --dry-run was added after an\nestablished -n option had been there for a long time; I think my\ngeneral argument still stands for commands where that is not the case.\n\n- Nelson\n"},{"id":"123028","messageId":"7vhbv72zjf.fsf@alter.siamese.dyndns.org","threadId":"20920","inReplyTo":"20090913034031.GO4275@mit.edu","subject":"Re: [PATCH] git-push: Accept -n as a synonym for --dry-run.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-13T05:18:12Z","receivedAt":"2009-09-13T05:18:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nelson Elhage <nelhage@MIT.EDU> writes:\n\n>> commit, push (as you identified), reflog, and send-email have --dry-run\n>> but -n is not a synonym for it.  Some of them even use -n as a shorthand\n>> for a more often used option than --dry-run.\n>\n> Can you point to an example of a git command supporting --dry-run, and\n> using -n for something else?\n\nDoesn't commit -n stand for no-verify?  I think that is how it is\ndocumented.\n\n> In fact, reflog already supports '-n' to mean dry-run,\n\nHuh?  \"git reflog -n 4\" is for show-four-entries-from-the-top.\n"},{"id":"123029","messageId":"7vd45v2za4.fsf@alter.siamese.dyndns.org","threadId":"20920","inReplyTo":"20090913035421.GP4275@mit.edu","subject":"Re: [PATCH] git-push: Accept -n as a synonym for --dry-run.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-13T05:23:47Z","receivedAt":"2009-09-13T05:23:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nelson Elhage <nelhage@MIT.EDU> writes:\n\n> ... I think my\n> general argument still stands for commands where that is not the case.\n\nCool down.\n\nIt is a mere subset of what I already said, so you are not arguing against\nme at all.\n\n    So the justification should be more like \"push does not have any other\n    option that deserves a short-and-sweet -n better, it will not have any\n    such option in the future, and --dry-run is very often used that it\n    deserves to use -n as its short-hand.\"\n\nand I already said I tend to agree with the first two points.  Indeed the\nfirst point is an absolute truth (the statement is about the current\nstate).\n\nTo answer the second point you need to look into the future, but I do not\nforesee us adding a very useful option to the command whose usefulness far\noutweigh that of dry-run and whose name begins with 'n' to want to use it\nas the short-hand.  In such a case, it is likely that we would try very\nhard to find a name that does not begin with 'n' to avoid the issue.\n"},{"id":"123034","messageId":"7veiqb1ikd.fsf@alter.siamese.dyndns.org","threadId":"20920","inReplyTo":"7vd45v2za4.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-push: Accept -n as a synonym for --dry-run.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-13T06:10:10Z","receivedAt":"2009-09-13T06:10:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> ..., so you are not arguing against\n> me at all.\n> ... it is likely that we would try very\n> hard to find a name that does not begin with 'n' to avoid the issue.\n\nSo what's my objection, in short?\n\nIt is just the wording \"_the_ standard\" that implies that anything that\nuses -n to mean something other than --dry-run is _wrong_.\n\nI didn't want to see anybody arguing against \"commit -n\".  It is used to\ndefeat pre-commit hook and has been there with us for a long time.\n"},{"id":"123069","messageId":"20090913170723.GS4275@mit.edu","threadId":"20920","inReplyTo":"7vd45v2za4.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-push: Accept -n as a synonym for --dry-run.","fromName":"Nelson Elhage","fromEmail":"nelhage@mit.edu","sentAt":"2009-09-13T17:07:23Z","receivedAt":"2009-09-13T17:07:23Z","isPatch":true,"sender":{"key":"nelhage@mit.edu","avatar":"https://avatars.githubusercontent.com/u/16725?v=4"},"body":"On Sat, Sep 12, 2009 at 10:23:47PM -0700, Junio C Hamano wrote:\n> Nelson Elhage <nelhage@MIT.EDU> writes:\n> \n> > ... I think my\n> > general argument still stands for commands where that is not the case.\n> \n> Cool down.\n> \n> It is a mere subset of what I already said, so you are not arguing against\n> me at all.\n\nMy apologies for continuing an argument where there was none. I've\nsent a patch with an improved commit message, and we can continue\ndiscussing on that thread if necessary.\n\n- Nelson\n"}]}