Re: [PATCH v4 10/21] range-diff: do not show "function names" in hunk headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/21, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@xxxxxx>
> 
> We are comparing complete, formatted commit messages with patches. There
> are no function names here, so stop looking for them.

While there are no function names here, trying out range-diff without
this patch applied, the headers were getting here do seem kind of
useful:

    1: 92588fc6b6 ! 3: 43c9ef552c
        @@ -8,8 +8,16 @@ diff --git a/read-cache.c b/read-cache.c
    	[...]

The filename can be quite useful in this output.  I guess this is a
bit brittle though, so I'm also happy to defer changing this to show
something useful to the list of possible future enhancements
(obviously doesn't necessarily have to be implemented by you at that
point).

> Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
> ---
>  range-diff.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/range-diff.c b/range-diff.c
> index 8329f52e7..3fc3a4018 100644
> --- a/range-diff.c
> +++ b/range-diff.c
> @@ -9,6 +9,7 @@
>  #include "diffcore.h"
>  #include "commit.h"
>  #include "pretty.h"
> +#include "userdiff.h"
>  
>  struct patch_util {
>  	/* For the search for an exact match */
> @@ -307,6 +308,10 @@ static void output_pair_header(struct strbuf *buf,
>  	fwrite(buf->buf, buf->len, 1, stdout);
>  }
>  
> +static struct userdiff_driver no_func_name = {
> +	.funcname = { "$^", 0 }
> +};
> +
>  static struct diff_filespec *get_filespec(const char *name, const char *p)
>  {
>  	struct diff_filespec *spec = alloc_filespec(name);
> @@ -316,6 +321,7 @@ static struct diff_filespec *get_filespec(const char *name, const char *p)
>  	spec->size = strlen(p);
>  	spec->should_munmap = 0;
>  	spec->is_stdin = 1;
> +	spec->driver = &no_func_name;
>  
>  	return spec;
>  }
> -- 
> gitgitgadget
> 



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux