completion: support excluding refs
[gitweb.git] / builtin / merge-index.c
index b416d928492c43e78dc7ac0b3bd1d7a99abfe78b..1c3427c36caa40e8740b090c44a048201e81c706 100644 (file)
@@ -9,7 +9,7 @@ static int merge_entry(int pos, const char *path)
 {
        int found;
        const char *arguments[] = { pgm, "", "", "", path, "", "", "", NULL };
-       char hexbuf[4][60];
+       char hexbuf[4][GIT_SHA1_HEXSZ + 1];
        char ownbuf[4][60];
 
        if (pos >= active_nr)
@@ -22,8 +22,8 @@ static int merge_entry(int pos, const char *path)
                if (strcmp(ce->name, path))
                        break;
                found++;
-               strcpy(hexbuf[stage], sha1_to_hex(ce->sha1));
-               sprintf(ownbuf[stage], "%o", ce->ce_mode);
+               sha1_to_hex_r(hexbuf[stage], ce->sha1);
+               xsnprintf(ownbuf[stage], sizeof(ownbuf[stage]), "%o", ce->ce_mode);
                arguments[stage] = hexbuf[stage];
                arguments[stage + 4] = ownbuf[stage];
        } while (++pos < active_nr);
@@ -75,7 +75,7 @@ int cmd_merge_index(int argc, const char **argv, const char *prefix)
        signal(SIGCHLD, SIG_DFL);
 
        if (argc < 3)
-               usage("git merge-index [-o] [-q] <merge-program> (-a | [--] <filename>*)");
+               usage("git merge-index [-o] [-q] <merge-program> (-a | [--] [<filename>...])");
 
        read_cache();