Skip to content
Commits on May 11, 2012
  1. @gitster

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

    gitster committed May 11, 2012
    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 committed May 7, 2012
    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 <gitster@pobox.com>
Commits on May 4, 2012
  1. @peff @gitster

    reflog-walk: always make HEAD@{0} show indexed selectors

    peff committed with gitster May 4, 2012
    When we are showing reflog selectors during a walk, we infer
    from context whether the user wanted to see the index in
    each selector, or the reflog date. The current rules are:
    
      1. if the user asked for an explicit date format in the
         output, show the date
    
      2. if the user asked for ref@{now}, show the date
    
      3. if neither is true, show the index
    
    However,  if we see "ref@{0}", that should be a strong clue
    that the user wants to see the counted version. In fact, it
    should be much stronger than the date format in (1). The
    user may have been setting the date format to use in another
    part of the output (e.g., in --format="%gd (%ad)", they may
    have wanted to influence the author date).
    
    This patch flips the rules to:
    
      1. if the user asked for ref@{0}, always show the index
    
      2. if the user asked for ref@{now}, always show the date
    
      3. otherwise, we have just "ref"; show them counted by
         default, but respect the presence of "--date" as a clue
         that the user wanted them date-based
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @peff @gitster

    reflog-walk: clean up "flag" field of commit_reflog struct

    peff committed with gitster May 4, 2012
    When we prepare to walk a reflog, we parse the specification
    and pull some information from it, such as which reflog to
    look in (e.g., HEAD), and where to start (e.g., HEAD@{10} or
    HEAD@{yesterday}). The resulting struct has a "recno" field
    to show where in the reflog we are starting. It also has a
    "flag" field; if true, it means the recno field came from
    parsing a date like HEAD@{yesterday}.
    
    There are two problems with this:
    
      1. "flag" is an absolutely terrible name, as it conveys
         nothing about the meaning
    
      2. you can tell "HEAD" from "HEAD@{yesterday}", but you
         can't differentiate "HEAD" from "HEAD{0}"
    
    This patch converts the flag into a tri-state (and gives it
    a better name!).
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 22, 2011
  1. @gitster

    Merge branch 'jk/pretty-reglog-ent'

    gitster committed Dec 22, 2011
    * jk/pretty-reglog-ent:
      pretty: give placeholders to reflog identity
Commits on Dec 16, 2011
  1. @peff @gitster

    pretty: give placeholders to reflog identity

    peff committed with gitster Dec 16, 2011
    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 <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 13, 2011
  1. @pclouds @gitster

    Convert resolve_ref+xstrdup to new resolve_refdup function

    pclouds committed with gitster Dec 13, 2011
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 6, 2011
  1. @pclouds @gitster

    Copy resolve_ref() return value for longer use

    pclouds committed with gitster Nov 13, 2011
    resolve_ref() may return a pointer to a static buffer. Callers that
    use this value longer than a couple of statements should copy the
    value to avoid some hidden resolve_ref() call that may change the
    static buffer's value.
    
    The bug found by Tony Wang <wwwjfy@gmail.com> in builtin/merge.c
    demonstrates this. The first call is in cmd_merge()
    
    branch = resolve_ref("HEAD", head_sha1, 0, &flag);
    
    Then deep in lookup_commit_or_die() a few lines after, resolve_ref()
    may be called again and destroy "branch".
    
    lookup_commit_or_die
     lookup_commit_reference
      lookup_commit_reference_gently
       parse_object
        lookup_replace_object
         do_lookup_replace_object
          prepare_replace_object
           for_each_replace_ref
            do_for_each_ref
             get_loose_refs
              get_ref_dir
               get_ref_dir
                resolve_ref
    
    All call sites are checked and made sure that xstrdup() is called if
    the value should be saved.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 13, 2010
  1. @gitster

    Merge branch 'jk/maint-reflog-bottom'

    gitster committed Dec 12, 2010
    * jk/maint-reflog-bottom:
      reflogs: clear flags properly in corner case
