summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1cdcf6a)
raw | patch | inline | side by side (parent: 1cdcf6a)
author | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 9 Oct 2008 11:09:28 +0000 (13:09 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 9 Oct 2008 11:38:59 +0000 (13:38 +0200) |
NEWS | patch | blob | history | |
tig.c | patch | blob | history |
index 7e219af9846d46f73711c0db3fcabbcfa9c918e9..0b891f9aa8b73266b2e3aea23ab82dec880c9e7e 100644 (file)
--- a/NEWS
+++ b/NEWS
Release notes
=============
+tig master
+----------
+
+Improvements:
+
+ - Display repository references in the sorted order: tags, heads,
+ tracked remotes, remotes.
+
tig-0.12.1
----------
index 5c456e723bf1fea3b55382d3e5fd1b10431159a7..6a1d5c9b26281f5545f0ff0fc53426ab213c389c 100644 (file)
--- a/tig.c
+++ b/tig.c
static size_t id_refs_alloc = 0;
static size_t id_refs_size = 0;
+static int
+compare_refs(const void *ref1_, const void *ref2_)
+{
+ const struct ref *ref1 = *(const struct ref **)ref1_;
+ const struct ref *ref2 = *(const struct ref **)ref2_;
+
+ if (ref1->tag != ref2->tag)
+ return ref2->tag - ref1->tag;
+ if (ref1->ltag != ref2->ltag)
+ return ref2->ltag - ref2->ltag;
+ if (ref1->head != ref2->head)
+ return ref2->head - ref1->head;
+ if (ref1->tracked != ref2->tracked)
+ return ref2->tracked - ref1->tracked;
+ if (ref1->remote != ref2->remote)
+ return ref2->remote - ref1->remote;
+ return strcmp(ref1->name, ref2->name);
+}
+
static struct ref **
get_refs(char *id)
{
}
ref_list = tmp;
- if (ref_list_size > 0)
- ref_list[ref_list_size - 1]->next = 1;
ref_list[ref_list_size] = &refs[i];
-
/* XXX: The properties of the commit chains ensures that we can
* safely modify the shared ref. The repo references will
* always be similar for the same id. */
- ref_list[ref_list_size]->next = 0;
+ ref_list[ref_list_size]->next = 1;
+
ref_list_size++;
}
- if (ref_list)
+ if (ref_list) {
+ qsort(ref_list, ref_list_size, sizeof(*ref_list), compare_refs);
+ ref_list[ref_list_size - 1]->next = 0;
id_refs[id_refs_size++] = ref_list;
+ }
return ref_list;
}
if (check_replace && !strcmp(name, refs[refs_size - 1].name)) {
/* it's an annotated tag, replace the previous sha1 with the
* resolved commit id; relies on the fact git-ls-remote lists
- * the commit id of an annotated tag right beofre the commit id
+ * the commit id of an annotated tag right before the commit id
* it points to. */
refs[refs_size - 1].ltag = ltag;
string_copy_rev(refs[refs_size - 1].id, id);