From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a6-smtp.messagingengine.com (fhigh-a6-smtp.messagingengine.com [103.168.172.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9193B38CFE1 for ; Thu, 30 Jul 2026 03:41:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785382874; cv=none; b=CTXqRU397XOtUybBW2vRW4KOx2k7k3VM1hw6od2SzjfNN6ByJ6Cs2+MB4LkwTPcXDmpvYXHJAMLR1P5AwJyde+Kq6vQ/bJxUpgwgLEvewMsKat4GBSxvlOr3JN7nEKJShT3ryB46S+OLiYwGlAvGhkzoIjkfs2NBNyE5O6UzknA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785382874; c=relaxed/simple; bh=Z7+20lFk4PYva7Z4a5Tn/QZldlZpt1jX0gPiKFFLl+g=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QCj2QKHRpajodAbbo5WkBunZpGofQ5IxQoLXVYbSrPL+z6hayNE5D137pZcS3gMVrh+4D92Cx7uaeD4JQqRKoHk8sxyHwywpMa8k9BLolGEpAaH01HzMYCRkJEOWvvzGL3/esUoB/HMCDJQM7/lWRU3Rtup+H4vyzGTijzI454M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=gpmfk2+5; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=GGqpqa6e; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="gpmfk2+5"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="GGqpqa6e" Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id C77EC1400337; Wed, 29 Jul 2026 23:41:12 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-01.internal (MEProxy); Wed, 29 Jul 2026 23:41:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1785382872; x= 1785469272; bh=mb0na19WQBDyADbPxOFIxzNfZsGkdCTJWuB595b/qIY=; b=g pmfk2+58P3IQbs0SIOZzkL+3n91+ahMSc4Cw4rlza6JVuJ43bqGC/scu7/Ogez5x 9ekgnAP/QrSl4tvLEwoIOxNQ3ykrP43gXWzMl4/xGB6/NZ+BSf+qisAcwbUAdOGq G07WzG+1OLodToLngXG7Rf/cpmWeO5HmEOaWa6HEMQbFkN1cY95P3AYkI/96XI9h MPQTTqDixhMybnMAW+kLve8ZYvotEEasnR8E9arcR1EVCAfeCOA32mh2lcvgNAI5 xF7E/LbaAyhQxAB6fDOyuwCb71M1tNCACrpgFq/vtSQuBqkxgYxwx/idEvbunVYj g1VOkE1WV2t2SvjxWnGwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1785382872; x=1785469272; bh=mb0na19WQBDyADbPxOFIxzNfZs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tCo8wS7hSkg X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Jul 2026 23:41:12 -0400 (EDT) From: Junio C Hamano To: git@vger.kernel.org Subject: [PATCH 2/2] stash: reject time-based selectors in drop and pop Date: Wed, 29 Jul 2026 20:41:08 -0700 Message-ID: <20260730034108.765430-3-gitster@pobox.com> X-Mailer: git-send-email 2.55.0-597-ge6126a35d6 In-Reply-To: <20260730034108.765430-1-gitster@pobox.com> References: <20260730034108.765430-1-gitster@pobox.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit get_stash_info_assert() verifies that a revision is a stash reference ('.is_stash_ref'), but it does not verify whether the reference is a positional reflog index as opposed to a time-based selector (such as 'stash@{2.days}'). When subcommands such as 'git stash drop' or 'git stash pop' pass time-based selectors to reflog_delete(), reflog_delete() treats non-integer selectors as expiration cutoff timestamps. Consequently, - 'git stash drop stash@{2.days.ago}' deletes all stash entries older than two days instead of dropping a single entry, and - 'git stash pop stash@{2.days.ago}' applies a single stash entry at that timestamp and then deletes all stash entries older than two days. While the former might be remotely useful, the latter is certainly not. In get_stash_info_assert(), reject references where '.stash_idx' is negative (i.e., a time-based reference was used), ensuring that 'git stash drop' and 'git stash pop' fail early on invalid or date-based stash references. Document that 'git reflog expire --expire=