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

Re: git fetch <remote> <branch> behaves weirdely when run in a worktree

From
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Date
Sep 26, 2018, 04:46 UTC
Message-ID
<39F9931A-B297-4525-A131-736B900F37AF@gmail.com>
In-Reply-To
<90301874969f7b11f33e504500c150a25d722ff8.camel@gmail.com>
Hi,
I just wanted make a point a little more clear. See comment inline.
On 24 September 2018 01:39:26 GMT+05:30, Kaartic Sivaraam <kaartic.sivaraam@gmail.com> wrote:
Show 66 quoted lines
> To add to that
>confusion when I run
>
>   $ cat $MAIN_WORKTREE/.git/worktrees/$BUILD_WORKTREE/FETCH_HEAD
>
>it seems to be printing the info about the remote refs once and then if
>I run it again immediately nothing is printed. If I repeat it again,
>info about remote refs is printed but this time the info about the
>remote refs is printed thrice. This happens randomly. Sample output:
>
>   01:23 $ cat ../git/.git/worktrees/$BUILD_WORKTREE/FETCH_HEAD 
>53f9a3e157dbbc901a02ac2c73346d375e24978c	not-for-merge	branch 'maint'
>of https://github.com/git/git
>150f307afc13961b0322ad0e7205a7b193368586	not-for-merge	branch 'master'
>of https://github.com/git/git
>01d371f741e6f0b0076d9ed942d99bdb23757eac	not-for-merge	branch 'next' of
>https://github.com/git/git
>7a81cbc028be113058e0b55062706ec6de62ed94	not-for-merge	branch 'pu' of
>https://github.com/git/git
>722746685bce03f223ed75febe312495e6c139da	not-for-merge	branch 'todo' of
>https://github.com/git/git
>   01:23 $ cat ../git/.git/worktrees/$BUILD_WORKTREE/FETCH_HEAD 
>   01:23 $ cat ../git/.git/worktrees/$BUILD_WORKTREE/FETCH_HEAD 
>   01:23 $ cat ../git/.git/worktrees/$BUILD_WORKTREE/FETCH_HEAD 
>53f9a3e157dbbc901a02ac2c73346d375e24978c	not-for-merge	branch 'maint'
>of https://github.com/git/git
>150f307afc13961b0322ad0e7205a7b193368586	not-for-merge	branch 'master'
>of https://github.com/git/git
>01d371f741e6f0b0076d9ed942d99bdb23757eac	not-for-merge	branch 'next' of
>https://github.com/git/git
>7a81cbc028be113058e0b55062706ec6de62ed94	not-for-merge	branch 'pu' of
>https://github.com/git/git
>722746685bce03f223ed75febe312495e6c139da	not-for-merge	branch 'todo' of
>https://github.com/git/git
>53f9a3e157dbbc901a02ac2c73346d375e24978c	not-for-merge	branch 'maint'
>of https://github.com/git/git
>150f307afc13961b0322ad0e7205a7b193368586	not-for-merge	branch 'master'
>of https://github.com/git/git
>01d371f741e6f0b0076d9ed942d99bdb23757eac	not-for-merge	branch 'next' of
>https://github.com/git/git
>7a81cbc028be113058e0b55062706ec6de62ed94	not-for-merge	branch 'pu' of
>https://github.com/git/git
>722746685bce03f223ed75febe312495e6c139da	not-for-merge	branch 'todo' of
>https://github.com/git/git
>53f9a3e157dbbc901a02ac2c73346d375e24978c	not-for-merge	branch 'maint'
>of https://github.com/git/git
>150f307afc13961b0322ad0e7205a7b193368586	not-for-merge	branch 'master'
>of https://github.com/git/git
>01d371f741e6f0b0076d9ed942d99bdb23757eac	not-for-merge	branch 'next' of
>https://github.com/git/git
>7a81cbc028be113058e0b55062706ec6de62ed94	not-for-merge	branch 'pu' of
>https://github.com/git/git
>722746685bce03f223ed75febe312495e6c139da	not-for-merge	branch 'todo' of
>https://github.com/git/git
>   01:23 $ cat ../git/.git/worktrees/$BUILD_WORKTREE/FETCH_HEAD 
>53f9a3e157dbbc901a02ac2c73346d375e24978c	not-for-merge	branch 'maint'
>of https://github.com/git/git
>150f307afc13961b0322ad0e7205a7b193368586	not-for-merge	branch 'master'
>of https://github.com/git/git
>01d371f741e6f0b0076d9ed942d99bdb23757eac	not-for-merge	branch 'next' of
>https://github.com/git/git
>7a81cbc028be113058e0b55062706ec6de62ed94	not-for-merge	branch 'pu' of
>https://github.com/git/git
>722746685bce03f223ed75febe312495e6c139da	not-for-merge	branch 'todo' of
>https://github.com/git/git
>
This is the most interesting part of the issue. I **did not** run 'git fetch ...' in between those cat commands. I was surprised by how the contents of FETCH_HEAD are changing without me spawning any git processes that might change it. Am I missing something here? As far as i could remember, there wasn't any IDE running that might automatically spawn git commands especially in that work tree. Weird.
-- 
Sivaraam

Sent from my Android device with K-9 Mail. Please excuse my brevity.
Previous: Kaartic SivaraamNext: Duy Nguyen
Message 6 of 12 in “git fetch <remote> <branch> behaves weirdely when run in a worktree”
  1. Kaartic SivaraamSep 23, 2018
  2. Duy NguyenSep 24, 2018
  3. Kaartic SivaraamSep 25, 2018
  4. Junio C HamanoSep 25, 2018
  5. Kaartic SivaraamSep 26, 2018
  6. Kaartic SivaraamSep 26, 2018
  7. Duy NguyenSep 26, 2018
  8. Duy NguyenSep 26, 2018
  9. Junio C HamanoSep 26, 2018
  10. Kaartic SivaraamOct 2, 2018
  11. Kaartic SivaraamOct 4, 2018
  12. Duy NguyenOct 4, 2018

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.