Re: [PATCH v2 8/8] reflog expire: cover reflog from all worktrees

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 29, 2018 at 3:11 PM Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
> diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt
> @@ -72,6 +72,11 @@ Options for `expire`
> +--single-worktree::
> +       By default when `--all` is specified, reflogs from all working
> +       trees are processed. This option limits the processing to reflogs
> +       from the current working tree only.

Bikeshedding: I wonder if this should be named "--this-worktree" or
"--this-worktree-only" or if it should somehow be orthogonal to --all
rather than modifying it. (Genuine questions. I don't have the
answers.)

> diff --git a/builtin/reflog.c b/builtin/reflog.c
> @@ -577,10 +585,18 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
>         if (do_all) {
>                 struct collect_reflog_cb collected;
> +               struct worktree **worktrees, **p;
>                 int i;
>
>                 memset(&collected, 0, sizeof(collected));
> -               for_each_reflog(collect_reflog, &collected);
> +               worktrees = get_worktrees(0);
> +               for (p = worktrees; *p; p++) {
> +                       if (!all_worktrees && !(*p)->is_current)
> +                               continue;
> +                       collected.wt = *p;
> +                       for_each_reflog(collect_reflog, &collected);
> +               }
> +               free_worktrees(worktrees);

Should this have a test in the test suite?



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux