diff options
Diffstat (limited to 'object-name.c')
| -rw-r--r-- | object-name.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/object-name.c b/object-name.c index 0bfa29dbbf..511f09bc0f 100644 --- a/object-name.c +++ b/object-name.c @@ -8,7 +8,6 @@ #include "tag.h" #include "commit.h" #include "tree.h" -#include "blob.h" #include "tree-walk.h" #include "refs.h" #include "remote.h" @@ -21,7 +20,6 @@ #include "read-cache-ll.h" #include "repository.h" #include "setup.h" -#include "submodule.h" #include "midx.h" #include "commit-reach.h" #include "date.h" @@ -1036,6 +1034,15 @@ static int get_oid_basic(struct repository *r, const char *str, int len, len, str, show_date(co_time, co_tz, DATE_MODE(RFC2822))); } + } else if (nth == co_cnt && !is_null_oid(oid)) { + /* + * We were asked for the Nth reflog (counting + * from 0), but there were only N entries. + * read_ref_at() will have returned "1" to tell + * us it did not find an entry, but it did + * still fill in the oid with the "old" value, + * which we can use. + */ } else { if (flags & GET_OID_QUIETLY) { exit(128); |
