Allow "-" as a short-hand for "@{-1}" for branch deletion
PATCH 1/1 Allow "-" as a short-hand for "@{-1}" for branch deletion
From: Dinesh <[email protected]>
This patch allows the usage of "-" as a short-hand for "@{-1}" in "git branch -d @{-1}".
Note : This is a microproject that is part of the Google Summer of Code application process.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.
***
Dinesh (1):
branch.c: Allow "-" as a short-hand for "@{-1}" in "git branch -d
@{-1}"builtin/branch.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
Signature · 1 line
2.8.0.rc0
PATCH 1/1 branch.c: Allow "-" as a short-hand for "@{-1}" in "git branch -d @{-1}"
From: Dinesh <[email protected]>
The "-" 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.Replace "-" argument with "@{-1}" when the command line arguments are parsed.
--- builtin/branch.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
builtin/branch.c +8 -3
@@ -24,7 +24,7 @@static const char *const builtin_branch_usage[] = {N_ ("git branch [<options>] [-r | -a] [--merged | --no-merged]" ),N_ ("git branch [<options>] [-l] [-f] <branch-name> [<start-point>]" ), -N_ ("git branch [<options>] [-r] (-d | -D) <branch-name>..." ), +N_ ("git branch [<options>] [-r] (-d | -D) [-] <branch-name>..." ),N_ ("git branch [<options>] (-m | -M) [<old-branch>] <new-branch>" ),N_ ("git branch [<options>] [-r | -a] [--points-at]" ),NULL
@@ -658,8 +658,13 @@ int cmd_branch(int argc, const char **argv, const char *prefix) filter.abbrev =-1 ;if (argc ==2 && !strcmp (argv[1 ],"-h" )) -usage_with_options (builtin_branch_usage, options); - + { +usage_with_options (builtin_branch_usage, options); + } +if (argc ==3 && !strcmp (argv[2 ],"-" )) + { + argv[2 ] ="@{-1}" ; + }git_config (git_branch_config,NULL ); track = git_branch_track;
Signature · 1 line
2.8.0.rc0