{"thread":{"id":"41622","subject":"[PATCH] Allow \"-\" as a short-hand for \"@{-1}\" for branch deletion","startedAt":"2016-03-05T11:06:15Z","lastAt":"2016-03-05T11:06:16Z","messageCount":2,"participants":["Dinesh Polathula"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"280245","messageId":"1457175976-14732-1-git-send-email-dpdineshp2@gmail.com","threadId":"41622","inReplyTo":null,"subject":"[PATCH] Allow \"-\" as a short-hand for \"@{-1}\" for branch deletion","fromName":"Dinesh Polathula","fromEmail":"dpdineshp2@gmail.com","sentAt":"2016-03-05T11:06:15Z","receivedAt":"2016-03-05T11:06:15Z","isPatch":true,"sender":{"key":"dpdineshp2@gmail.com","avatar":null},"body":"From: Dinesh <dpdineshp2@gmail.com>\n\nThis patch allows the usage of \"-\" as a short-hand for \"@{-1}\" in \n\"git branch -d @{-1}\".\n\nNote : This is a microproject that is part of the Google Summer \nof Code application process.I am interested in working on the git \nBeginner mode implementation as part of Google Summer of Code. The \nmentor details for this particular project are not available on \nthe Ideas page. The mentors are likely on this mailing list, so \nI request the mentors to drop me a mail so I can get in contact \nwith 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":"280246","messageId":"1457175976-14732-2-git-send-email-dpdineshp2@gmail.com","threadId":"41622","inReplyTo":"1457175976-14732-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-05T11:06:16Z","receivedAt":"2016-03-05T11:06:16Z","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 \nto the previous branch the user was on in the \"git branch -d @{-1}\" \ncommand.Replace \"-\" argument with \"@{-1}\" when the command line \narguments 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"}]}