summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorWill Palmer <wmpalmer@gmail.com>2010-05-04 03:18:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-05-04 22:38:58 (GMT)
commitc197702156e2164074327f5e870ab0d3021977fc (patch)
tree072768fbbd361d76448e90d508f7914afc8071d7 /pretty.c
parent600372497c668045a365b9eab76987ee19405f7a (diff)
downloadgit-c197702156e2164074327f5e870ab0d3021977fc.zip
git-c197702156e2164074327f5e870ab0d3021977fc.tar.gz
git-c197702156e2164074327f5e870ab0d3021977fc.tar.bz2
pretty: Respect --abbrev option
Prior to this, the output of git log -1 --format=%h was always 7 characters long, without regard to whether --abbrev had been passed. Signed-off-by: Will Palmer <wmpalmer@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/pretty.c b/pretty.c
index d493cad..6b3550b 100644
--- a/pretty.c
+++ b/pretty.c
@@ -716,7 +716,7 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
if (add_again(sb, &c->abbrev_commit_hash))
return 1;
strbuf_addstr(sb, find_unique_abbrev(commit->object.sha1,
- DEFAULT_ABBREV));
+ c->pretty_ctx->abbrev));
c->abbrev_commit_hash.len = sb->len - c->abbrev_commit_hash.off;
return 1;
case 'T': /* tree hash */
@@ -726,7 +726,7 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
if (add_again(sb, &c->abbrev_tree_hash))
return 1;
strbuf_addstr(sb, find_unique_abbrev(commit->tree->object.sha1,
- DEFAULT_ABBREV));
+ c->pretty_ctx->abbrev));
c->abbrev_tree_hash.len = sb->len - c->abbrev_tree_hash.off;
return 1;
case 'P': /* parent hashes */
@@ -743,7 +743,8 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
if (p != commit->parents)
strbuf_addch(sb, ' ');
strbuf_addstr(sb, find_unique_abbrev(
- p->item->object.sha1, DEFAULT_ABBREV));
+ p->item->object.sha1,
+ c->pretty_ctx->abbrev));
}
c->abbrev_parent_hashes.len = sb->len -
c->abbrev_parent_hashes.off;