Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Jun 29, 2015
  1. @peff @gitster

    convert "enum date_mode" into a struct

    peff authored gitster committed
    In preparation for adding date modes that may carry extra
    information beyond the mode itself, this patch converts the
    date_mode enum into a struct.
    Most of the conversion is fairly straightforward; we pass
    the struct as a pointer and dereference the type field where
    necessary. Locations that declare a date_mode can use a "{}"
    constructor.  However, the tricky case is where we use the
    enum labels as constants, like:
      show_date(t, tz, DATE_NORMAL);
    Ideally we could say:
      show_date(t, tz, &{ DATE_NORMAL });
    but of course C does not allow that. Likewise, we cannot
    cast the constant to a struct, because we need to pass an
    actual address. Our options are basically:
      1. Manually add a "struct date_mode d = { DATE_NORMAL }"
         definition to each caller, and pass "&d". This makes
         the callers uglier, because they sometimes do not even
         have their own scope (e.g., they are inside a switch
      2. Provide a pre-made global "date_normal" struct that can
         be passed by address. We'd also need "date_rfc2822",
         "date_iso8601", and so forth. But at least the ugliness
         is defined in one place.
      3. Provide a wrapper that generates the correct struct on
         the fly. The big downside is that we end up pointing to
         a single global, which makes our wrapper non-reentrant.
         But show_date is already not reentrant, so it does not
    This patch implements 3, along with a minor macro to keep
    the size of the callers sane.
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
Commits on Sep 2, 2014
  1. @davvid @gitster

    stylefix: asterisks stick to the variable, not the type

    davvid authored gitster committed
    Signed-off-by: David Aguilar <>
    Signed-off-by: Junio C Hamano <>
Commits on May 11, 2012
  1. @gitster

    Merge branch 'jk/maint-reflog-walk-count-vs-time'

    gitster authored
    Gives a better DWIM behaviour for --pretty=format:%gd, "stash list", and
    "log -g", depending on how the starting point ("master" vs "master@{0}" vs
    "master@{now}") and date formatting options (e.g. "--date=iso") are given
    on the command line.
    By Jeff King (4) and Junio C Hamano (1)
    * jk/maint-reflog-walk-count-vs-time:
      reflog-walk: tell explicit --date=default from not having --date at all
      reflog-walk: always make HEAD@{0} show indexed selectors
      reflog-walk: clean up "flag" field of commit_reflog struct
      log: respect date_mode_explicit with --format:%gd
      t1411: add more selector index/date tests
Commits on May 7, 2012
  1. @gitster

    reflog-walk: tell explicit --date=default from not having --date at all

    gitster authored
    Introduction of opt->date_mode_explicit was a step in the right direction,
    but lost that crucial bit at the very end of the callchain, and the callee
    could not tell an explicitly specified "I want *date* but in default format"
    from the built-in default value passed when there was no --date specified.
    Signed-off-by: Junio C Hamano <>
Commits on Dec 16, 2011
  1. @peff @gitster

    pretty: give placeholders to reflog identity

    peff authored gitster committed
    When doing a reflog walk, you can get some information about
    the reflog (such as the subject line), but not the identity
    information (i.e., name and email).
    Let's make those available, mimicing the options for author
    and committer identity.
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
Commits on Oct 20, 2009
  1. @trast @gitster

    Introduce new pretty formats %g[sdD] for reflog information

    trast authored gitster committed
    Add three new --pretty=format escapes:
      %gD  long  reflog descriptor (e.g. refs/stash@{0})
      %gd  short reflog descriptor (e.g. stash@{0})
      %gs  reflog message
    This is achieved by passing down the reflog info, if any, inside the
    pretty_print_context struct.
    We use the newly refactored get_reflog_selector(), and give it some
    extra functionality to extract a shortened ref.  The shortening is
    cached inside the commit_reflogs struct; the only allocation of it
    happens in read_complete_reflog(), where it is initialised to 0.  Also
    add another helper get_reflog_message() for the message extraction.
    Note that the --format="%h %gD: %gs" tests may not work in real
    repositories, as the --pretty formatter doesn't know to leave away the
    ": " on the last commit in an incomplete (because git-gc removed the
    old part) reflog.  This equivalence is nevertheless the main goal of
    this patch.
    Thanks to Jeff King for reviews, the %gd testcase and documentation.
    Signed-off-by: Thomas Rast <>
    Signed-off-by: Junio C Hamano <>
Commits on Mar 20, 2009
  1. @peff @gitster

    make oneline reflog dates more consistent with multiline format

    peff authored gitster committed
    The multiline reflog format (e.g., as shown by "git log -g")
    will show HEAD@{<date>} rather than HEAD@{<count>} in two
      1. If the user gave branch@{<date>} syntax to specify the
      2. If the user gave a --date=<format> specifier
    It uses the "normal" date format in case 1, and the
    user-specified format in case 2.
    The oneline reflog format (e.g., "git reflog show" or "git
    log -g --oneline") will show the date in the same two
    circumstances. However, it _always_ shows the date as a
    relative date, and it always ignores the timezone.
    In case 2, it seems ridiculous to trigger the date but use a
    format totally different from what the user requested.
    For case 1, it is arguable that the user might want to see
    the relative date by default; however, the multiline version
    shows the normal format.
    This patch does three things:
      - refactors the "relative_date" parameter to
        show_reflog_message to be an actual date_mode enum,
        since this is how it is used (it is passed to show_date)
      - uses the passed date_mode parameter in the oneline
        format (making it consistent with the multiline format)
      - does not ignore the timezone parameter in oneline mode
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
Commits on Jul 25, 2007
  1. @dscho @gitster

    git log -g: Complain, but do not fail, when no reflogs are there

    dscho authored gitster committed
    When asking "git log -g --all", clearly you want to see only those refs
    that do have reflogs, but you do not want it to fail, either.
    So instead of die()ing, complain about it, but move on to the other refs.
    Signed-off-by: Johannes Schindelin <>
    Signed-off-by: Junio C Hamano <>
Commits on Feb 9, 2007
  1. @dscho

    log --reflog: honour --relative-date

    dscho authored Junio C Hamano committed
    If you say "git log -g --relative-date", it is very likely that
    you want to see the reflog names in terms of a relative date.
    Signed-off-by: Johannes Schindelin <>
    Signed-off-by: Junio C Hamano <>
Commits on Jan 21, 2007
  1. Fix --walk-reflog with --pretty=oneline

    Junio C Hamano authored
    Now, "git log --abbrev-commit --pretty=o --walk-reflogs HEAD" is
    reasonably pleasant to use.
    Signed-off-by: Junio C Hamano <>
  2. @dscho

    Teach the revision walker to walk by reflogs with --walk-reflogs

    dscho authored Junio C Hamano committed
    When called with "--walk-reflogs", as long as there are reflogs
    available, the walker will take this information into account, rather
    than the parent information in the commit object.
    Signed-off-by: Johannes Schindelin <>
    Signed-off-by: Junio C Hamano <>
Something went wrong with that request. Please try again.