Re: [PATCH] wt-status.c: Modified status message shown for a parent-less branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2017-06-15 at 09:12 -0400, Jeff King wrote:
> On Thu, Jun 15, 2017 at 07:43:17AM -0400, Samuel Lijin wrote:
> 
> > > Saying just "staged changes" is definitely accurate. I don't know
> > > if
> > > some users would find that too terse, too. The phrase "not staged
> > > for
> > > commit" gives more information if you don't know what "staged"
> > > means in
> > > the Git world.
> 
> Oops, I meant to say "too terse, though". But it sounds like you got
> my
> meaning.
> 
>From what I could get from this thread, I guess the current patch
stands something like the one below. I tried building it with the below
change, it seems to be having a little issue. I'm not sure why, it
seems to be working the other way round i.e., the message "No commits
yet on the branch" message is shown in the commit template and the
message "Initial commit" is shown when `git status` is invoked.

Also, let me know if any other change is required.

diff --git a/builtin/commit.c b/builtin/commit.c
index 1d805f5da..3ed8e40bc 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1364,6 +1364,7 @@ int cmd_status(int argc, const char **argv, const
char *prefix)
                usage_with_options(builtin_status_usage,
builtin_status_options);
 
        status_init_config(&s, git_status_config);
+       s.commit_template = 1;
        argc = parse_options(argc, argv, prefix,
                             builtin_status_options,
                             builtin_status_usage, 0);
diff --git a/wt-status.c b/wt-status.c
index 037548496..34aa1af66 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1576,7 +1576,10 @@ static void wt_longstatus_print(struct wt_status
*s)
 
        if (s->is_initial) {
                status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s",
"");
-               status_printf_ln(s, color(WT_STATUS_HEADER, s),
_("Initial commit"));
+               status_printf_ln(s, color(WT_STATUS_HEADER, s),
+                                s->commit_template
+                                ? _("Initial commit")
+                                : _("No commits yet on the branch"));
                status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s",
"");
        }
 
diff --git a/wt-status.h b/wt-status.h
index 6018c627b..782b2997f 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -76,6 +76,7 @@ struct wt_status {
        char color_palette[WT_STATUS_MAXSLOT][COLOR_MAXLEN];
        unsigned colopts;
        int null_termination;
+       int commit_template;
        int show_branch;
        int hints;



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]