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

Re: [PATCH] last-modified: support sparse checkouts

From
Derrick Stolee <stolee@gmail.com>
Date
Nov 30, 2025, 20:00 UTC
Message-ID
<75f862a5-2663-4211-b96c-d2c5d1c6f91e@gmail.com>
In-Reply-To
<pull.2013.git.1764423826908.gitgitgadget@gmail.com>
On 11/29/2025 8:43 AM, Johannes Schindelin via GitGitGadget wrote:
Show 12 quoted lines
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> In a sparse checkout, a user might want to run `last-modified` on a
> directory outside the worktree.
> 
> And even in non-sparse checkouts, a user might need to run that command
> on a directory that does not exist in the worktree.
> 
> These use cases should be supported via the `--` separator between
> revision and file arguments, which is even advertised in the
> documentation. This patch fixes a tiny bug that prevents that from
> working.
Show 5 quoted lines
>  	argc = parse_options(argc, argv, prefix, last_modified_options,
>  			     last_modified_usage,
> -			     PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN_OPT);
> +			     PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN_OPT |
> +			     PARSE_OPT_KEEP_DASHDASH);
I'm intrigued that this is the only fix that was required.
> +test_expect_success 'last-modified in sparse checkout' '
> +	test_when_finished "git sparse-checkout disable" &&
> +	git sparse-checkout set b &&
> +	check_last_modified -- a <<-\EOF

Would we expect this to work without the '--'? Should it fail for a directory that exists at HEAD but is outside of the sparse-checkout?

Thanks, -Stolee

Previous: Johannes Schindelin via GitGitGadgetNext: Toon Claes
Message 2 of 3 in “last-modified: support sparse checkouts”
  1. last-modified: support sparse checkoutsJohannes Schindelin via GitGitGadget, Nov 29, 2025
  2. Derrick StoleeNov 30, 2025
  3. Toon ClaesDec 3, 2025

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.