All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 0/2] Sparse checkout status
@ 2020-06-19  2:28 Russell Crume
  0 siblings, 0 replies; 5+ messages in thread
From: Russell Crume @ 2020-06-19  2:28 UTC (permalink / raw)
  To: gitgitgadget; +Cc: dstolee, git, newren



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] Sparse checkout status
  2020-06-18 23:18     ` Elijah Newren
@ 2020-06-21  1:34       ` Elijah Newren
  0 siblings, 0 replies; 5+ messages in thread
From: Elijah Newren @ 2020-06-21  1:34 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Elijah Newren via GitGitGadget, Git Mailing List, Derrick Stolee

On Thu, Jun 18, 2020 at 4:18 PM Elijah Newren <newren@gmail.com> wrote:
>
> On Thu, Jun 18, 2020 at 2:46 PM Junio C Hamano <gitster@pobox.com> wrote:
> >
> > "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
> >
> > > Some of the feedback of folks trying out sparse-checkouts at $dayjob is that
> > > sparse checkouts can sometimes be disorienting; users can forget that they
> > > had a sparse-checkout and then wonder where files went. This series adds
> > > some output to 'git status' and modifies git-prompt slightly as an attempt
> > > to help.
> > >
> > > Note that as per discussion on v1, we may want to later add a git
> > > sparse-checkout subcommand named something like 'stats' or 'info' or
> > > 'status' that provides more detailed information for users to dig deeper.
> > > That would be an additional improvement for helping users find out more
> > > information once they realize or remember they are in a sparse checkout,
> > > this is just aimed at giving them a simple reminder.
> > >
> > > Changes since v1:
> > >
> > >  * Replaced the -1 magic constant with SPARSE_CHECKOUT_DISABLED
> > >  * Fixed a possible division by 0 (when there are no entries in the index
> > >    AND sparse checkout is enabled; not sure when that'd ever happen but
> > >    still better to guard against...)
> > >  * Slight wording tweaks for the git-prompt commit message
> > >  * Removed the RFC label
> > >
> > > Elijah Newren (2):
> > >   wt-status: show sparse checkout status as well
> > >   git-prompt: include sparsity state as well
> > >
> > >  contrib/completion/git-prompt.sh |  7 +++++-
> > >  wt-status.c                      | 41 ++++++++++++++++++++++++++++++++
> > >  wt-status.h                      |  2 ++
> > >  3 files changed, 49 insertions(+), 1 deletion(-)
> >
> > Any change to Documentation/git-status.txt?
>
> Reasonable question; I didn't think of it.  But on a related note, in
> the eight years we've had status output for various other forms of
> state (in-progress operations like merge, cherry-pick, rebase, or
> bisect), these haven't been documented either.  Was that also
> oversight, or was there a reason it was left out?
>
> If oversight, should I just document all those others while I'm at it?

