Code

git-tag(1): -v option is a subcommand; fix code block
[git.git] / revision.c
index e9de8650d37398b5d46256eced053f3b7dd4e25a..e60a26c6bb3f6ec77c3db30bc0b59a5a8e30e604 100644 (file)
@@ -115,10 +115,15 @@ void mark_parents_uninteresting(struct commit *commit)
 }
 
 void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)
+{
+       add_pending_object_with_mode(revs, obj, name, S_IFINVALID);
+}
+
+void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode)
 {
        if (revs->no_walk && (obj->flags & UNINTERESTING))
                die("object ranges do not make sense when not walking revisions");
-       add_object_array(obj, name, &revs->pending);
+       add_object_array_with_mode(obj, name, &revs->pending, mode);
        if (revs->reflog_info && obj->type == OBJ_COMMIT)
                add_reflog_for_walk(revs->reflog_info,
                                (struct commit *)obj, name);
@@ -651,6 +656,7 @@ void init_revisions(struct rev_info *revs, const char *prefix)
        revs->min_age = -1;
        revs->skip_count = -1;
        revs->max_count = -1;
+       revs->subject_prefix = "PATCH";
 
        revs->prune_fn = NULL;
        revs->prune_data = NULL;
@@ -722,6 +728,7 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
                        int flags,
                        int cant_be_filename)
 {
+       unsigned mode;
        char *dotdot;
        struct object *object;
        unsigned char sha1[20];
@@ -795,12 +802,12 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
                local_flags = UNINTERESTING;
                arg++;
        }
-       if (get_sha1(arg, sha1))
+       if (get_sha1_with_mode(arg, sha1, &mode))
                return -1;
        if (!cant_be_filename)
                verify_non_filename(revs->prefix, arg);
        object = get_reference(revs, arg, sha1, flags ^ local_flags);
-       add_pending_object(revs, object, arg);
+       add_pending_object_with_mode(revs, object, arg, mode);
        return 0;
 }
 
@@ -1104,7 +1111,18 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
                                continue;
                        }
                        if (!strcmp(arg, "--relative-date")) {
-                               revs->relative_date = 1;
+                               revs->date_mode = DATE_RELATIVE;
+                               continue;
+                       }
+                       if (!strncmp(arg, "--date=", 7)) {
+                               if (!strcmp(arg + 7, "relative"))
+                                       revs->date_mode = DATE_RELATIVE;
+                               else if (!strcmp(arg + 7, "local"))
+                                       revs->date_mode = DATE_LOCAL;
+                               else if (!strcmp(arg + 7, "default"))
+                                       revs->date_mode = DATE_NORMAL;
+                               else
+                                       die("unknown date format %s", arg);
                                continue;
                        }
 
@@ -1176,10 +1194,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
        if (def && !revs->pending.nr) {
                unsigned char sha1[20];
                struct object *object;
-               if (get_sha1(def, sha1))
+               unsigned mode;
+               if (get_sha1_with_mode(def, sha1, &mode))
                        die("bad default revision '%s'", def);
                object = get_reference(revs, def, sha1, 0);
-               add_pending_object(revs, object, def);
+               add_pending_object_with_mode(revs, object, def, mode);
        }
 
        if (revs->topo_order)