Am 01.01.2018 um 23:54 schrieb SZEDER Gábor:
'git branch' has an option to edit a branch's description, but lacks
the option to show that description.

Therefore, add a new '--show-description' option to do just that, as a
more user-friendly alternative to 'git config --get
branch.$branchname.description':

   - it's shorter to type (both in the number of characters and the
     number of TABs if using completion),
   - works on the current branch without explicitly naming it,
   - hides the implementation detail that branch descriptions are
     stored in the config file, and
   - errors out with a proper error message when the given branch
     doesn't exist (but exits quietly with an error code when the
     branch does exit but has no description, just like the 'git config'
     query does).

+test_expect_success '--show-description with no description errors quietly' '
+       git config --unset branch.master.description &&
+       test_must_fail git branch --show-description >actual 2>actual.err &&
+       test_must_be_empty actual &&
+       test_must_be_empty actual.err
+'

Checking the exact contents of stderr typically fails when tests are run under -x. Perhaps

        test_i18ngrep ! "fatal: " actual.err &&"
        test_i18ngrep ! "error: " actual.err &&
        test_i18ngrep ! "warning: " actual.err

Which makes me wonder: Why would --show-description have to error out silently? This is not 'git config' after all.

-- Hannes

Reply via email to