From: Junio C Hamano Date: Sun, 5 Apr 2009 06:04:50 +0000 (-0700) Subject: Merge branch 'cc/sha1-bsearch' into HEAD X-Git-Tag: v1.6.3-rc0~7^2~11 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/5aaa507b067ca22324c34308cb56bcb64392a5db?ds=inline;hp=-c Merge branch 'cc/sha1-bsearch' into HEAD * cc/sha1-bsearch: (95 commits) patch-ids: use the new generic "sha1_pos" function to lookup sha1 sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1 Update draft release notes to 1.6.3 GIT 1.6.2.2 send-email: ensure quoted addresses are rfc2047 encoded send-email: correct two tests which were going interactive Documentation: git-svn: fix trunk/fetch svn-remote key typo Mailmap: Allow empty email addresses to be mapped Cleanup warning about known issues in cvsimport documentation Documentation: Remove an odd "instead" send-email: ask_default should apply to all emails, not just the first send-email: don't attempt to prompt if tty is closed fix portability problem with IS_RUN_COMMAND_ERR Documentation: use "spurious .sp" XSLT if DOCBOOK_SUPPRESS_SP is set mailmap: resurrect lower-casing of email addresses builtin-clone.c: no need to strdup for setenv builtin-clone.c: make junk_pid static git-svn: add a double quiet option to hide git commits Update draft release notes to 1.6.2.2 Documentation: push.default applies to all remotes ... --- 5aaa507b067ca22324c34308cb56bcb64392a5db diff --combined Makefile index 9fa2928357,7867eaccdb..42cabe8162 --- a/Makefile +++ b/Makefile @@@ -263,6 -263,18 +263,18 @@@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__pow BASIC_CFLAGS = BASIC_LDFLAGS = + # Guard against environment variables + BUILTIN_OBJS = + BUILT_INS = + COMPAT_CFLAGS = + COMPAT_OBJS = + LIB_H = + LIB_OBJS = + PROGRAMS = + SCRIPT_PERL = + SCRIPT_SH = + TEST_PROGRAMS = + SCRIPT_SH += git-am.sh SCRIPT_SH += git-bisect.sh SCRIPT_SH += git-filter-branch.sh @@@ -420,7 -432,6 +432,7 @@@ LIB_OBJS += archive-tar. LIB_OBJS += archive-zip.o LIB_OBJS += attr.o LIB_OBJS += base85.o +LIB_OBJS += bisect.o LIB_OBJS += blob.o LIB_OBJS += branch.o LIB_OBJS += bundle.o diff --combined refs.c index 2d198a1add,26b001453b..e5468967eb --- a/refs.c +++ b/refs.c @@@ -647,24 -647,19 +647,24 @@@ int for_each_ref(each_ref_fn fn, void * return do_for_each_ref("refs/", fn, 0, 0, cb_data); } +int for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb_data) +{ + return do_for_each_ref(prefix, fn, strlen(prefix), 0, cb_data); +} + int for_each_tag_ref(each_ref_fn fn, void *cb_data) { - return do_for_each_ref("refs/tags/", fn, 10, 0, cb_data); + return for_each_ref_in("refs/tags/", fn, cb_data); } int for_each_branch_ref(each_ref_fn fn, void *cb_data) { - return do_for_each_ref("refs/heads/", fn, 11, 0, cb_data); + return for_each_ref_in("refs/heads/", fn, cb_data); } int for_each_remote_ref(each_ref_fn fn, void *cb_data) { - return do_for_each_ref("refs/remotes/", fn, 13, 0, cb_data); + return for_each_ref_in("refs/remotes/", fn, cb_data); } int for_each_rawref(each_ref_fn fn, void *cb_data) @@@ -742,6 -737,16 +742,16 @@@ int check_ref_format(const char *ref } } + const char *prettify_ref(const struct ref *ref) + { + const char *name = ref->name; + return name + ( + !prefixcmp(name, "refs/heads/") ? 11 : + !prefixcmp(name, "refs/tags/") ? 10 : + !prefixcmp(name, "refs/remotes/") ? 13 : + 0); + } + const char *ref_rev_parse_rules[] = { "%.*s", "refs/%.*s", diff --combined refs.h index abb125754d,68c2d16d53..2f6a8af608 --- a/refs.h +++ b/refs.h @@@ -20,7 -20,6 +20,7 @@@ struct ref_lock typedef int each_ref_fn(const char *refname, const unsigned char *sha1, int flags, void *cb_data); extern int head_ref(each_ref_fn, void *); extern int for_each_ref(each_ref_fn, void *); +extern int for_each_ref_in(const char *, each_ref_fn, void *); extern int for_each_tag_ref(each_ref_fn, void *); extern int for_each_branch_ref(each_ref_fn, void *); extern int for_each_remote_ref(each_ref_fn, void *); @@@ -80,6 -79,8 +80,8 @@@ extern int for_each_reflog(each_ref_fn #define CHECK_REF_FORMAT_WILDCARD (-3) extern int check_ref_format(const char *target); + extern const char *prettify_ref(const struct ref *ref); + /** rename ref, return 0 on success **/ extern int rename_ref(const char *oldref, const char *newref, const char *logmsg);