summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c829774)
raw | patch | inline | side by side (parent: c829774)
author | Junio C Hamano <gitster@pobox.com> | |
Tue, 20 Jan 2009 05:58:31 +0000 (21:58 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 20 Jan 2009 05:58:31 +0000 (21:58 -0800) |
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c | patch | blob | history |
diff --git a/sha1_name.c b/sha1_name.c
index f54b6cb36a0a67f6319d3ff56e92bbac55ecd639..4c0370bb796eb7bd69992e1d09cc5ae98df16881 100644 (file)
--- a/sha1_name.c
+++ b/sha1_name.c
int interpret_nth_last_branch(const char *name, struct strbuf *buf)
{
long nth;
- int i;
+ int i, retval;
struct grab_nth_branch_switch_cbdata cb;
const char *brace;
char *num_end;
for (i = 0; i < nth; i++)
strbuf_init(&cb.buf[i], 20);
cb.cnt = 0;
+ retval = 0;
for_each_reflog_ent("HEAD", grab_nth_branch_switch, &cb);
if (cb.cnt < nth)
- return 0;
+ goto release_return;
i = cb.cnt % nth;
strbuf_reset(buf);
strbuf_add(buf, cb.buf[i].buf, cb.buf[i].len);
+ retval = brace-name+1;
+
+release_return:
for (i = 0; i < nth; i++)
strbuf_release(&cb.buf[i]);
free(cb.buf);
- return brace-name+1;
+ return retval;
}
/*