Subject: Re: [PATCH/FINAL] status: contextually notify user about an initial commit

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Wed, 21 Jun 2017 16:52:07 +0200

On Wed, Jun 21 2017, Kaartic Sivaraam jotted:

> On Wed, 2017-06-21 at 08:07 +0530, Kaartic Sivaraam wrote:
>> The existing message, "Initial commit", makes sense for the commit
>> template
>> notifying users that it's their initial commit, but is confusing when
>> merely checking the status of a fresh repository (or orphan branch)
>> without having any commits yet.
>>
>> Change the output of "status" to say "No commits yet" when "git
>> status" is run on a fresh repo (or orphan branch), while retaining
>> the
>> current "Initial commit" message displayed in the template that's
>> displayed in the editor when the initial commit is being authored.
>>
>> A few alternatives considered were,
>>
>> * Waiting for initial commit
>> * Your current branch does not have any commits
>> * Current branch waiting for initial commit
>>
>> The most succint one among the alternatives was chosen.
>>
>> Helped-by: Junio C Hamano <[email-masked]>
>> Signed-off-by: Kaartic Sivaraam <[email-masked]>
>> Signed-off-by: Ævar Arnfjörð Bjarmason <[email-masked]>
>> ---
>>
>> The 'FINAL' part in the subject is just my opinion about
>> this patch
>>
> Just for the note, the tests passed locally and all travis-ci builds
> jobs succeeded except for the one in which the 'GITTEXT_POISON'
> environment variable is enabled. I guess that isn't an issue, from what
> I came to know while digging about it.

No, this is a bug in your patch, the test suite should pass under
poison.

The issue is that you changed the test code I gave you (to also add more
tests, yay) along the way to do:

    test_must_fail test_i18ngrep ...

Instead of the correct form:

    test_i18ngrep ! ...

This fixup for your patch makes it work again:
    
    diff --git a/t/t7508-status.sh b/t/t7508-status.sh
    index e0d2c9e581..b3743ff0a8 100755
    --- a/t/t7508-status.sh
    +++ b/t/t7508-status.sh
    @@ -1618,7 +1618,7 @@ test_expect_success '"No commits yet" should not be noted in status output' '
            git checkout --orphan empty-branch-2 &&
            test_commit test-commit-1 &&
            git status >output &&
    -       test_must_fail test_i18ngrep "No commits yet" output
    +       test_i18ngrep ! "No commits yet" output
     '
     
     test_expect_success '"Initial commit" should be noted in commit template' '
    @@ -1635,7 +1635,7 @@ test_expect_success '"Initial commit" should not be noted in commit template' '
            touch to_be_committed_2 &&
            git add to_be_committed_2 &&
            git commit --dry-run >output &&
    -       test_must_fail test_i18ngrep "Initial commit" output
    +       test_i18ngrep ! "Initial commit" output
     '
     
     test_done