OSDN Git Service

Merge branch 'jk/reflog-walk-maint'
authorJunio C Hamano <gitster@pobox.com>
Mon, 10 Jul 2017 20:42:52 +0000 (13:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Jul 2017 20:42:53 +0000 (13:42 -0700)
After "git branch --move" of the currently checked out branch, the
code to walk the reflog of HEAD via "log -g" and friends
incorrectly stopped at the reflog entry that records the renaming
of the branch.

* jk/reflog-walk-maint:
  reflog-walk: include all fields when freeing complete_reflogs
  reflog-walk: don't free reflogs added to cache
  reflog-walk: duplicate strings in complete_reflogs list
  reflog-walk: skip over double-null oid due to HEAD rename

1  2 
reflog-walk.c

diff --cc reflog-walk.c
@@@ -252,13 -259,15 +259,15 @@@ void fake_reflog_parent(struct reflog_w
        do {
                reflog = &commit_reflog->reflogs->items[commit_reflog->recno];
                commit_reflog->recno--;
 -              logobj = parse_object(reflog->ooid.hash);
 +              logobj = parse_object(&reflog->ooid);
        } while (commit_reflog->recno && (logobj && logobj->type != OBJ_COMMIT));
  
 -      if (!logobj && commit_reflog->recno >= 0 && is_null_sha1(reflog->ooid.hash)) {
 +      if (!logobj && commit_reflog->recno >= 0 && is_null_oid(&reflog->ooid)) {
                /* a root commit, but there are still more entries to show */
                reflog = &commit_reflog->reflogs->items[commit_reflog->recno];
 -              logobj = parse_object(reflog->noid.hash);
 +              logobj = parse_object(&reflog->noid);
+               if (!logobj)
 -                      logobj = parse_object(reflog->ooid.hash);
++                      logobj = parse_object(&reflog->ooid);
        }
  
        if (!logobj || logobj->type != OBJ_COMMIT) {