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

Re: [PATCH] copy: drop dependency on `the_repository`

From
Patrick Steinhardt <ps@pks.im>
Date
Jul 16, 2026, 15:06 UTC
Message-ID
<aljzZar4sG6IE4-h@pks.im>
In-Reply-To
<27d4d72f-1ab5-4dc3-8cf6-1a9b6883a631@gmail.com>
On Thu, Jul 16, 2026 at 02:41:44PM +0100, Phillip Wood wrote:
Show 18 quoted lines
> > diff --git a/sequencer.c b/sequencer.c
> > index 1355a99a09..c9ede9c02d 100644
> > --- a/sequencer.c
> > +++ b/sequencer.c
> > @@ -2419,7 +2419,7 @@ static int do_pick_commit(struct repository *r,
> >   		} else {
> >   			const char *dest = git_path_squash_msg(r);
> >   			unlink(dest);
> > -			if (copy_file(dest, rebase_path_squash_msg(), 0666)) {
> > +			if (copy_file(the_repository, dest, rebase_path_squash_msg(), 0666)) {
> 
> The path for "dest" is obtained using a local repository instance "r", but
> we're using "the_repository" to set the permissions on that path. While that
> matches the current behavior it is clearly better to use the same repository
> instance to obtain both the path and and permissions for that path. In the
> hunk below we even have "the_repository" and "r" on the same line which
> seems confusing. This patch uses a local repository instance in
> refs/files-backend.c and setup.c, lets do the same here.

Makes sense. In that case though I'll also adapt the two uses of `the_repository` below. Thanks!

Patrick
Show 14 quoted lines
> > @@ -3864,11 +3864,11 @@ static int error_failed_squash(struct repository *r,
> >   			       int subject_len,
> >   			       const char *subject)
> >   {
> > -	if (copy_file(rebase_path_message(), rebase_path_squash_msg(), 0666))
> > +	if (copy_file(the_repository, rebase_path_message(), rebase_path_squash_msg(), 0666))
> >   		return error(_("could not copy '%s' to '%s'"),
> >   			rebase_path_squash_msg(), rebase_path_message());
> >   	unlink(git_path_merge_msg(r));
> > -	if (copy_file(git_path_merge_msg(r), rebase_path_message(), 0666))
> > +	if (copy_file(the_repository, git_path_merge_msg(r), rebase_path_message(), 0666))
> >   		return error(_("could not copy '%s' to '%s'"),
> >   			     rebase_path_message(),
> >   			     git_path_merge_msg(r));
Previous: Phillip WoodNext: Patrick Steinhardt
Message 3 of 6 in “copy: drop dependency on `the_repository`”
  1. copy: drop dependency on `the_repository`Patrick Steinhardt, Jul 16, 2026
  2. Phillip WoodJul 16, 2026
  3. Patrick SteinhardtJul 16, 2026
  4. copy: drop dependency on `the_repository`Patrick Steinhardt, Jul 16, 2026
  5. Phillip WoodJul 17, 2026
  6. Junio C HamanoJul 17, 2026

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.