Code

Add --relative-date option to the revision interface
[git.git] / revision.c
index a58257ad8037f7009c69ee0502c3669756bb3987..b588f7487035027755954575f922afee99651662 100644 (file)
@@ -496,7 +496,7 @@ static int add_parents_only(struct rev_info *revs, const char *arg, int flags)
                it = get_reference(revs, arg, sha1, 0);
                if (it->type != OBJ_TAG)
                        break;
-               memcpy(sha1, ((struct tag*)it)->tagged->sha1, 20);
+               hashcpy(sha1, ((struct tag*)it)->tagged->sha1);
        }
        if (it->type != OBJ_COMMIT)
                return 0;
@@ -816,6 +816,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
                                revs->simplify_history = 0;
                                continue;
                        }
+                       if (!strcmp(arg, "--relative-date")) {
+                               revs->relative_date = 1;
+                               continue;
+                       }
                        opts = diff_opt_parse(&revs->diffopt, argv+i, argc-i);
                        if (opts > 0) {
                                revs->diff = 1;
@@ -936,7 +940,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
                        revs->diffopt.output_format = DIFF_FORMAT_PATCH;
        }
        revs->diffopt.abbrev = revs->abbrev;
-       diff_setup_done(&revs->diffopt);
+       if (diff_setup_done(&revs->diffopt) < 0)
+               die("diff_setup_done failed");
 
        return left;
 }