On Tue, Jul 28, 2015 at 1:16 PM, Jacob Keller <jacob.keller@xxxxxxxxx> wrote: > On Tue, Jul 28, 2015 at 12:11 AM, Karthik Nayak <karthik.188@xxxxxxxxx> wrote: >> Add the '--points-at' option provided by 'ref-filter'. The option lets >> the user to list only branches which points at the given object. >> >> Add documentation and tests for the same. >> >> Mentored-by: Christian Couder <christian.couder@xxxxxxxxx> >> Mentored-by: Matthieu Moy <matthieu.moy@xxxxxxxxxxxxxxx> >> Signed-off-by: Karthik Nayak <karthik.188@xxxxxxxxx> >> --- >> Documentation/git-branch.txt | 6 +++++- >> builtin/branch.c | 7 ++++++- >> t/t3203-branch-output.sh | 9 +++++++++ >> 3 files changed, 20 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt >> index 897cd81..efa23a5 100644 >> --- a/Documentation/git-branch.txt >> +++ b/Documentation/git-branch.txt >> @@ -11,7 +11,8 @@ SYNOPSIS >> 'git branch' [--color[=<when>] | --no-color] [-r | -a] >> [--list] [-v [--abbrev=<length> | --no-abbrev]] >> [--column[=<options>] | --no-column] >> - [(--merged | --no-merged | --contains) [<commit>]] [--sort=<key>] [<pattern>...] >> + [(--merged | --no-merged | --contains) [<commit>]] [--sort=<key>] >> + [--points-at <object>] [<pattern>...] >> 'git branch' [--set-upstream | --track | --no-track] [-l] [-f] <branchname> [<start-point>] >> 'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>] >> 'git branch' --unset-upstream [<branchname>] >> @@ -237,6 +238,9 @@ start-point is either a local or remote-tracking branch. >> for-each-ref`. Sort order defaults to sorting based on branch >> type. >> >> +--points-at <object>:: >> + Only list tags of the given object. >> + > > s/tags/branches/ ?? Since this is for the branch version, I think this > is just a copy-paste oversight. > >> Examples >> -------- >> >> diff --git a/builtin/branch.c b/builtin/branch.c >> index 75d8bfd..d25f43b 100644 >> --- a/builtin/branch.c >> +++ b/builtin/branch.c >> @@ -26,6 +26,7 @@ static const char * const builtin_branch_usage[] = { >> N_("git branch [<options>] [-l] [-f] <branch-name> [<start-point>]"), >> N_("git branch [<options>] [-r] (-d | -D) <branch-name>..."), >> N_("git branch [<options>] (-m | -M) [<old-branch>] <new-branch>"), >> + N_("git branch [<options>] [-r | -a] [--points-at]"), >> NULL >> }; >> >> @@ -647,6 +648,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix) >> OPT_COLUMN(0, "column", &colopts, N_("list branches in columns")), >> OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"), >> N_("field name to sort on"), &parse_opt_ref_sorting), >> + { >> + OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"), >> + N_("print only tags of the object"), 0, parse_opt_object_name >> + }, > > Same as above. s/tags/branches/ > >> OPT_END(), >> }; >> >> @@ -675,7 +680,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix) >> if (!delete && !rename && !edit_description && !new_upstream && !unset_upstream && argc == 0) >> list = 1; >> >> - if (filter.with_commit || filter.merge != REF_FILTER_MERGED_NONE) >> + if (filter.with_commit || filter.merge != REF_FILTER_MERGED_NONE || filter.points_at.nr) >> list = 1; >> >> if (!!delete + !!rename + !!new_upstream + >> diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh >> index 38c68bd..1deb7cb 100755 >> --- a/t/t3203-branch-output.sh >> +++ b/t/t3203-branch-output.sh >> @@ -154,4 +154,13 @@ EOF >> test_i18ncmp expect actual >> ' >> >> +test_expect_success 'git branch --points-at option' ' >> + cat >expect <<EOF && >> + master >> + branch-one >> +EOF >> + git branch --points-at=branch-one >actual && >> + test_cmp expect actual >> +' >> + >> test_done >> -- >> 2.4.6 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe git" in >> the body of a message to majordomo@xxxxxxxxxxxxxxx >> More majordomo info at http://vger.kernel.org/majordomo-info.html Copy paste, errors, thanks for pointing out. -- Regards, Karthik Nayak -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html