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

Re: Fwd: git status options feature suggestion

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 12, 2008, 09:58 UTC
Message-ID
<7vwsgef83n.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20081012082607.GA17852@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 32 quoted lines
> BTW, in case anybody is interested, here is the patch. Like I said, I
> think we are better off with an alternative to "status", but maybe this
> is useful to somebody anyway.
>
> ---
> diff --git a/builtin-commit.c b/builtin-commit.c
> index b01ad9f..8951364 100644
> --- a/builtin-commit.c
> +++ b/builtin-commit.c
> @@ -217,7 +217,8 @@ static void create_base_index(void)
>  		exit(128); /* We've already reported the error, finish dying */
>  }
>  
> -static char *prepare_index(int argc, const char **argv, const char *prefix)
> +static char *prepare_index(int argc, const char **argv, const char *prefix,
> +		int status_only)
>  {
>  	int fd;
>  	struct string_list partial;
> @@ -270,7 +271,13 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
>  	 * We still need to refresh the index here.
>  	 */
>  	if (!pathspec || !*pathspec) {
> -		fd = hold_locked_index(&index_lock, 1);
> +		fd = hold_locked_index(&index_lock, 0);
> +		if (fd < 0) {
> +			if (!status_only)
> +				die("unable to lock index: %s",
> +						strerror(errno));
> +			return get_index_file();
> +		}
>  		refresh_cache(REFRESH_QUIET);

You would probably want to refresh_cache() here even if you are not going to write the resulting index out, so that you won't show the stat-only differences to the end user. Other than that, I think this is a good change.

Previous: Jeff KingNext: Jeff King
Message 24 of 29 in “git status options feature suggestion”
  1. Caleb CushingOct 9, 2008
  2. Jeff KingOct 9, 2008
  3. Fwd: git status options feature suggestionCaleb Cushing, Oct 9, 2008
  4. Johannes SchindelinOct 9, 2008
  5. Michael J GruberOct 9, 2008
  6. Caleb CushingOct 10, 2008
  7. Elijah NewrenOct 10, 2008
  8. Johannes SchindelinOct 10, 2008
  9. Jeff KingOct 12, 2008
  10. Junio C HamanoOct 12, 2008
  11. Jeff KingOct 12, 2008
  12. Junio C HamanoOct 12, 2008
  13. Jeff KingOct 13, 2008
  14. Shawn O. PearceOct 13, 2008
  15. Junio C HamanoOct 26, 2008
  16. Jeff KingOct 26, 2008
  17. Shawn O. PearceOct 12, 2008
  18. Jeff KingOct 13, 2008
  19. Jakub NarebskiOct 12, 2008
  20. Wincent ColaiutaOct 12, 2008
  21. Teemu LikonenOct 12, 2008
  22. Andreas EricssonOct 12, 2008
  23. Jeff KingOct 12, 2008
  24. Junio C HamanoOct 12, 2008
  25. Jeff KingOct 13, 2008
  26. ls-files [Was: Re: Fwd: git status options feature suggestion]James Cloos, Oct 9, 2008
  27. Shawn O. PearceOct 9, 2008
  28. Jeremy RamerOct 9, 2008
  29. James CloosOct 9, 2008

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.