From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.173 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796540503; b=D8elonwWyC38hdwDTdNLq7nntmtp6m0vjcKNrIN1wrVYZ3UnzuNq2VCtyNzaumMKuTq/ FYQd88gmB615kzwdq8mtirSan3/SlshymYhzNPKpcFDyzu19xEpyROhzhCwAwiPeB709Z Ww8vFRA5zZen0EF2cBxMD04sJuHtPlBZBLSWUgzwcS5WogoeSGzB1DqgA6nUqtc1Pd+eR ES87P+K4pAF6PmxlM25qS3r8nX7DEHkwFJCMdynxdrNyU192SYJmtPhQ2+6URl0dld0X8 G53G2HKMZ7BLxLCuFOuWwMyiASYQrcpd5UGw3T8piv5/vD4NgH5OS/q4TadvG1U40JQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796540503; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=mvt1785YOmcRrH6L0+qJTGzxljZBLMX+NUfd+DPlacc=; b=OVJ1SQz8QFH8aI16yumJcQ/LCp2CA9pVUFpITPPj0xprwMXA3ebHTcIStLwDPv2Nco9p 7uu+jRrI7SWF2HJpBwj4dW0SamkpewYyA/6HddwkvP1LalMGDdqqtpVLLJ3hXy8XG17FN xM7rEUWkywE6EHxFNC2gRB32NdTaxBog62lwaRN6PehDjRUyLD2lHYapjyMt/BkYofxk5 Wju7+oCEuSIRcVaIyIfs/47V90u/Mzx3Rma+GeD+T32u71Xgs+hMbNWJWtWAnccs3HPol 7isn2trz8veivWaS+Scet5lsWXyDYABwETHrf9Flp9gKKpuDiEo8wvq4gsLk0BWciZA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=yW65eJ2D; arc=none smtp.remote-ip=74.125.82.173 Received: from mail-dy1-f173.google.com (mail-dy1-f173.google.com [74.125.82.173]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDFB0606A31F for ; Sun, 6 Dec 2026 07:01:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CDFB0606A31F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=yW65eJ2D Received: by mail-dy1-f173.google.com with SMTP id 5a478bee46e88-3874cf7625cso2881079eec.0 for ; Sat, 05 Dec 2026 23:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796540502; x=1797145302; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mvt1785YOmcRrH6L0+qJTGzxljZBLMX+NUfd+DPlacc=; b=yW65eJ2DxOqiWYUa8gHhkmgy/Ro0tGq1VxLyRSXfXIsbvZoqbRuQ07c0HRVBSJM9po shqlym3k3WTE7XEkh3YbsV0vjNLIrl1GCA8OKzp7kzAK4l977Z29+AbhWlEkKSaqbvTO 3ok1DThrldeAHv42so8Ot9haNLzi375+K4SeJLTpZ3vsxBzzLjVoGcwW+wUgxdmM84gy 9JAPoQ9WJAtyHd+wJY23SQTYpyZZbFCGVk7Pa/uSPW6W1WIwn/qjw7saF7E8ds6pnMYQ I125zwZBu2/fZUB08pARRswid6aO+p06MaZKJvIHZSzc0DtdOxXJE/lqRHpjENO+4FLs fwkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796540502; x=1797145302; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=mvt1785YOmcRrH6L0+qJTGzxljZBLMX+NUfd+DPlacc=; b=N+m/zeBgyd+2wqWFkYI1LQzTPMi1UkZVIgreKwNtxGKphVxyGTyiKMyt19j3ViFiS5 lf96tMcwu0elzZKmb9LIgowWvqAn35I8bjGVXvJNdRCvawIZ8DqBcIwIyUcKEfOh/lGf KLHwPPxpEQKDnO8bKVXtnrzGVIA3cvtXFy2+LLprrbcWm2MSyR5UABUklvDFDOPZVsJS +Jj3LApeP0HGcDjKHTRKS+uzOvUFtnK0S3GeB3ZeT38m5HhZlobTnjmZ7TAygw01mTQY 9GzzeixcRzwwjj8VZA2bRi+oEakoYkZDxmpqfvvG5ax5Sq1ETdGszTVCuSjVdAL0wYaz WLvw== X-Gm-Message-State: AB4q+uGzYLY6DHY3SRbwPWysq1Ob1DdG6Kcr6AkrkvldFEppPJTs06cC mU/hqLQQtMLVjOPBYZWKpVpMQguy3feRAWaBNnfOpEMBhJQ7R5TUmb0Y8LKPLRsK X-Gm-Gg: AZFdTZdFMRLKfKLEVOshUt9C139KMWKsYBdmR5LlR+zUF53UwuscNpvbvDfWpA0Ykqn 9ssq0bjxJ9VjqlLXpUt39KJV6wUaY/vMM//W/FeLU15bFyICg7PlOChbzyyOjfJtff7sTa25oR3 nzruoHJ6rwlF3BQmraa+Idn/4xntXhoD0AsgHkWCdaRdi2RTtGJuvB/2rTb52HqiGUHr7pFfTbg xJfUsboEcWsAWYpmMF+cZ71YkR7H0s/fs8Xubg4hxLvUy0lXxsveq5lHYxYClnR04kxlIgDD8CY 9+KsCm83e1bbvlOFKknZP1e4FP2A4QDRahZAne9o3+JYDxFCIIcZd0shHghzeAXw0UeHy2SbOAE 3rxHHRbwwYS0jnRu//Y0EYkeagWEHOFb60rxsZOhCtbtfGuBpOwOzZYB8njLGuhbu2Gn4tMQ/Gq LohsMPOoO7qyIjsa+eriTO3SS81MyNoX7HkToGk8+MoGOLLB2mZxDwhbgzgBD+BBpfVXkC8YAWg d54SbmrVwVHBOXXRK2hQb1ZQPkWk/Ts5JZPabRwVKmG5l+yjdh7nkBgLjhEIP6dw4rG9/wCXXqZ GxeXSDo9VW3GY8bHqG4UZh5D+m+o X-Received: by 2002:a05:7301:26:b0:387:5471:7088 with SMTP id 5a478bee46e88-387547170ffmr6475287eec.34.1796540501929; Sat, 05 Dec 2026 23:01:41 -0800 (PST) Received: from aeron-host ([103.177.178.109]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-387521bb368sm41675801eec.10.2026.12.05.23.01.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Dec 2026 23:01:41 -0800 (PST) From: Abhishek Agarwal To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Paul Tarjan , Erik Cervin-Edin , John Mellor , Nicolas Riebesel Subject: [PATCH 3/3] fsmonitor: watch directories moved into the worktree on Linux Date: Sun, 6 Dec 2026 12:30:45 +0530 Message-ID: <20261206070045.12607-4-agab0323@gmail.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261206070045.12607-1-agab0323@gmail.com> References: <20261206070045.12607-1-agab0323@gmail.com> X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit A directory moved into the worktree from outside arrives as an IN_MOVED_TO event without a matching IN_MOVED_FROM. rename_dir() then only logs "no matching cookie", and while register_inotify() adds watches for the subdirectories, nothing adds one for the directory itself. Changes to files directly in it are never reported, so "git status" does not show them, and according to the report [1], "git checkout" and "git rm" do not notice them either and can discard them. Add the watch in that case, too. [1] https://lore.kernel.org/git/CAG_kaUYEjQhiPMatcPXr00q3oO77BM2Mu7KUZyP0aSGGwKTsJA@mail.gmail.com/ Reported-by: John Mellor Signed-off-by: Abhishek Agarwal --- compat/fsmonitor/fsm-listen-linux.c | 3 +++ t/t7527-builtin-fsmonitor.sh | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/compat/fsmonitor/fsm-listen-linux.c b/compat/fsmonitor/fsm-listen-linux.c index df91714f76..f57efc56cb 100644 --- a/compat/fsmonitor/fsm-listen-linux.c +++ b/compat/fsmonitor/fsm-listen-linux.c @@ -325,6 +325,9 @@ static void rename_dir(uint32_t cookie, const char *path, /* Directory was moved from outside the watch tree */ trace_printf_key(&trace_fsmonitor, "no matching cookie for rename to '%s'", path); + if (add_watch(path, data)) + trace_printf_key(&trace_fsmonitor, + "failed to add watch for '%s'", path); } } diff --git a/t/t7527-builtin-fsmonitor.sh b/t/t7527-builtin-fsmonitor.sh index b7041e1825..ea1c7b8106 100755 --- a/t/t7527-builtin-fsmonitor.sh +++ b/t/t7527-builtin-fsmonitor.sh @@ -1508,4 +1508,19 @@ test_expect_success 'edits below a renamed directory are reported' ' test_cmp expect actual ' +test_expect_success 'edits in a directory moved in from outside are seen' ' + test_when_finished "stop_daemon_delete_repo into && rm -rf outside" && + start_watching into && + mkdir -p outside/pkg/sub && + echo a >outside/pkg/top && + echo a >outside/pkg/sub/file && + mv outside/pkg into/pkg && + git -C into add pkg && + git -C into commit -q -m add && + echo b >>into/pkg/top && + echo " M pkg/top" >expect && + git -C into status --porcelain >actual && + test_cmp expect actual +' + test_done -- 2.56.0