public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Michael J Gruber <git@drmicha•warpmail.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx•de>,
	Caleb Cushing <xenoterracide@gmail•com>,
	git@vger•kernel.org
Subject: Re: Fwd: git status options feature suggestion
Date: Sun, 12 Oct 2008 02:58:20 -0700	[thread overview]
Message-ID: <7vwsgef83n.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20081012082607.GA17852@sigill.intra.peff.net> (Jeff King's message of "Sun, 12 Oct 2008 04:26:08 -0400")

Jeff King <peff@peff•net> writes:

> 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.

  reply	other threads:[~2008-10-12  9:59 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-09  5:34 git status options feature suggestion Caleb Cushing
2008-10-09  6:11 ` Jeff King
     [not found]   ` <81bfc67a0810082327p421ca4e9v84f4b33023bc6fe6@mail.gmail.com>
2008-10-09  6:27     ` Fwd: " Caleb Cushing
2008-10-09  9:03       ` Johannes Schindelin
2008-10-09 15:12         ` Michael J Gruber
2008-10-10  2:20           ` Caleb Cushing
2008-10-10  4:25           ` Elijah Newren
2008-10-10 11:13           ` Johannes Schindelin
2008-10-12  4:49           ` Jeff King
2008-10-12  6:41             ` Junio C Hamano
2008-10-12  6:45               ` Jeff King
2008-10-12  8:10                 ` Junio C Hamano
2008-10-13  1:04                   ` Jeff King
2008-10-13  1:30                     ` Shawn O. Pearce
2008-10-26  1:47                   ` Junio C Hamano
2008-10-26  4:59                     ` Jeff King
2008-10-12 18:05                 ` Shawn O. Pearce
2008-10-13  1:06                   ` Jeff King
2008-10-12  9:07               ` Jakub Narebski
2008-10-12 10:47               ` Wincent Colaiuta
2008-10-12 11:40                 ` Teemu Likonen
2008-10-12 13:52                   ` Andreas Ericsson
2008-10-12  8:26             ` Fwd: " Jeff King
2008-10-12  9:58               ` Junio C Hamano [this message]
2008-10-13  0:59                 ` Jeff King
2008-10-09 21:23         ` ls-files [Was: Re: Fwd: git status options feature suggestion] James Cloos
2008-10-09 21:41           ` Shawn O. Pearce
2008-10-09 22:13             ` Jeremy Ramer
2008-10-09 22:52             ` ls-files James Cloos
  -- strict thread matches above, loose matches on Subject: below --
2008-10-12 10:09 Fwd: git status options feature suggestion Leo Razoumov
2008-10-18  0:19 ` Fyn Fynn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vwsgef83n.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox$(echo .)com \
    --cc=Johannes.Schindelin@gmx$(echo .)de \
    --cc=git@drmicha$(echo .)warpmail.net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=peff@peff$(echo .)net \
    --cc=xenoterracide@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox