aboutsummaryrefslogtreecommitdiff
path: root/ref-filter.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-02-12 13:16:11 -0800
committerJunio C Hamano <gitster@pobox.com>2024-02-12 13:16:11 -0800
commitd4833b22abc0093153534cfaa93bb90be9a708ca (patch)
treec28c84351594285fa8fe8ed054eb4aecac4c07c0 /ref-filter.c
parentb3370dd51edb7f087754f0090ab483e9d1a2161e (diff)
parent46176d77c9e0b219a78d64cb99d8dbf4d9bcde2d (diff)
downloadgit-d4833b22abc0093153534cfaa93bb90be9a708ca.tar.xz
Merge branch 'vd/for-each-ref-sort-with-formatted-timestamp'
"git branch" and friends learned to use the formatted text as sorting key, not the underlying timestamp value, when the --sort option is used with author or committer timestamp with a format specifier (e.g., "--sort=creatordate:format:%H:%M:%S"). * vd/for-each-ref-sort-with-formatted-timestamp: ref-filter.c: sort formatted dates by byte value
Diffstat (limited to 'ref-filter.c')
-rw-r--r--ref-filter.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ref-filter.c b/ref-filter.c
index 35b989e1df..be14b56e32 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1611,6 +1611,12 @@ static void grab_date(const char *buf, struct atom_value *v, const char *atomnam
if (formatp) {
formatp++;
parse_date_format(formatp, &date_mode);
+
+ /*
+ * If this is a sort field and a format was specified, we'll
+ * want to compare formatted date by string value.
+ */
+ v->atom->type = FIELD_STR;
}
if (!eoemail)