summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 28042db)
raw | patch | inline | side by side (parent: 28042db)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Mon, 13 Dec 2010 03:01:14 +0000 (10:01 +0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 13 Dec 2010 06:32:01 +0000 (22:32 -0800) |
This gives callers more control, i.e. which ref will be searched from.
They must prepare the list ordered by committer date.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
They must prepare the list ordered by committer date.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
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 2cc7a42390c246e8ea97c50b4b12d7109d35ba6c..aefae1f524d2bd185702ec0314860c1c136a68a7 100644 (file)
--- a/sha1_name.c
+++ b/sha1_name.c
if (object->type != OBJ_COMMIT)
return 0;
insert_by_date((struct commit *)object, list);
- object->flags |= ONELINE_SEEN;
return 0;
}
-static int get_sha1_oneline(const char *prefix, unsigned char *sha1)
+static int get_sha1_oneline(const char *prefix, unsigned char *sha1,
+ struct commit_list *list)
{
- struct commit_list *list = NULL, *backup = NULL, *l;
+ struct commit_list *backup = NULL, *l;
int found = 0;
regex_t regex;
if (regcomp(®ex, prefix, REG_EXTENDED))
die("Invalid search pattern: %s", prefix);
- for_each_ref(handle_one_ref, &list);
- for (l = list; l; l = l->next)
+ for (l = list; l; l = l->next) {
+ l->item->object.flags |= ONELINE_SEEN;
commit_list_insert(l->item, &backup);
+ }
while (list) {
char *p, *to_free = NULL;
struct commit *commit;
int stage = 0;
struct cache_entry *ce;
int pos;
- if (namelen > 2 && name[1] == '/')
- /* don't need mode for commit */
- return get_sha1_oneline(name + 2, sha1);
+ if (namelen > 2 && name[1] == '/') {
+ struct commit_list *list = NULL;
+ for_each_ref(handle_one_ref, &list);
+ return get_sha1_oneline(name + 2, sha1, list);
+ }
if (namelen < 3 ||
name[2] != ':' ||
name[1] < '0' || '3' < name[1])