summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-02-18 13:24:07 -0500
committerEdward Thomson <ethomson@microsoft.com>2015-05-11 14:12:09 -0400
commit7f26b1b9cfcf07a820503dc7597c24914514a242 (patch)
tree00a1378a805d2b43017c30aaecc223e5e5bb22a5
parent35d3976151fca0028523320a994df314241e5851 (diff)
downloadlibgit2-7f26b1b9cfcf07a820503dc7597c24914514a242.tar.gz
stash: use git_commit_summary for a summary
-rw-r--r--src/stash.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/stash.c b/src/stash.c
index dab32552b..f8bba3a72 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -8,6 +8,7 @@
#include "common.h"
#include "repository.h"
#include "commit.h"
+#include "message.h"
#include "tree.h"
#include "reflog.h"
#include "git2/diff.h"
@@ -50,23 +51,14 @@ static int append_abbreviated_oid(git_buf *out, const git_oid *b_commit)
static int append_commit_description(git_buf *out, git_commit* commit)
{
- const char *message;
- size_t pos = 0, len;
+ const char *summary = git_commit_summary(commit);
+ GITERR_CHECK_ALLOC(summary);
if (append_abbreviated_oid(out, git_commit_id(commit)) < 0)
return -1;
- message = git_commit_message(commit);
- len = strlen(message);
-
- /* TODO: Replace with proper commit short message
- * when git_commit_message_short() is implemented.
- */
- while (pos < len && message[pos] != '\n')
- pos++;
-
git_buf_putc(out, ' ');
- git_buf_put(out, message, pos);
+ git_buf_puts(out, summary);
git_buf_putc(out, '\n');
return git_buf_oom(out) ? -1 : 0;