150
*/
151
static GIT_PATH_FUNC(rebase_path_gpg_sign_opt, "rebase-merge/gpg_sign_opt")
152
static GIT_PATH_FUNC(rebase_path_cdate_is_adate, "rebase-merge/cdate_is_adate")
153
+static GIT_PATH_FUNC(rebase_path_ignore_date, "rebase-merge/ignore_date")
154
static GIT_PATH_FUNC(rebase_path_orig_head, "rebase-merge/orig-head")
155
static GIT_PATH_FUNC(rebase_path_verbose, "rebase-merge/verbose")
156
static GIT_PATH_FUNC(rebase_path_quiet, "rebase-merge/quiet")
960
961
if (opts->committer_date_is_author_date)
962
argv_array_pushf(&cmd.env_array, "GIT_COMMITTER_DATE=%s",
963
+ opts->ignore_date ?
964
+ "" :
965
author_date_from_env_array(&cmd.env_array));
966
+ if (opts->ignore_date)
967
+ argv_array_push(&cmd.env_array, "GIT_AUTHOR_DATE=");
968
969
argv_array_push(&cmd.args, "commit");
970
1439
struct ident_split id;
1440
struct strbuf date = STRBUF_INIT;
1441
1437
- if (split_ident_line(&id, author, (int)strlen(author)) < 0) {
1438
- res = error(_("invalid author identity '%s'"), author);
1439
- goto out;
1440
- }
1441
- if (!id.date_begin) {
1442
- res = error(_("corrupt author: missing date information"));
1443
- goto out;
1442
+ if (!opts->ignore_date) {
1443
+ if (split_ident_line(&id, author, (int)strlen(author)) < 0) {
1444
+ res = error(_("invalid author identity '%s'"),
1445
+ author);
1446
+ goto out;
1447
+ }
1448
+ if (!id.date_begin) {
1449
+ res = error(_(
1450
+ "corrupt author: missing date information"));
1451
+ goto out;
1452
+ }
1453
+ strbuf_addf(&date, "@%.*s %.*s",
1454
+ (int)(id.date_end - id.date_begin),
1455
+ id.date_begin,
1456
+ (int)(id.tz_end - id.tz_begin),
1457
+ id.tz_begin);
1458
+ } else {
1459
+ reset_ident_date();
1460
}
1445
- strbuf_addf(&date, "@%.*s %.*s",
1446
- (int)(id.date_end - id.date_begin), id.date_begin,
1447
- (int)(id.tz_end - id.tz_begin), id.tz_begin);
1461
committer = fmt_ident(opts->committer_name,
1462
opts->committer_email,
1450
- WANT_COMMITTER_IDENT, date.buf,
1463
+ WANT_COMMITTER_IDENT,
1464
+ opts->ignore_date ? NULL : date.buf,
1465
IDENT_STRICT);
1466
strbuf_release(&date);
1467
} else {
1468
reset_ident_date();
1469
}
1470
1471
+ if (opts->ignore_date) {
1472
+ struct ident_split id;
1473
+ char *name, *email;
1474
+
1475
+ if (split_ident_line(&id, author, strlen(author)) < 0) {
1476
+ error(_("invalid author identity '%s'"), author);
1477
+ goto out;
1478
+ }
1479
+ name = xmemdupz(id.name_begin, id.name_end - id.name_begin);
1480
+ email = xmemdupz(id.mail_begin, id.mail_end - id.mail_begin);
1481
+ author = fmt_ident(name, email, WANT_AUTHOR_IDENT, NULL,
1482
+ IDENT_STRICT);
1483
+ free(name);
1484
+ free(email);
1485
+ }
1486
+
1487
if (commit_tree_extended(msg->buf, msg->len, &tree, parents, oid,
1488
author, committer, opts->gpg_sign, extra)) {
1489
res = error(_("failed to write commit object"));
2613
opts->committer_date_is_author_date = 1;
2614
}
2615
2616
+ if (file_exists(rebase_path_ignore_date())) {
2617
+ opts->allow_ff = 0;
2618
+ opts->ignore_date = 1;
2619
+ }
2620
+
2621
if (file_exists(rebase_path_reschedule_failed_exec()))
2622
opts->reschedule_failed_exec = 1;
2623
2710
write_file(rebase_path_keep_redundant_commits(), "%s", "");
2711
if (opts->committer_date_is_author_date)
2712
write_file(rebase_path_cdate_is_adate(), "%s", "");
2713
+ if (opts->ignore_date)
2714
+ write_file(rebase_path_ignore_date(), "%s", "");
2715
if (opts->reschedule_failed_exec)
2716
write_file(rebase_path_reschedule_failed_exec(), "%s", "");
2717
3634
3635
if (opts->committer_date_is_author_date)
3636
argv_array_pushf(&cmd.env_array, "GIT_COMMITTER_DATE=%s",
3637
+ opts->ignore_date ?
3638
+ "" :
3639
author_date_from_env_array(&cmd.env_array));
3640
+ if (opts->ignore_date)
3641
+ argv_array_push(&cmd.env_array, "GIT_AUTHOR_DATE=");
3642
3643
cmd.git_cmd = 1;
3644
argv_array_push(&cmd.args, "merge");
3918
if (opts->allow_ff)
3919
assert(!(opts->signoff || opts->no_commit ||
3920
opts->record_origin || opts->edit ||
3880
- opts->committer_date_is_author_date));
3921
+ opts->committer_date_is_author_date ||
3922
+ opts->ignore_date));
3923
if (read_and_refresh_cache(r, opts))
3924
return -1;
3925