From: Jeff Sipek Date: Wed, 14 May 2014 17:10:41 GMT Subject: Re: [GUILT v2 08/29] Added more test cases for "guilt new": empty patches. Message-ID: <20140514171040.GF1582@meili.valhalla.31bits.net> In-Reply-To: <1400013065-27919-9-git-send-email-cederp@opera.com> On Tue, May 13, 2014 at 10:30:44PM +0200, Per Cederqvist wrote: > Test that empty patches are handled correctly, both with and without > the guilt.diffstat configuration option. > > Signed-off-by: Per Cederqvist > --- > regression/t-020.out | 250 +++++++++++++++++++++++++++++++++++++++++++++++++++ > regression/t-020.sh | 60 +++++++++++++ > 2 files changed, 310 insertions(+) > > diff --git a/regression/t-020.out b/regression/t-020.out > index af45734..7e07efa 100644 > --- a/regression/t-020.out > +++ b/regression/t-020.out > @@ -1128,3 +1128,253 @@ f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/master/add ... > +% git log -p > +commit c7a139f532a43c3c8b0e068cac04f8f6af0f94e1 > +Author: Author Name > +Date: Mon Jan 1 00:00:00 2007 +0000 > + > + patch empty.patch > + > +commit d4850419ccc1146c7169f500725ce504b9774ed0 > +Author: Author Name > +Date: Mon Jan 1 00:00:00 2007 +0000 > + > + initial > + > + Signed-off-by: Commiter Name > + > +diff --git a/def b/def > +new file mode 100644 > +index 0000000..8baef1b > +--- /dev/null > ++++ b/def > +@@ -0,0 +1 @@ > ++abc > +% git config guilt.diffstat false > +--- > + I'm a bit confused about the above. It looks like contents of an empty patch with an empty diffstat. But the only time I see a cat in the .sh file is when you rewrite... oh I got it. I'll comment about it by the 'cat'. ... > diff --git a/regression/t-020.sh b/regression/t-020.sh > index cdd08ba..906aec6 100755 > --- a/regression/t-020.sh > +++ b/regression/t-020.sh > @@ -5,6 +5,13 @@ > > source "$REG_DIR/scaffold" > > +function fixup_time_info > +{ > + cmd guilt pop > + touch -a -m -t "$TOUCH_DATE" ".git/patches/master/$1" > + cmd guilt push > +} > + > cmd setup_repo > > # > @@ -69,6 +76,59 @@ done > > cmd list_files > > +# push an empty patch with no commit message > +cmd guilt new empty.patch > +fixup_time_info empty.patch > +cmd list_files > +cmd git log -p > + > +# Ensure we can push the empty patch even when guilt.diffstat is true. > +cmd git config guilt.diffstat true > +cmd guilt refresh > +fixup_time_info empty.patch > +cmd list_files > +cmd git log -p > +cmd git config guilt.diffstat false > + > +# Let the patch have a commit message, but no data. > +cat .git/patches/master/empty.patch < .git/.../empty.patch < +Fix a bug. > + > +From: Per Cederqvist > + > +This commit fixes a serious bug. > + > +FIXME: > + - add a test case > + - track down the bug > + - actually fix it > +EOF > + > +fixup_time_info empty.patch > +cmd list_files > +cmd git log -p > + > +# And once more, with an empty diffstat. > + > +cmd git config guilt.diffstat true > +cmd guilt refresh > +fixup_time_info empty.patch > +cmd list_files > +cmd git log -p > + > +# Restore the diffstat setting and remove the empty patch. > +cmd git config guilt.diffstat false > +cmd guilt refresh > +fixup_time_info empty.patch > +cmd list_files > +cmd git log -p > +# (Cannot delete an applied patch) > +shouldfail guilt delete empty.patch > +cmd guilt pop -a > +cmd guilt delete -f empty.patch > +cmd list_files > +cmd git log -p > + > # FIXME: > # --all > # -a > -- > 1.8.3.1 > -- Fact: 23.6% of all statistics are generated randomly.