From: Junio C Hamano Date: Mon, 3 Mar 2008 09:20:19 +0000 (-0800) Subject: Merge commit '74359821' into js/reflog-delete X-Git-Tag: v1.5.5-rc0~56^2~3 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f830d45b9fdb04a5d79c25bb3a3d891d8d3b58e9?ds=inline;hp=-c Merge commit '74359821' into js/reflog-delete * commit '74359821': (128 commits) tests: introduce test_must_fail Fix builtin checkout crashing when given an invalid path templates/Makefile: don't depend on local umask setting Correct name of diff_flush() in API documentation Start preparing for 1.5.4.4 format-patch: remove a leftover debugging message completion: support format-patch's --cover-letter option Eliminate confusing "won't bisect on seeked tree" failure builtin-reflog.c: don't install new reflog on write failure send-email: fix In-Reply-To regression git-svn: Don't prompt for client cert password everytime. git.el: Do not display empty directories. Fix 'git cvsexportcommit -w $cvsdir ...' when used with relative $GIT_DIR Add testcase for 'git cvsexportcommit -w $cvsdir ...' with relative $GIT_DIR Prompt to continue when editing during rebase --interactive Documentation/git svn log: add a note about timezones. git-p4: Support usage of perforce client spec git-p4: git-p4 submit cleanups. git-p4: Removed git-p4 submit --direct. git-p4: Clean up git-p4 submit's log message handling. ... --- f830d45b9fdb04a5d79c25bb3a3d891d8d3b58e9 diff --combined refs.c index bc654299c9,c979fb1d95..1b0050eee4 --- a/refs.c +++ b/refs.c @@@ -157,6 -157,7 +157,7 @@@ static struct cached_refs struct ref_list *loose; struct ref_list *packed; } cached_refs; + static struct ref_list *current_ref; static void free_ref_list(struct ref_list *list) { @@@ -476,6 -477,7 +477,7 @@@ static int do_one_ref(const char *base error("%s does not point to a valid object!", entry->name); return 0; } + current_ref = entry; return fn(entry->name + trim, entry->sha1, entry->flag, cb_data); } @@@ -485,6 -487,16 +487,16 @@@ int peel_ref(const char *ref, unsigned unsigned char base[20]; struct object *o; + if (current_ref && (current_ref->name == ref + || !strcmp(current_ref->name, ref))) { + if (current_ref->flag & REF_KNOWS_PEELED) { + hashcpy(sha1, current_ref->peeled); + return 0; + } + hashcpy(base, current_ref->sha1); + goto fallback; + } + if (!resolve_ref(ref, base, 1, &flag)) return -1; @@@ -504,9 -516,9 +516,9 @@@ } } - /* fallback - callers should not call this for unpacked refs */ + fallback: o = parse_object(base); - if (o->type == OBJ_TAG) { + if (o && o->type == OBJ_TAG) { o = deref_tag(o, ref, 0); if (o) { hashcpy(sha1, o->sha1); @@@ -519,7 -531,7 +531,7 @@@ static int do_for_each_ref(const char *base, each_ref_fn fn, int trim, void *cb_data) { - int retval; + int retval = 0; struct ref_list *packed = get_packed_refs(); struct ref_list *loose = get_loose_refs(); @@@ -539,15 -551,18 +551,18 @@@ } retval = do_one_ref(base, fn, trim, cb_data, entry); if (retval) - return retval; + goto end_each; } for (packed = packed ? packed : loose; packed; packed = packed->next) { retval = do_one_ref(base, fn, trim, cb_data, packed); if (retval) - return retval; + goto end_each; } - return 0; + + end_each: + current_ref = NULL; + return retval; } int head_ref(each_ref_fn fn, void *cb_data) @@@ -1018,7 -1033,7 +1033,7 @@@ int rename_ref(const char *oldref, cons return 1; } -static int close_ref(struct ref_lock *lock) +int close_ref(struct ref_lock *lock) { if (close_lock_file(lock->lk)) return -1; @@@ -1026,7 -1041,7 +1041,7 @@@ return 0; } -static int commit_ref(struct ref_lock *lock) +int commit_ref(struct ref_lock *lock) { if (commit_lock_file(lock->lk)) return -1;