git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] status: add an empty line when there is no hint
@ 2019-04-23  9:18 John Lin
  2019-04-30  3:12 ` Phil Hord
  0 siblings, 1 reply; 3+ messages in thread
From: John Lin @ 2019-04-23  9:18 UTC (permalink / raw)
  To: git; +Cc: John Lin

When typing "git status", there is an empty line between
the "Changes not staged for commit:" block and the list
of changed files. However, when typing "git commit" with
no files added, there are no empty lines between them.

This patch adds empty lines in the above case and some
similar cases.

Signed-off-by: John Lin <johnlinp@gmail.com>
---
 wt-status.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/wt-status.c b/wt-status.c
index 445a36204a..0766e3ee12 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -175,7 +175,7 @@ static void wt_longstatus_print_unmerged_header(struct wt_status *s)
 	}
 
 	if (!s->hints)
-		return;
+		goto conclude;
 	if (s->whence != FROM_COMMIT)
 		;
 	else if (!s->is_initial)
@@ -193,6 +193,7 @@ static void wt_longstatus_print_unmerged_header(struct wt_status *s)
 	} else {
 		status_printf_ln(s, c, _("  (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
 	}
+conclude:
 	status_printf_ln(s, c, "%s", "");
 }
 
@@ -202,13 +203,14 @@ static void wt_longstatus_print_cached_header(struct wt_status *s)
 
 	status_printf_ln(s, c, _("Changes to be committed:"));
 	if (!s->hints)
-		return;
+		goto conclude;
 	if (s->whence != FROM_COMMIT)
 		; /* NEEDSWORK: use "git reset --unresolve"??? */
 	else if (!s->is_initial)
 		status_printf_ln(s, c, _("  (use \"git reset %s <file>...\" to unstage)"), s->reference);
 	else
 		status_printf_ln(s, c, _("  (use \"git rm --cached <file>...\" to unstage)"));
+conclude:
 	status_printf_ln(s, c, "%s", "");
 }
 
@@ -220,7 +222,7 @@ static void wt_longstatus_print_dirty_header(struct wt_status *s,
 
 	status_printf_ln(s, c, _("Changes not staged for commit:"));
 	if (!s->hints)
-		return;
+		goto conclude;
 	if (!has_deleted)
 		status_printf_ln(s, c, _("  (use \"git add <file>...\" to update what will be committed)"));
 	else
@@ -228,6 +230,7 @@ static void wt_longstatus_print_dirty_header(struct wt_status *s,
 	status_printf_ln(s, c, _("  (use \"git checkout -- <file>...\" to discard changes in working directory)"));
 	if (has_dirty_submodules)
 		status_printf_ln(s, c, _("  (commit or discard the untracked or modified content in submodules)"));
+conclude:
 	status_printf_ln(s, c, "%s", "");
 }
 
@@ -238,8 +241,9 @@ static void wt_longstatus_print_other_header(struct wt_status *s,
 	const char *c = color(WT_STATUS_HEADER, s);
 	status_printf_ln(s, c, "%s:", what);
 	if (!s->hints)
-		return;
+		goto conclude;
 	status_printf_ln(s, c, _("  (use \"git %s <file>...\" to include in what will be committed)"), how);
+conclude:
 	status_printf_ln(s, c, "%s", "");
 }
 
-- 
2.21.0


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

* Re: [PATCH] status: add an empty line when there is no hint
  2019-04-23  9:18 [PATCH] status: add an empty line when there is no hint John Lin
@ 2019-04-30  3:12 ` Phil Hord
  2019-04-30  4:46   ` 林自均
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Hord @ 2019-04-30  3:12 UTC (permalink / raw)
  To: John Lin; +Cc: Git

You should probably add some test that demonstrates what your change
intends to do.  For that matter, though, your test already breaks at
least two tests in t7508-status.sh:

not ok 14 - status (advice.statusHints false)
not ok 23 - status -uno (advice.statusHints false)

Phil

On Tue, Apr 23, 2019 at 2:21 AM John Lin <johnlinp@gmail.com> wrote:
>
> When typing "git status", there is an empty line between
> the "Changes not staged for commit:" block and the list
> of changed files. However, when typing "git commit" with
> no files added, there are no empty lines between them.
>
> This patch adds empty lines in the above case and some
> similar cases.
>
> Signed-off-by: John Lin <johnlinp@gmail.com>
> ---
>  wt-status.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/wt-status.c b/wt-status.c
> index 445a36204a..0766e3ee12 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -175,7 +175,7 @@ static void wt_longstatus_print_unmerged_header(struct wt_status *s)
>         }
>
>         if (!s->hints)
> -               return;
> +               goto conclude;
>         if (s->whence != FROM_COMMIT)
>                 ;
>         else if (!s->is_initial)
> @@ -193,6 +193,7 @@ static void wt_longstatus_print_unmerged_header(struct wt_status *s)
>         } else {
>                 status_printf_ln(s, c, _("  (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
>         }
> +conclude:
>         status_printf_ln(s, c, "%s", "");
>  }
>
> @@ -202,13 +203,14 @@ static void wt_longstatus_print_cached_header(struct wt_status *s)
>
>         status_printf_ln(s, c, _("Changes to be committed:"));
>         if (!s->hints)
> -               return;
> +               goto conclude;
>         if (s->whence != FROM_COMMIT)
>                 ; /* NEEDSWORK: use "git reset --unresolve"??? */
>         else if (!s->is_initial)
>                 status_printf_ln(s, c, _("  (use \"git reset %s <file>...\" to unstage)"), s->reference);
>         else
>                 status_printf_ln(s, c, _("  (use \"git rm --cached <file>...\" to unstage)"));
> +conclude:
>         status_printf_ln(s, c, "%s", "");
>  }
>
> @@ -220,7 +222,7 @@ static void wt_longstatus_print_dirty_header(struct wt_status *s,
>
>         status_printf_ln(s, c, _("Changes not staged for commit:"));
>         if (!s->hints)
> -               return;
> +               goto conclude;
>         if (!has_deleted)
>                 status_printf_ln(s, c, _("  (use \"git add <file>...\" to update what will be committed)"));
>         else
> @@ -228,6 +230,7 @@ static void wt_longstatus_print_dirty_header(struct wt_status *s,
>         status_printf_ln(s, c, _("  (use \"git checkout -- <file>...\" to discard changes in working directory)"));
>         if (has_dirty_submodules)
>                 status_printf_ln(s, c, _("  (commit or discard the untracked or modified content in submodules)"));
> +conclude:
>         status_printf_ln(s, c, "%s", "");
>  }
>
> @@ -238,8 +241,9 @@ static void wt_longstatus_print_other_header(struct wt_status *s,
>         const char *c = color(WT_STATUS_HEADER, s);
>         status_printf_ln(s, c, "%s:", what);
>         if (!s->hints)
> -               return;
> +               goto conclude;
>         status_printf_ln(s, c, _("  (use \"git %s <file>...\" to include in what will be committed)"), how);
> +conclude:
>         status_printf_ln(s, c, "%s", "");
>  }
>
> --
> 2.21.0
>

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

* Re: [PATCH] status: add an empty line when there is no hint
  2019-04-30  3:12 ` Phil Hord
