summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/complete.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/complete.c b/common/complete.c
index 9206ef02a5..368321f921 100644
--- a/common/complete.c
+++ b/common/complete.c
@@ -277,11 +277,16 @@ static char* cmd_complete_lookup(struct string_list *sl, char *instr)
int len;
int ret = COMPLETE_END;
char *res = NULL;
+ char *t;
for_each_command(cmdtp) {
len = strlen(cmdtp->name);
if (!strncmp(instr, cmdtp->name, len) && instr[len] == ' ') {
instr += len + 1;
+ t = strrchr(instr, ' ');
+ if (t)
+ instr = t + 1;
+
if (cmdtp->complete) {
ret = cmdtp->complete(sl, instr);
res = instr;