git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH 11/11] branch: add '--points-at' option

From
Jacob Keller <jacob.keller@gmail.com>
Date
Jul 28, 2015, 07:46 UTC
Message-ID
<CA+P7+xp6FKDw26Qudi+kHi+CQ-rB1BFwOQdk65VyyAwTRW=vGg@mail.gmail.com>
In-Reply-To
<1438067468-6835-2-git-send-email-Karthik.188@gmail.com>
On Tue, Jul 28, 2015 at 12:11 AM, Karthik Nayak <karthik.188@gmail.com> wrote:
Show 35 quoted lines
> 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@gmail.com>
> Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
> ---
>  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.

Show 23 quoted lines
>  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/
Show 37 quoted lines
>                 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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Karthik NayakNext: Karthik Nayak
Message 83 of 88 in “Port branch.c to use ref-filter APIs”
  1. Port branch.c to use ref-filter APIsKarthik Nayak, Jul 28, 2015
  2. 01/11 ref-filter: add "%(objectname:size=X)" optionKarthik Nayak, Jul 28, 2015
  3. 02/11 ref-filter: add 'colornext' atomKarthik Nayak, Jul 28, 2015
  4. Matthieu MoyJul 28, 2015
  5. Karthik NayakJul 28, 2015
  6. Christian CouderJul 28, 2015
  7. Karthik NayakJul 28, 2015
  8. Eric SunshineJul 29, 2015
  9. Matthieu MoyJul 29, 2015
  10. Jacob KellerJul 30, 2015
  11. Junio C HamanoJul 30, 2015
  12. Karthik NayakAug 1, 2015
  13. 03/11 ref-filter: add option to filter only branchesKarthik Nayak, Jul 28, 2015
  14. Matthieu MoyJul 28, 2015
  15. Karthik NayakJul 28, 2015
  16. 04/11 ref-filter: add 'ifexists' atomKarthik Nayak, Jul 28, 2015
  17. Jacob KellerJul 28, 2015
  18. Karthik NayakJul 28, 2015
  19. Matthieu MoyJul 28, 2015
  20. Karthik NayakJul 28, 2015
  21. Junio C HamanoJul 28, 2015
  22. Karthik NayakJul 29, 2015
  23. Junio C HamanoJul 29, 2015
  24. Junio C HamanoJul 29, 2015
  25. Matthieu MoyJul 29, 2015
  26. Junio C HamanoJul 29, 2015
  27. Karthik NayakAug 1, 2015
  28. Jacob KellerAug 1, 2015
  29. Karthik NayakAug 1, 2015
  30. 05/11 branch: fix width computationKarthik Nayak, Jul 28, 2015
  31. Matthieu MoyJul 28, 2015
  32. Karthik NayakJul 28, 2015
  33. 06/11 branch: roll show_detached HEAD into regular ref_listKarthik Nayak, Jul 28, 2015
  34. Matthieu MoyJul 28, 2015
  35. Karthik NayakJul 28, 2015
  36. Matthieu MoyJul 29, 2015
  37. Karthik NayakJul 29, 2015
  38. 07/11 branch: move 'current' check down to the presentation layerKarthik Nayak, Jul 28, 2015
  39. Matthieu MoyJul 28, 2015
  40. Karthik NayakJul 28, 2015
  41. Jacob KellerJul 29, 2015
  42. Karthik NayakJul 29, 2015
  43. Matthieu MoyJul 29, 2015
  44. Karthik NayakJul 29, 2015
  45. Matthieu MoyJul 29, 2015
  46. Karthik NayakAug 1, 2015
  47. Jacob KellerAug 1, 2015
  48. Eric SunshineAug 1, 2015
  49. Karthik NayakAug 2, 2015
  50. Junio C HamanoAug 2, 2015
  51. 08/11 branch: drop non-commit error reportingKarthik Nayak, Jul 28, 2015
  52. 09/11 branch.c: use 'ref-filter' data structuresKarthik Nayak, Jul 28, 2015
  53. Christian CouderJul 28, 2015
  54. Matthieu MoyJul 28, 2015
  55. Karthik NayakJul 28, 2015
  56. Matthieu MoyJul 29, 2015
  57. Karthik NayakJul 29, 2015
  58. Karthik NayakJul 28, 2015
  59. Christian CouderJul 28, 2015
  60. Karthik NayakJul 28, 2015
  61. Matthieu MoyJul 28, 2015
  62. Karthik NayakJul 28, 2015
  63. Junio C HamanoJul 28, 2015
  64. Karthik NayakJul 28, 2015
  65. Junio C HamanoJul 28, 2015
  66. Karthik NayakJul 29, 2015
  67. 10/11 branch.c: use 'ref-filter' APIsKarthik Nayak, Jul 28, 2015
  68. Jacob KellerJul 28, 2015
  69. Karthik NayakJul 29, 2015
  70. Christian CouderJul 28, 2015
  71. Karthik NayakJul 29, 2015
  72. Matthieu MoyJul 28, 2015
  73. Karthik NayakJul 29, 2015
  74. Matthieu MoyJul 29, 2015
  75. Karthik NayakJul 29, 2015
  76. Matthieu MoyJul 29, 2015
  77. Karthik NayakJul 30, 2015
  78. Matthieu MoyJul 30, 2015
  79. Karthik NayakAug 3, 2015
  80. Matthieu MoyAug 19, 2015
  81. Karthik NayakAug 19, 2015
  82. 11/11 branch: add '--points-at' optionKarthik Nayak, Jul 28, 2015
  83. Jacob KellerJul 28, 2015
  84. Karthik NayakJul 29, 2015
  85. Matthieu MoyJul 28, 2015
  86. Karthik NayakJul 28, 2015
  87. Matthieu MoyJul 28, 2015
  88. Karthik NayakJul 29, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.