Re: [PATCH 3/5] worktree: teach "repair" to fix outgoing links to worktrees

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

 



Hi Eric,

On Thu, 27 Aug 2020, Eric Sunshine wrote:

> diff --git a/worktree.c b/worktree.c
> index 029ce91fdf..6ade4f0d8b 100644
> --- a/worktree.c
> +++ b/worktree.c
> @@ -624,3 +624,77 @@ void repair_worktrees(worktree_repair_cb *cb, void *cb_data)
>  		repair_dotgit(*wt, cb, cb_data);
>  	free_worktrees(worktrees);
>  }
> +
> +static int is_main_worktree_path(const char *path)
> +{
> +	struct strbuf target = STRBUF_INIT;
> +	struct strbuf main = STRBUF_INIT;
> +	int cmp;
> +
> +	strbuf_add_real_path(&target, path);
> +	strbuf_strip_suffix(&target, "/.git");
> +	strbuf_add_real_path(&main, get_git_common_dir());
> +	strbuf_strip_suffix(&main, "/.git");
> +	cmp = fspathcmp(main.buf, target.buf);
> +
> +	strbuf_release(&main);
> +	strbuf_release(&target);
> +	return !cmp;
> +}

This breaks our `linux-gcc` job, and I need this on top, to make it even
build:

-- snipsnap --
From: Johannes Schindelin <johannes.schindelin@xxxxxx>
Subject: [PATCH] fixup??? worktree: teach "repair" to fix outgoing links to worktrees

This is needed to shut up GCC's "‘main’ is usually a function
[-Werror=main]" error.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---
 worktree.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/worktree.c b/worktree.c
index 6ade4f0d8b2b..5471915d4680 100644
--- a/worktree.c
+++ b/worktree.c
@@ -628,16 +628,16 @@ void repair_worktrees(worktree_repair_cb *cb, void *cb_data)
 static int is_main_worktree_path(const char *path)
 {
 	struct strbuf target = STRBUF_INIT;
-	struct strbuf main = STRBUF_INIT;
+	struct strbuf main_worktree = STRBUF_INIT;
 	int cmp;

 	strbuf_add_real_path(&target, path);
 	strbuf_strip_suffix(&target, "/.git");
-	strbuf_add_real_path(&main, get_git_common_dir());
-	strbuf_strip_suffix(&main, "/.git");
-	cmp = fspathcmp(main.buf, target.buf);
+	strbuf_add_real_path(&main_worktree, get_git_common_dir());
+	strbuf_strip_suffix(&main_worktree, "/.git");
+	cmp = fspathcmp(main_worktree.buf, target.buf);

-	strbuf_release(&main);
+	strbuf_release(&main_worktree);
 	strbuf_release(&target);
 	return !cmp;
 }
--
2.28.0.windows.1

[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