documentation: use the word "index" in the git-add manual page
[gitweb.git] / builtin-name-rev.c
index c022224361b62b527aca7822920ac8ea896ae585..2d94eaaa6a90f2efe4401873930533b12b85522f 100644 (file)
@@ -4,6 +4,8 @@
 #include "tag.h"
 #include "refs.h"
 
+#define CUTOFF_DATE_SLOP 86400 /* one day */
+
 static const char name_rev_usage[] =
        "git-name-rev [--tags | --refs=<pattern>] ( --all | --stdin | committish [committish...] )\n";
 
@@ -58,7 +60,10 @@ static void name_rev(struct commit *commit,
                        parents = parents->next, parent_number++) {
                if (parent_number > 1) {
                        int len = strlen(tip_name);
-                       char *new_name = xmalloc(len + 8);
+                       char *new_name = xmalloc(len +
+                               1 + decimal_length(generation) +  /* ~<n> */
+                               1 + 2 +                           /* ^NN */
+                               1);
 
                        if (len > 2 && !strcmp(tip_name + len - 2, "^0"))
                                len -= 2;
@@ -205,6 +210,8 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
                add_object_array((struct object *)commit, *argv, &revs);
        }
 
+       if (cutoff)
+               cutoff = cutoff - CUTOFF_DATE_SLOP;
        for_each_ref(name_ref, &data);
 
        if (transform_stdin) {