* 'git worktree repair' can't repair when main and linked worktrees are moved @ 2020-12-04 23:14 Philippe Blain 2020-12-04 23:21 ` Philippe Blain 2020-12-05 9:22 ` Eric Sunshine 0 siblings, 2 replies; 5+ messages in thread From: Philippe Blain @ 2020-12-04 23:14 UTC (permalink / raw) To: Git mailing list; +Cc: Eric Sunshine Hello, I've had to move all my Git clones to a new filesystem. Several of them use secondary worktrees, and all are at the same level ex: $ ls code git git2 git3 other other2 other3 ... I had hoped to use the new 'git worktree repair' command but it seems it does not work for this use case. I tried several things: ( cd git && git repair ) ( cd git && git repair ../git2 ) ( cd git && git repair /old/path/to/old/filesystem/git2 ) ( cd git2 && git repair /old/path/to/old/filesystem/git2 ) ( cd git2 && git repair ../git ) None of them work. Note that /old/path/to/old/filesystem/ does not exist anymore. Is this supposed to work ? Or it's not something that 'git worktree repair' can currently cope with ? P.S. I know how to repair the worktrees manuallly, I just wanted to test if 'repair' could help me. Cheers, Philippe. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 'git worktree repair' can't repair when main and linked worktrees are moved 2020-12-04 23:14 'git worktree repair' can't repair when main and linked worktrees are moved Philippe Blain @ 2020-12-04 23:21 ` Philippe Blain 2020-12-05 9:22 ` Eric Sunshine 1 sibling, 0 replies; 5+ messages in thread From: Philippe Blain @ 2020-12-04 23:21 UTC (permalink / raw) To: Git mailing list; +Cc: Eric Sunshine > Le 4 déc. 2020 à 18:14, Philippe Blain <levraiphilippeblain@gmail.com> a écrit : > > I tried several things: > > ( cd git && git repair ) Oups, please read 'git worktree repair' here and below. > ( cd git && git repair ../git2 ) > ( cd git && git repair /old/path/to/old/filesystem/git2 ) > ( cd git2 && git repair /old/path/to/old/filesystem/git2 ) > ( cd git2 && git repair ../git ) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 'git worktree repair' can't repair when main and linked worktrees are moved 2020-12-04 23:14 'git worktree repair' can't repair when main and linked worktrees are moved Philippe Blain 2020-12-04 23:21 ` Philippe Blain @ 2020-12-05 9:22 ` Eric Sunshine 2020-12-08 17:42 ` Eric Sunshine 1 sibling, 1 reply; 5+ messages in thread From: Eric Sunshine @ 2020-12-05 9:22 UTC (permalink / raw) To: Philippe Blain; +Cc: Git mailing list On Fri, Dec 4, 2020 at 6:14 PM Philippe Blain <levraiphilippeblain@gmail.com> wrote: > I've had to move all my Git clones to a new filesystem. > Several of them use secondary worktrees, and all are > at the same level ex: > > I had hoped to use the new 'git worktree repair' command > but it seems it does not work for this use case. > > Is this supposed to work ? Or it's not something that > 'git worktree repair' can currently cope with ? This is a situation which `git worktree repair` can not yet handle. The implementation of bare bones `git worktree repair` was sufficiently complex that I decided that additional cases like this and other bells and whistles should be built later atop the basic implementation. At present, only the following cases are handled: * secondary worktree has moved so main worktree doesn't know where it is, but secondary worktree still knows where main worktree is, thus `git worktree repair` within the secondary can contact the main and fix up main's reference to the secondary * main worktree has moved so secondary worktrees don't know where it is, but main worktree still knows where secondary worktrees are, thus `git worktree repair` within main can contact each secondary and fix up their references back to main There was a little discussion during review[1,2,3] about how the situation might be handled in which both main and secondary worktrees have been moved. Primarily, a new command-line option would be added allowing the user to tell `git worktree repair` where the main worktree is, in addition to also giving the paths to the secondary worktrees as arguments (the latter of which is already supported). Now that I'm thinking about it, I realize also that if invoked in the main worktree, then `git worktree repair` can recognize that it is operating in the main worktree (and infer the value of the new command-line option for specifying location of the main worktree), thus the user would only have to supply paths to the secondary worktrees as arguments. My main concern with inferring too much automatically is that the command could be used to hijack a worktree belonging to another repository (but perhaps that's a case of "don't do it if it hurts"). Of course, we could also get more fancy and provide some way to specify path transformations. For instance, `git worktree repair --map-path=/old/path:/new/path` might make it possible to repair links in both directions by applying the path transformation to the paths involved in the repair. However, this idea is barely germinated; it's far less well thought out than the previous one. [1]: https://lore.kernel.org/git/CAPig+cT-w6LV490MGNyG_ihWkSzdgfnEBrjQCsafjndTRmMgFA@mail.gmail.com/ [2]: https://lore.kernel.org/git/xmqqlfi0qaru.fsf@gitster.c.googlers.com/ [3]: https://lore.kernel.org/git/CAPig+cT-ipENZQ39wpaGukRzx3d52OatKEXjWc3_mv56jMbDRg@mail.gmail.com/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 'git worktree repair' can't repair when main and linked worktrees are moved 2020-12-05 9:22 ` Eric Sunshine @ 2020-12-08 17:42 ` Eric Sunshine 2020-12-08 22:27 ` Philippe Blain 0 siblings, 1 reply; 5+ messages in thread From: Eric Sunshine @ 2020-12-08 17:42 UTC (permalink / raw) To: Philippe Blain; +Cc: Git mailing list On Sat, Dec 5, 2020 at 4:22 AM Eric Sunshine <sunshine@sunshineco.com> wrote: > On Fri, Dec 4, 2020 at 6:14 PM Philippe Blain > <levraiphilippeblain@gmail.com> wrote: > > I've had to move all my Git clones to a new filesystem. > > Several of them use secondary worktrees [...] > > I had hoped to use the new 'git worktree repair' command > > but it seems it does not work for this use case. > > This is a situation which `git worktree repair` can not yet handle. A patch[1] addressing this shortcoming has been posted. [1]: https://lore.kernel.org/git/20201208173705.5770-1-sunshine@sunshineco.com/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 'git worktree repair' can't repair when main and linked worktrees are moved 2020-12-08 17:42 ` Eric Sunshine @ 2020-12-08 22:27 ` Philippe Blain 0 siblings, 0 replies; 5+ messages in thread From: Philippe Blain @ 2020-12-08 22:27 UTC (permalink / raw) To: Eric Sunshine; +Cc: Git mailing list Hi Eric, Le mar. 8 déc. 2020, à 12 h 42, Eric Sunshine <sunshine@sunshineco.com> a écrit : > > On Sat, Dec 5, 2020 at 4:22 AM Eric Sunshine <sunshine@sunshineco.com> wrote: > > On Fri, Dec 4, 2020 at 6:14 PM Philippe Blain > > <levraiphilippeblain@gmail.com> wrote: > > > I've had to move all my Git clones to a new filesystem. > > > Several of them use secondary worktrees [...] > > > I had hoped to use the new 'git worktree repair' command > > > but it seems it does not work for this use case. > > > > This is a situation which `git worktree repair` can not yet handle. > > A patch[1] addressing this shortcoming has been posted. > > [1]: https://lore.kernel.org/git/20201208173705.5770-1-sunshine@sunshineco.com/ Great! I'll try to take a look. Thanks, Philippe. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-08 22:28 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-12-04 23:14 'git worktree repair' can't repair when main and linked worktrees are moved Philippe Blain 2020-12-04 23:21 ` Philippe Blain 2020-12-05 9:22 ` Eric Sunshine 2020-12-08 17:42 ` Eric Sunshine 2020-12-08 22:27 ` Philippe Blain
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).