Re: [PATCH v2 05/12] t5520: test --rebase failure on unborn branch with index
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 7, 2015, 18:20 UTC
- Message-ID
- <CAPig+cT6dom8vMoy4eObwQOuERYh4nfLgFHfmofn+C7pD-PnCw@mail.gmail.com>
- In-Reply-To
- <CACRoPnQzAjY0bPmHrw2o4Mdzn1Q4Dd587hLXkEPA-qYcYrVGEg@mail.gmail.com>
On Thu, May 7, 2015 at 1:44 PM, Paul Tan <pyokagan@gmail.com> wrote:
Show 32 quoted lines
> On Fri, May 8, 2015 at 12:32 AM, Stefan Beller <sbeller@google.com> wrote: >> On Thu, May 7, 2015 at 1:44 AM, Paul Tan <pyokagan@gmail.com> wrote: >>> +test_expect_success 'pull --rebase fails on unborn branch with staged changes' ' >>> + test_when_finished "rm -rf empty_repo2" && >>> + git init empty_repo2 && >>> + ( >>> + cd empty_repo2 && >>> + echo staged-file >staged-file && >>> + git add staged-file && >>> + test "$(git ls-files)" = staged-file && >> >> I think usually people use >> >> git ls-files >actual >> echo staged-file >expected && # you have this already in your 2nd >> # line in the paragraph >> test_cmp staged-file actual >> >> to make debugging easier as you can inspect the files (actual, expected) >> after the test has failed. >> >> Personally I don't mind the difference as when it comes to debugging >> using the test suite I haven't found the silver bullet yet. > > Ehh, but using test_cmp will litter the test with lots of "echo X >>expected" lines which I find quite distracting. > > Just thinking aloud, but it would be great if there was a function to > compare a string and a file, or a string and a string. > > But yeah, I guess if the patches are verified to be correct, then I > should change these comparisons to use test_cmp.
Check out verbose() in test-lib-functions.sh:643. It might be just what you want. t0020-crlf.sh has a bunch of examples of its use.