Add tracking info for log subcommand#106
Conversation
cb306a0 to
05a30ec
Compare
05a30ec to
81992bd
Compare
I looked at the extra |
| } | ||
| } | ||
|
|
||
| git_strarray_dispose(&tag_names); |
There was a problem hiding this comment.
This is not exception-safe. However, we cannot use the git_strarray_wrapper here, since this class actually wraps a git_strarray whose elements point to already allocating strings (and thus, git_strarray_dispose is not called in the destructor to avoid double deletion).
Which leads me to think that the current git_strarray_wrapper is probably badly named. And that we should have a git_strarray_wrapper that frees both git_strarray elements and the array itself.
But this implies refactoring and goes beyond the scope of this PR, so let's add a TODO here and open an issue to track it when we merge this PR.
| std::string branch_name; | ||
| branch_name = branch->name(); |
There was a problem hiding this comment.
| std::string branch_name; | |
| branch_name = branch->name(); | |
| std::string branch_name = branch->name(); |
There was a problem hiding this comment.
I wrote it this way because it's not happy with the one line option:
error: conversion from 'std::string_view' {aka 'std::basic_string_view<char>'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
There was a problem hiding this comment.
How about
std::string branch_name(branch->name());instead, which works for me on macos?
There was a problem hiding this comment.
I missed that the return type of branch::name was std::string_view. In that case the correct solution is the line from Ian.
| return tags; | ||
| } | ||
|
|
||
| std::vector<std::string> get_branches_for_commit(repository_wrapper& repo, git_branch_t type, const git_oid* commit_oid, const std::string exclude_branch) |
There was a problem hiding this comment.
commit_oid should be passed by reference insteadof pointer.
| } | ||
| }; | ||
|
|
||
| commit_refs get_refs_for_commit(repository_wrapper& repo, const git_oid* commit_oid) |
There was a problem hiding this comment.
commit_oid should be passed by reference instead of pointer.
| return refs; | ||
| } | ||
|
|
||
| void print_refs(commit_refs refs) |
There was a problem hiding this comment.
refs should be passed by constant reference.
cb729f2 to
807cb09
Compare
| } | ||
|
|
||
| void print_commit(const commit_wrapper& commit, std::string m_format_flag) | ||
| std::vector<std::string> get_tags_for_commit(repository_wrapper& repo, const git_oid* commit_oid) |
There was a problem hiding this comment.
The commit_oid parameter should be passed by reference.


Fix #90
Add tracking info for log subcommand