@ 2019-04-30  4:46   ` 林自均
  0 siblings, 0 replies; 3+ messages in thread
From: 林自均 @ 2019-04-30  4:46 UTC (permalink / raw)
  To: Phil Hord; +Cc: Git

Hi Phil,

Thank you for the review! I will fix the test cases and submit a new
version of my patch.

Best,
John Lin

Phil Hord <phil.hord@gmail.com> 於 2019年4月30日 週二 上午11:12寫道:
>
> You should probably add some test that demonstrates what your change
> intends to do.  For that matter, though, your test already breaks at
> least two tests in t7508-status.sh:
>
> not ok 14 - status (advice.statusHints false)
> not ok 23 - status -uno (advice.statusHints false)
>
> Phil
>
> On Tue, Apr 23, 2019 at 2:21 AM John Lin <johnlinp@gmail.com> wrote:
> >
> > When typing "git status", there is an empty line between
> > the "Changes not staged for commit:" block and the list
> > of changed files. However, when typing "git commit" with
> > no files added, there are no empty lines between them.
> >
> > This patch adds empty lines in the above case and some
> > similar cases.
> >
> > Signed-off-by: John Lin <johnlinp@gmail.com>
> > ---
> >  wt-status.c | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/wt-status.c b/wt-status.c
> > index 445a36204a..0766e3ee12 100644
> > --- a/wt-status.c
> > +++ b/wt-status.c
> > @@ -175,7 +175,7 @@ static void wt_longstatus_print_unmerged_header(struct wt_status *s)
> >         }
> >
> >         if (!s->hints)
> > -               return;
> > +               goto conclude;
> >         if (s->whence != FROM_COMMIT)
> >                 ;
> >         else if (!s->is_initial)
> > @@ -193,6 +193,7 @@ static void wt_longstatus_print_unmerged_header(struct wt_status *s)
> >         } else {
> >                 status_printf_ln(s, c, _("  (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
> >         }
> > +conclude:
> >         status_printf_ln(s, c, "%s", "");
> >  }
> >
> > @@ -202,13 +203,14 @@ static void wt_longstatus_print_cached_header(struct wt_status *s)
> >
> >         status_printf_ln(s, c, _("Changes to be committed:"));
> >         if (!s->hints)
> > -               return;
> > +               goto conclude;
> >         if (s->whence != FROM_COMMIT)
> >                 ; /* NEEDSWORK: use "git reset --unresolve"??? */
> >         else if (!s->is_initial)
> >                 status_printf_ln(s, c, _("  (use \"git reset %s <file>...\" to unstage)"), s->reference);
> >         else
> >                 status_printf_ln(s, c, _("  (use \"git rm --cached <file>...\" to unstage)"));
> > +conclude:
> >         status_printf_ln(s, c, "%s", "");
> >  }
> >
> > @@ -220,7 +222,7 @@ static void wt_longstatus_print_dirty_header(struct wt_status *s,
> >
> >         status_printf_ln(s, c, _("Changes not staged for commit:"));
> >         if (!s->hints)
> > -               return;
> > +               goto conclude;
> >         if (!has_deleted)
> >                 status_printf_ln(s, c, _("  (use \"git add <file>...\" to update what will be committed)"));
> >         else
> > @@ -228,6 +230,7 @@ static void wt_longstatus_print_dirty_header(struct wt_status *s,
> >         status_printf_ln(s, c, _("  (use \"git checkout -- <file>...\" to discard changes in working directory)"));
> >         if (has_dirty_submodules)
> >                 status_printf_ln(s, c, _("  (commit or discard the untracked or modified content in submodules)"));
> > +conclude:
> >         status_printf_ln(s, c, "%s", "");
> >  }
> >
> > @@ -238,8 +241,9 @@ static void wt_longstatus_print_other_header(struct wt_status *s,
> >         const char *c = color(WT_STATUS_HEADER, s);
> >         status_printf_ln(s, c, "%s:", what);
> >         if (!s->hints)
> > -               return;
> > +               goto conclude;
> >         status_printf_ln(s, c, _("  (use \"git %s <file>...\" to include in what will be committed)"), how);
> > +conclude:
> >         status_printf_ln(s, c, "%s", "");
> >  }
> >
> > --
> > 2.21.0
> >

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

end of thread, other threads:[~2019-04-30  4:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23  9:18 [PATCH] status: add an empty line when there is no hint John Lin
2019-04-30  3:12 ` Phil Hord
2019-04-30  4:46   ` 林自均

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).