[RFC/PATCH 15/18] revert: add NONE action and make parse_args() manage it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
---
 builtin/revert.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/builtin/revert.c b/builtin/revert.c
index 7513a00..fee2e38 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -40,7 +40,7 @@ static const char * const cherry_pick_usage[] = {
 };
 
 struct args_info {
-	enum { REVERT, CHERRY_PICK } action;
+	enum { NONE = 0, REVERT, CHERRY_PICK } action;
 	int edit;
 	int no_replay;
 	int no_commit;
@@ -90,6 +90,17 @@ static void parse_args(int argc, const char **argv, struct args_info *info)
 		OPT_END(),
 	};
 
+	if (info->action == NONE) {
+		if (argc < 1)
+			die("no action argument");
+		if (!strcasecmp(argv[0], "p") || !strcasecmp(argv[0], "pick"))
+			info->action = CHERRY_PICK;
+		else if (!strcasecmp(argv[0], "revert"))
+			info->action = REVERT;
+		else
+			die("unknown action argument: %s", argv[0]);
+	}
+
 	info->me = info->action == REVERT ? "revert" : "cherry-pick";
 	setenv(GIT_REFLOG_ACTION, info->me, 0);
 
-- 
1.7.3.2.504.g59d466


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]