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

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

 



On Wed, Sep 26, 2018 at 05:24:14PM +0200, Duy Nguyen wrote:
> On Wed, Sep 26, 2018 at 6:46 AM Kaartic Sivaraam
> <kaartic.sivaraam@xxxxxxxxx> wrote:
> > 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.

Maybe something like this could help track down that rogue "git fetch"
process (it's definitely _some_ process writing to the wrong file; or
some file synchronization thingy is going on). You can log more of
course, but this is where FETCH_HEAD is updated.

-- 8< --
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 0696abfc2a..0dfb580e92 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -786,6 +786,13 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 	if (!fp)
 		return error_errno(_("cannot open %s"), filename);
 
+	{
+		struct strbuf sb = STRBUF_INIT;
+		strbuf_addf(&sb, "( date; ls -l /proc/%d/cwd ) >>%s.log", getpid(), filename);
+		system(sb.buf);
+		strbuf_release(&sb);
+	}
+
 	if (raw_url)
 		url = transport_anonymize_url(raw_url);
 	else
-- 8< --

--
Duy



[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