aboutsummaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2009-08-15 16:23:12 +0200
committerJunio C Hamano <gitster@pobox.com>2009-08-26 12:05:58 -0700
commitd8526a4c3b31d91b623f698be6ed7552ed4fdc52 (patch)
tree6cf828ca0790e42da48c2fe1fde37eaa3a48cace /log-tree.c
parent8d9518439595c9d2c601e841a6792d9ee30f9293 (diff)
downloadgit-d8526a4c3b31d91b623f698be6ed7552ed4fdc52.tar.gz
git-d8526a4c3b31d91b623f698be6ed7552ed4fdc52.tar.xz
git-log: allow --decorate[=short|full]
Commit de435ac0 changed the behavior of --decorate from printing the full ref (e.g., "refs/heads/master") to a shorter, more human-readable version (e.g., just "master"). While this is nice for human readers, external tools using the output from "git log" may prefer the full version. This patch introduces an extension to --decorate to allow the caller to specify either the short or the full versions. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/log-tree.c b/log-tree.c
index a3b4c0692..1c9eefee3 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -25,7 +25,8 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
struct object *obj = parse_object(sha1);
if (!obj)
return 0;
- refname = prettify_refname(refname);
+ if (!cb_data || *(int *)cb_data == DECORATE_SHORT_REFS)
+ refname = prettify_refname(refname);
add_name_decoration("", refname, obj);
while (obj->type == OBJ_TAG) {
obj = ((struct tag *)obj)->tagged;
@@ -36,12 +37,12 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
return 0;
}
-void load_ref_decorations(void)
+void load_ref_decorations(int flags)
{
static int loaded;
if (!loaded) {
loaded = 1;
- for_each_ref(add_ref_decoration, NULL);
+ for_each_ref(add_ref_decoration, &flags);
}
}