So, I went to look at this.  Documentation/git-status.txt documents in
detail the short status format, the porcelain V1 format, and the
porcelain V2 format.  There are two side comments that the long format
is the default, and that status.submoduleSummary affects the long
output, but the only thing it says to document the contents of the
long format is:
"""
The default, long format, is designed to be human readable,
verbose and descriptive.  Its contents and format are subject to change
at any time.
"""
It would thus feel odd to mention the sparsity status within the long
format when nothing else within that format is documented.  I suspect
that's why it was never added when rebase/merge/cherry-pick/bisect
state notifications were added to the long format.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] Sparse checkout status
  2020-06-18 21:45   ` Junio C Hamano
@ 2020-06-18 23:18     ` Elijah Newren
  2020-06-21  1:34       ` Elijah Newren
  0 siblings, 1 reply; 5+ messages in thread
From: Elijah Newren @ 2020-06-18 23:18 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Elijah Newren via GitGitGadget, Git Mailing List, Derrick Stolee

On Thu, Jun 18, 2020 at 2:46 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > Some of the feedback of folks trying out sparse-checkouts at $dayjob is that
> > sparse checkouts can sometimes be disorienting; users can forget that they
> > had a sparse-checkout and then wonder where files went. This series adds
> > some output to 'git status' and modifies git-prompt slightly as an attempt
> > to help.
> >
> > Note that as per discussion on v1, we may want to later add a git
> > sparse-checkout subcommand named something like 'stats' or 'info' or
> > 'status' that provides more detailed information for users to dig deeper.
> > That would be an additional improvement for helping users find out more
> > information once they realize or remember they are in a sparse checkout,
> > this is just aimed at giving them a simple reminder.
> >
> > Changes since v1:
> >
> >  * Replaced the -1 magic constant with SPARSE_CHECKOUT_DISABLED
> >  * Fixed a possible division by 0 (when there are no entries in the index
> >    AND sparse checkout is enabled; not sure when that'd ever happen but
> >    still better to guard against...)
> >  * Slight wording tweaks for the git-prompt commit message
> >  * Removed the RFC label
> >
> > Elijah Newren (2):
> >   wt-status: show sparse checkout status as well
> >   git-prompt: include sparsity state as well
> >
> >  contrib/completion/git-prompt.sh |  7 +++++-
> >  wt-status.c                      | 41 ++++++++++++++++++++++++++++++++
> >  wt-status.h                      |  2 ++
> >  3 files changed, 49 insertions(+), 1 deletion(-)
>
> Any change to Documentation/git-status.txt?

Reasonable question; I didn't think of it.  But on a related note, in
the eight years we've had status output for various other forms of
state (in-progress operations like merge, cherry-pick, rebase, or
bisect), these haven't been documented either.  Was that also
oversight, or was there a reason it was left out?

If oversight, should I just document all those others while I'm at it?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] Sparse checkout status
  2020-06-18 20:49 ` [PATCH v2 " Elijah Newren via GitGitGadget
@ 2020-06-18 21:45   ` Junio C Hamano
  2020-06-18 23:18     ` Elijah Newren
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2020-06-18 21:45 UTC (permalink / raw)
  To: Elijah Newren via GitGitGadget; +Cc: git, dstolee, Elijah Newren

"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Some of the feedback of folks trying out sparse-checkouts at $dayjob is that
> sparse checkouts can sometimes be disorienting; users can forget that they
> had a sparse-checkout and then wonder where files went. This series adds
> some output to 'git status' and modifies git-prompt slightly as an attempt
> to help.
>
> Note that as per discussion on v1, we may want to later add a git
> sparse-checkout subcommand named something like 'stats' or 'info' or
> 'status' that provides more detailed information for users to dig deeper.
> That would be an additional improvement for helping users find out more
> information once they realize or remember they are in a sparse checkout,
> this is just aimed at giving them a simple reminder.
>
> Changes since v1:
>
>  * Replaced the -1 magic constant with SPARSE_CHECKOUT_DISABLED
>  * Fixed a possible division by 0 (when there are no entries in the index
>    AND sparse checkout is enabled; not sure when that'd ever happen but
>    still better to guard against...)
>  * Slight wording tweaks for the git-prompt commit message
>  * Removed the RFC label
>
> Elijah Newren (2):
>   wt-status: show sparse checkout status as well
>   git-prompt: include sparsity state as well
>
>  contrib/completion/git-prompt.sh |  7 +++++-
>  wt-status.c                      | 41 ++++++++++++++++++++++++++++++++
>  wt-status.h                      |  2 ++
>  3 files changed, 49 insertions(+), 1 deletion(-)

Any change to Documentation/git-status.txt?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 0/2] Sparse checkout status
  2020-06-16 23:33 [PATCH " Elijah Newren via GitGitGadget
@ 2020-06-18 20:49 ` Elijah Newren via GitGitGadget
  2020-06-18 21:45   ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Elijah Newren via GitGitGadget @ 2020-06-18 20:49 UTC (permalink / raw)
  To: git; +Cc: dstolee, Elijah Newren

Some of the feedback of folks trying out sparse-checkouts at $dayjob is that
sparse checkouts can sometimes be disorienting; users can forget that they
had a sparse-checkout and then wonder where files went. This series adds
some output to 'git status' and modifies git-prompt slightly as an attempt
to help.

Note that as per discussion on v1, we may want to later add a git
sparse-checkout subcommand named something like 'stats' or 'info' or
'status' that provides more detailed information for users to dig deeper.
That would be an additional improvement for helping users find out more
information once they realize or remember they are in a sparse checkout,
this is just aimed at giving them a simple reminder.

Changes since v1:

 * Replaced the -1 magic constant with SPARSE_CHECKOUT_DISABLED
 * Fixed a possible division by 0 (when there are no entries in the index
   AND sparse checkout is enabled; not sure when that'd ever happen but
   still better to guard against...)
 * Slight wording tweaks for the git-prompt commit message
 * Removed the RFC label

Elijah Newren (2):
  wt-status: show sparse checkout status as well
  git-prompt: include sparsity state as well

 contrib/completion/git-prompt.sh |  7 +++++-
 wt-status.c                      | 41 ++++++++++++++++++++++++++++++++
 wt-status.h                      |  2 ++
 3 files changed, 49 insertions(+), 1 deletion(-)


base-commit: b3d7a52fac39193503a0b6728771d1bf6a161464
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-808%2Fnewren%2Fsparse-checkout-status-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-808/newren/sparse-checkout-status-v2
Pull-Request: https://github.com/git/git/pull/808

Range-diff vs v1:

 1:  462cee857ef ! 1:  e266bc39d99 [RFC] wt-status: show sparse checkout status as well
     @@ Metadata
      Author: Elijah Newren <newren@gmail.com>
      
       ## Commit message ##
     -    [RFC] wt-status: show sparse checkout status as well
     +    wt-status: show sparse checkout status as well
      
          Some of the early feedback of folks trying out sparse-checkouts at
          $dayjob is that sparse checkouts can sometimes be disorienting; users
     @@ wt-status.c: static void show_bisect_in_progress(struct wt_status *s,
      +static void show_sparse_checkout_in_use(struct wt_status *s,
      +					const char *color)
      +{
     -+	if (s->state.sparse_checkout_percentage != -1)
     -+		status_printf_ln(s, color,
     -+				 _("You are in a sparse checkout with %d%% of tracked files present."),
     -+				 s->state.sparse_checkout_percentage);
     ++	if (s->state.sparse_checkout_percentage == SPARSE_CHECKOUT_DISABLED)
     ++		return;
     ++
     ++	status_printf_ln(s, color,
     ++			 _("You are in a sparse checkout with %d%% of tracked files present."),
     ++			 s->state.sparse_checkout_percentage);
      +	wt_longstatus_print_trailer(s);
      +}
      +
     @@ wt-status.c: int wt_status_check_bisect(const struct worktree *wt,
      +	int skip_worktree = 0;
      +	int i;
      +
     -+	if (!core_apply_sparse_checkout) {
     -+		state->sparse_checkout_percentage = -1;
     ++	if (!core_apply_sparse_checkout || r->index->cache_nr == 0) {
     ++		/*
     ++		 * Don't compute percentage of checked out files if we
     ++		 * aren't in a sparse checkout or would get division by 0.
     ++		 */
     ++		state->sparse_checkout_percentage = SPARSE_CHECKOUT_DISABLED;
      +		return;
      +	}
      +
     @@ wt-status.c: static void wt_longstatus_print_state(struct wt_status *s)
       	if (state->bisect_in_progress)
       		show_bisect_in_progress(s, state_color);
      +
     -+	if (state->sparse_checkout_percentage != -1)
     ++	if (state->sparse_checkout_percentage != SPARSE_CHECKOUT_DISABLED)
      +		show_sparse_checkout_in_use(s, state_color);
       }
       
       static void wt_longstatus_print(struct wt_status *s)
      
       ## wt-status.h ##
     +@@ wt-status.h: enum wt_status_format {
     + 
     + #define HEAD_DETACHED_AT _("HEAD detached at ")
     + #define HEAD_DETACHED_FROM _("HEAD detached from ")
     ++#define SPARSE_CHECKOUT_DISABLED -1
     + 
     + struct wt_status_state {
     + 	int merge_in_progress;
      @@ wt-status.h: struct wt_status_state {
       	int bisect_in_progress;
       	int revert_in_progress;
       	int detached_at;
     -+	int sparse_checkout_percentage; /* -1 == not in sparse checkout */
     ++	int sparse_checkout_percentage; /* SPARSE_CHECKOUT_DISABLED if not sparse */
       	char *branch;
       	char *onto;
       	char *detached_from;
 2:  64613ad7ad6 ! 2:  17254b30a5b [RFC] git-prompt: include sparsity state as well
     @@ Metadata
      Author: Elijah Newren <newren@gmail.com>
      
       ## Commit message ##
     -    [RFC] git-prompt: include sparsity state as well
     +    git-prompt: include sparsity state as well
      
     -    The current git prompt includes a lot of possible state information, from
     -    various flavors of rebases to cherry-picks, or merges, or bisects.  Add
     +    The current git prompt includes a lot of possible state information from
     +    cherry-picks, merges, bisects, and various flavors of rebases.  Add
          sparsity as another state flavor (though one which can be present
          simultaneously with any of rebase/cherry-pick/merge/bisect).  This extra
          state is shown with an extra
              |SPARSE
     -    substring before the other states.  (Sparsity is probably not going to
     -    change much within a repository, while temporary operations will.  So we
     -    want the temporary operation related state changes to be listed last, to
     -    make them appear closer to where the user types and make them more
     -    likely to be noticed.)  Thus, for example, the prompt might look like:
     +    substring before the other states, providing a prompt that looks like:
              (branchname|SPARSE|REBASE 6/10)
      
     +    The reason for showing the "|SPARSE" substring before other states is to
     +    emphasize those other states.  Sparsity is probably not going to change
     +    much within a repository, while temporary operations will.  So we want
     +    the state changes related to temporary operations to be listed last, to
     +    make them appear closer to where the user types and make them more
     +    likely to be noticed.
     +
          Signed-off-by: Elijah Newren <newren@gmail.com>
      
       ## contrib/completion/git-prompt.sh ##

-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-21  1:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-19  2:28 [PATCH v2 0/2] Sparse checkout status Russell Crume
  -- strict thread matches above, loose matches on Subject: below --
2020-06-16 23:33 [PATCH " Elijah Newren via GitGitGadget
2020-06-18 20:49 ` [PATCH v2 " Elijah Newren via GitGitGadget
2020-06-18 21:45   ` Junio C Hamano
2020-06-18 23:18     ` Elijah Newren
2020-06-21  1:34       ` Elijah Newren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.