summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1b23ada)
raw | patch | inline | side by side (parent: 1b23ada)
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Thu, 4 Sep 2008 21:38:08 +0000 (23:38 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 5 Sep 2008 00:01:41 +0000 (17:01 -0700) |
Move the loading of all ref names for decoration into its own function.
A static variable prevents loading twice, because it's quite expensive.
We can do it this way because we currently never unload decorations.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
A static variable prevents loading twice, because it's quite expensive.
We can do it this way because we currently never unload decorations.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-log.c | patch | blob | history |
diff --git a/builtin-log.c b/builtin-log.c
index 1d3c5cbf580f3989d9605ed68f80beb050e19d39..0f164620b9b7b9d0df088f101b725cee632272a4 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
return 0;
}
+void load_ref_decorations(void)
+{
+ static int loaded;
+ if (!loaded) {
+ loaded = 1;
+ for_each_ref(add_ref_decoration, NULL);
+ }
+}
+
static void cmd_log_init(int argc, const char **argv, const char *prefix,
struct rev_info *rev)
{
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
if (!strcmp(arg, "--decorate")) {
- if (!decorate)
- for_each_ref(add_ref_decoration, NULL);
+ load_ref_decorations();
decorate = 1;
} else
die("unrecognized argument: %s", arg);