Re: [GUILT v2 08/29] Added more test cases for "guilt new": empty patches.

2014-05-14 Thread Per Cederqvist
On Wed, May 14, 2014 at 7:10 PM, Jeff Sipek  wrote:
> 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 +
>> +
>> +patch empty.patch
>> +
>> +commit d4850419ccc1146c7169f500725ce504b9774ed0
>> +Author: Author Name 
>> +Date:   Mon Jan 1 00:00:00 2007 +
>> +
>> +initial
>> +
>> +Signed-off-by: Commiter Name 
>> +
>> +diff --git a/def b/def
>> +new file mode 100644
>> +index 000..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 <
> cat > .git/.../empty.patch < ...
> EOF
>
> Otherwise, you'll just cat the existing patch and that's it.

Yes. The intent was to modify empty.patch.  This is a bit
embarrassing, since it should have been obvious from
the output of "git log -p" that the modification didn't work
as I intended. :-)

I'll fix in the v3 series.

/ceder

>> +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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 08/29] Added more test cases for "guilt new": empty patches.

2014-05-14 Thread Jeff Sipek
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 +
> +
> +patch empty.patch
> +
> +commit d4850419ccc1146c7169f500725ce504b9774ed0
> +Author: Author Name 
> +Date:   Mon Jan 1 00:00:00 2007 +
> +
> +initial
> +
> +Signed-off-by: Commiter Name 
> +
> +diff --git a/def b/def
> +new file mode 100644
> +index 000..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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html