Commits on Nov 24, 2010
  1. @peff @gitster

    reflogs: clear flags properly in corner case

    peff committed with gitster Nov 21, 2010
    The reflog-walking mechanism is based on the regular
    revision traversal. We just rewrite the parents of each
    commit in fake_reflog_parent to point to the commit in the
    next reflog entry instead of the real parents.
    
    However, the regular revision traversal tries not to show
    the same commit twice, and so sets the SHOWN flag on each
    commit it shows. In a reflog, however, we may want to see
    the same commit more than once if it appears in the reflog
    multiple times (which easily happens, for example, if you do
    a reset to a prior state).
    
    The fake_reflog_parent function takes care of this by
    clearing flags, including SHOWN. Unfortunately, it does so
    at the very end of the function, and it is possible to
    return early from the function if there is no fake parent to
    set up (e.g., because we are at the very first reflog entry
    on the branch). In such a case the flag is not cleared, and
    the entry is skipped by the revision traversal machinery as
    already shown.
    
    You can see this by walking the log of a ref which is set to
    its very first commit more than once (the test below shows
    such a situation). In this case the reflog walk will fail to
    show the entry for the initial creation of the ref.
    
    We don't want to simply move the flag-clearing to the top of
    the function; we want to make sure flags set during the
    fake-parent installation are also cleared. Instead, let's
    hoist the flag-clearing out of the fake_reflog_parent
    function entirely. It's not really about fake parents
    anyway, and the only caller is the get_revision machinery.
    
    Reported-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
    Signed-off-by: Jeff King <peff@peff.net>
    Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 27, 2010
  1. @qur @gitster

    string_list: Fix argument order for string_list_lookup

    qur committed with gitster Jun 26, 2010
    Update the definition and callers of string_list_lookup to use the
    string_list as the first argument.  This helps make the string_list
    API easier to use by being more consistent.
    
    Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @qur @gitster

    string_list: Fix argument order for string_list_insert

    qur committed with gitster Jun 26, 2010
    Update the definition and callers of string_list_insert to use the
    string_list as the first argument.  This helps make the string_list
    API easier to use by being more consistent.
    
    Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 20, 2009
  1. @trast @gitster

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

    trast committed with gitster Oct 19, 2009
    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 <trast@student.ethz.ch>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @trast @gitster

    reflog-walk: refactor the branch@{num} formatting

    trast committed with gitster Oct 19, 2009
    We'll use the same output in an upcoming commit, so refactor its
    formatting (which was duplicated anyway) into a separate function.
    
    Signed-off-by: Thomas Rast <trast@student.ethz.ch>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 1, 2009
  1. @felipec @gitster

    Fix a bunch of pointer declarations (codestyle)

    felipec committed with gitster May 1, 2009
    Essentially; s/type* /type */ as per the coding guidelines.
    
    Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 20, 2009
  1. @peff @gitster

    make oneline reflog dates more consistent with multiline format

    peff committed with gitster Mar 20, 2009
    The multiline reflog format (e.g., as shown by "git log -g")
    will show HEAD@{<date>} rather than HEAD@{<count>} in two
    situations:
    
      1. If the user gave branch@{<date>} syntax to specify the
         reflog
    
      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 <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 22, 2008
  1. @dscho @gitster

    Rename path_list to string_list

    dscho committed with gitster Jul 21, 2008
    The name path_list was correct for the first usage of that data structure,
    but it really is a general-purpose string list.
    
    $ perl -i -pe 's/path-list/string-list/g' $(git grep -l path-list)
    $ perl -i -pe 's/path_list/string_list/g' $(git grep -l path_list)
    $ git mv path-list.h string-list.h
    $ git mv path-list.c string-list.c
    $ perl -i -pe 's/has_path/has_string/g' $(git grep -l has_path)
    $ perl -i -pe 's/path/string/g' string-list.[ch]
    $ git mv Documentation/technical/api-path-list.txt \
    	Documentation/technical/api-string-list.txt
    $ perl -i -pe 's/strdup_paths/strdup_strings/g' $(git grep -l strdup_paths)
    
    ... and then fix all users of string-list to access the member "string"
    instead of "path".
    
    Documentation/technical/api-string-list.txt needed some rewrapping, too.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 25, 2007
  1. @dscho @gitster

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

    dscho committed with gitster Jul 24, 2007
    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 <johannes.schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 9, 2007
  1. @dscho

    log --reflog: use dwim_log

    dscho committed with Junio C Hamano Feb 9, 2007
    Since "git log origin/master" uses dwim_log() to match
    "refs/remotes/origin/master", it makes sense to do that for
    "git log --reflog", too.
    
    Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. @dscho

    log --reflog: honour --relative-date

    dscho committed with Junio C Hamano Feb 8, 2007
    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 <Johannes.Schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Feb 2, 2007
  1. @dscho

    Teach the '@{...}' notation to git-log -g

    dscho committed with Junio C Hamano Feb 2, 2007
    Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jan 28, 2007
  1. git-log -g --pretty=oneline should display the reflog message

    Nicolas Pitre committed with Junio C Hamano Jan 27, 2007
    In the context of reflog output the reflog message is more useful than
    the commit message's first line.  When relevant the reflog message
    will contain that line anyway.
    
    Signed-off-by: Nicolas Pitre <nico@cam.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jan 21, 2007
  1. @dscho

    --walk-reflogs: actually find the right commit by date.

    dscho committed with Junio C Hamano Jan 20, 2007
    Embarassing thinko.
    
    Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
  2. Fix --walk-reflog with --pretty=oneline

    Junio C Hamano committed Jan 20, 2007
    Now, "git log --abbrev-commit --pretty=o --walk-reflogs HEAD" is
    reasonably pleasant to use.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  3. reflog-walk: build fixes

    Junio C Hamano committed Jan 20, 2007
    Dependency on reflog-walk.h was missing in the Makefile, and
    reflog-walk.c did not even include it.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  4. @dscho

    --walk-reflogs: disallow uninteresting commits

    dscho committed with Junio C Hamano Jan 20, 2007
    Do not allow uninteresting commits with --walk-reflogs, since it is
    not clear what should be shown in these cases:
    
    	$ git log --walk-reflogs master..next
    	$ git log --walk-reflogs ^master
    
    Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
  5. @dscho

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

    dscho committed with Junio C Hamano Jan 11, 2007
    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 <johannes.schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Something went wrong with that request. Please try again.