git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] branch.c: Allow "-" as a short-hand for "@{-1}" in "git branch -d @{-1}"
  2016-03-05  7:39 [PATCH] Allow "-" as a short-hand for "@{-1}" for branch deletion Dinesh Polathula
@ 2016-03-05  7:39 ` Dinesh Polathula
  0 siblings, 0 replies; 3+ messages in thread
From: Dinesh Polathula @ 2016-03-05  7:39 UTC (permalink / raw)
  To: git; +Cc: Dinesh

From: Dinesh <dpdineshp2@gmail.com>

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.

Signed-off-by: Dinesh <dpdineshp2@gmail.com>
---
 builtin/branch.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 7b45b6b..98d2c4b 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -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;
-- 
2.8.0.rc0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] branch.c: Allow "-" as a short-hand for "@{-1}" in "git branch -d @{-1}"
  2016-03-05 11:06 [PATCH] Allow "-" as a short-hand for "@{-1}" for branch deletion Dinesh Polathula
@ 2016-03-05 11:06 ` Dinesh Polathula
  0 siblings, 0 replies; 3+ messages in thread
From: Dinesh Polathula @ 2016-03-05 11:06 UTC (permalink / raw)
  To: git; +Cc: Dinesh

From: Dinesh <dpdineshp2@gmail.com>

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.

Signed-off-by: Dinesh <dpdineshp2@gmail.com>
---
 builtin/branch.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 7b45b6b..98d2c4b 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -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;
-- 
2.8.0.rc0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] branch.c: Allow "-" as a short-hand for "@{-1}" in "git branch -d @{-1}"
@ 2016-03-05 11:12 Dinesh Polathula
  0 siblings, 0 replies; 3+ messages in thread
From: Dinesh Polathula @ 2016-03-05 11:12 UTC (permalink / raw)
  To: git; +Cc: Dinesh

From: Dinesh <dpdineshp2@gmail.com>

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.

Signed-off-by: Dinesh <dpdineshp2@gmail.com>
---
 builtin/branch.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 7b45b6b..98d2c4b 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -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;
-- 
2.8.0.rc0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-05 11:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-05 11:12 [PATCH] branch.c: Allow "-" as a short-hand for "@{-1}" in "git branch -d @{-1}" Dinesh Polathula
  -- strict thread matches above, loose matches on Subject: below --
2016-03-05 11:06 [PATCH] Allow "-" as a short-hand for "@{-1}" for branch deletion Dinesh Polathula
2016-03-05 11:06 ` [PATCH] branch.c: Allow "-" as a short-hand for "@{-1}" in "git branch -d @{-1}" Dinesh Polathula
2016-03-05  7:39 [PATCH] Allow "-" as a short-hand for "@{-1}" for branch deletion Dinesh Polathula
2016-03-05  7:39 ` [PATCH] branch.c: Allow "-" as a short-hand for "@{-1}" in "git branch -d @{-1}" Dinesh Polathula

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).