mirror of
https://github.com/git/git.git
synced 2024-11-05 08:47:56 +01:00
de239446b6
When doing a reflog walk, we use the commit's date to do any date limiting. In earlier versions of Git, this could lead to nonsense results, since a skipped commit would truncate the traversal. So a sequence like: git commit ... git checkout week-old-branch git checkout - git log -g --since=1.day.ago would stop at the week-old-branch, even though the "git commit" entry further back is still interesting. As of the prior commit, which uses a parent-less traversal of the reflog, you get the whole reflog minus any commits whose dates do not match the specified options. This is arguably useful, as you could scan the reflogs for commits that originated in a certain range. But more likely a user doing a reflog walk wants to limit based on the reflog entries themselves. You can simulate --until with: git log -g @{1.day.ago} but there's no way to ask Git to traverse only back to a certain date. E.g.: # show me reflog entries from the past day git log -g --since=1.day.ago This patch teaches the revision machinery to prefer the reflog entry dates to the commit dates when doing a reflog walk. Technically this is a change in behavior that affects plumbing, but the previous behavior was so buggy that it's unlikely anyone was relying on it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
26 lines
918 B
C
26 lines
918 B
C
#ifndef REFLOG_WALK_H
|
|
#define REFLOG_WALK_H
|
|
|
|
#include "cache.h"
|
|
|
|
struct reflog_walk_info;
|
|
|
|
extern void init_reflog_walk(struct reflog_walk_info **info);
|
|
extern int add_reflog_for_walk(struct reflog_walk_info *info,
|
|
struct commit *commit, const char *name);
|
|
extern void show_reflog_message(struct reflog_walk_info *info, int,
|
|
const struct date_mode *, int force_date);
|
|
extern void get_reflog_message(struct strbuf *sb,
|
|
struct reflog_walk_info *reflog_info);
|
|
extern const char *get_reflog_ident(struct reflog_walk_info *reflog_info);
|
|
extern timestamp_t get_reflog_timestamp(struct reflog_walk_info *reflog_info);
|
|
extern void get_reflog_selector(struct strbuf *sb,
|
|
struct reflog_walk_info *reflog_info,
|
|
const struct date_mode *dmode, int force_date,
|
|
int shorten);
|
|
|
|
extern int reflog_walk_empty(struct reflog_walk_info *walk);
|
|
|
|
struct commit *next_reflog_entry(struct reflog_walk_info *reflog_info);
|
|
|
|
#endif
|