{"thread":{"id":"41619","subject":"[PATCH] Allow \"-\" as a short-hand for \"@{-1}\" for branch deletion","startedAt":"2016-03-05T07:39:05Z","lastAt":"2016-03-05T08:06:52Z","messageCount":3,"participants":["Dinesh Polathula","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"280235","messageId":"1457163546-11970-1-git-send-email-dpdineshp2@gmail.com","threadId":"41619","inReplyTo":null,"subject":"[PATCH] Allow \"-\" as a short-hand for \"@{-1}\" for branch deletion","fromName":"Dinesh Polathula","fromEmail":"dpdineshp2@gmail.com","sentAt":"2016-03-05T07:39:05Z","receivedAt":"2016-03-05T07:39:05Z","isPatch":true,"sender":{"key":"dpdineshp2@gmail.com","avatar":null},"body":"From: Dinesh <dpdineshp2@gmail.com>\n\n***\nThis patch allows the usage of \"-\" as a short-hand for \"@{-1}\" in \"git branch -d @{-1}\".\n\nNote : This is a microproject that is part of the Google Summer of Code application process.\nI am interested in working on the git Beginner mode implementation as part of Google Summer of Code. The mentor details for this particular project are not available on the Ideas page. The mentors are likely on this mailing list, so I request the mentors to drop me a mail so I can get in contact with you to further discuss the git Beginner mode project.\n***\n\nDinesh (1):\n  branch.c: Allow \"-\" as a short-hand for \"@{-1}\" in \"git branch -d\n    @{-1}\"\n\n builtin/branch.c | 11 ++++++++---\n 1 file changed, 8 insertions(+), 3 deletions(-)\n\n-- \n2.8.0.rc0\n"},{"id":"280236","messageId":"1457163546-11970-2-git-send-email-dpdineshp2@gmail.com","threadId":"41619","inReplyTo":"1457163546-11970-1-git-send-email-dpdineshp2@gmail.com","subject":"[PATCH] branch.c: Allow \"-\" as a short-hand for \"@{-1}\" in \"git branch -d @{-1}\"","fromName":"Dinesh Polathula","fromEmail":"dpdineshp2@gmail.com","sentAt":"2016-03-05T07:39:06Z","receivedAt":"2016-03-05T07:39:06Z","isPatch":true,"sender":{"key":"dpdineshp2@gmail.com","avatar":null},"body":"From: Dinesh <dpdineshp2@gmail.com>\n\nThe \"-\" shorthand can be used as a replacement for \"@{-1}\" to refer to the previous branch the user was on in the \"git branch -d @{-1}\" command.\nReplace \"-\" argument with \"@{-1}\" when the command line arguments are parsed.\n\nSigned-off-by: Dinesh <dpdineshp2@gmail.com>\n---\n builtin/branch.c | 11 ++++++++---\n 1 file changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 7b45b6b..98d2c4b 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -24,7 +24,7 @@\n static const char * const builtin_branch_usage[] = {\n \tN_(\"git branch [<options>] [-r | -a] [--merged | --no-merged]\"),\n \tN_(\"git branch [<options>] [-l] [-f] <branch-name> [<start-point>]\"),\n-\tN_(\"git branch [<options>] [-r] (-d | -D) <branch-name>...\"),\n+\tN_(\"git branch [<options>] [-r] (-d | -D) [-] <branch-name>...\"),\n \tN_(\"git branch [<options>] (-m | -M) [<old-branch>] <new-branch>\"),\n \tN_(\"git branch [<options>] [-r | -a] [--points-at]\"),\n \tNULL\n@@ -658,8 +658,13 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \tfilter.abbrev = -1;\n \n \tif (argc == 2 && !strcmp(argv[1], \"-h\"))\n-\t\tusage_with_options(builtin_branch_usage, options);\n-\n+\t{\n+\t\tusage_with_options(builtin_branch_usage, options);\t\n+\t}\n+\tif (argc == 3 && !strcmp(argv[2], \"-\"))\n+\t{\n+\t    argv[2] = \"@{-1}\";\t\n+\t}\n \tgit_config(git_branch_config, NULL);\n \n \ttrack = git_branch_track;\n-- \n2.8.0.rc0\n"},{"id":"280238","messageId":"xmqqpov9wdpf.fsf@gitster.mtv.corp.google.com","threadId":"41619","inReplyTo":"1457163546-11970-1-git-send-email-dpdineshp2@gmail.com","subject":"Re: [PATCH] Allow \"-\" as a short-hand for \"@{-1}\" for branch deletion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-03-05T08:06:52Z","receivedAt":"2016-03-05T08:06:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dinesh Polathula <dpdineshp2@gmail.com> writes:\n\n> From: Dinesh <dpdineshp2@gmail.com>\n>\n> ***\n> This patch allows the usage of \"-\" as a short-hand for \"@{-1}\" in \"git branch -d @{-1}\".\n>\n> Note : This is a microproject that is part of the Google Summer of Code application process.\n> I am interested in working on the git Beginner mode implementation as part of Google Summer of Code. The mentor details for this particular project are not available on the Ideas page. The mentors are likely on this mailing list, so I request the mentors to drop me a mail so I can get in contact with you to further discuss the git Beginner mode project.\n\nPlease fill your lines to reasonable length like 70 columns or so,\nin your code, in your proposed log messages, and in your e-mail.\n\n> ***\n>\n> Dinesh (1):\n>   branch.c: Allow \"-\" as a short-hand for \"@{-1}\" in \"git branch -d\n>     @{-1}\"\n>\n>  builtin/branch.c | 11 ++++++++---\n>  1 file changed, 8 insertions(+), 3 deletions(-)\n"}]}