git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: Elijah Newren <newren@gmail.com>
Subject: range-diff should suppress context-only changes?
Date: Thu, 5 Nov 2020 08:34:37 -0500	[thread overview]
Message-ID: <20201105133437.GC91972@coredump.intra.peff.net> (raw)

On Thu, Nov 05, 2020 at 12:22:32AM +0000, Elijah Newren via GitGitGadget wrote:

> Range-diff vs v3:
> [...]
>   7:  42633b8d03 !  7:  5e8004c728 strmap: add more utility functions
>      @@ strmap.h: void *strmap_get(struct strmap *map, const char *str);
>       + * iterate through @map using @iter, @var is a pointer to a type strmap_entry
>       + */
>       +#define strmap_for_each_entry(mystrmap, iter, var)	\
>      -+	for (var = hashmap_iter_first_entry_offset(&(mystrmap)->map, iter, 0); \
>      -+		var; \
>      -+		var = hashmap_iter_next_entry_offset(iter, 0))
>      ++	hashmap_for_each_entry(&(mystrmap)->map, iter, var, ent)
>       +
>        #endif /* STRMAP_H */
>   8:  ea942eb803 =  8:  fd96e9fc8d strmap: enable faster clearing and reusing of strmaps
>   9:  c1d2172171 !  9:  f499934f54 strmap: add functions facilitating use as a string->int map
> [...]
>       @@ strmap.h: static inline int strmap_empty(struct strmap *map)
>      - 		var; \
>      - 		var = hashmap_iter_next_entry_offset(iter, 0))
>      + #define strmap_for_each_entry(mystrmap, iter, var)	\
>      + 	hashmap_for_each_entry(&(mystrmap)->map, iter, var, ent)
>        
>       +
>       +/*
>      @@ strmap.h: static inline int strmap_empty(struct strmap *map)

Definitely not a problem with your patches, but I noticed this curiosity
in the range-diff. Patch 7 changes the definition of the macro, but it
gets mentioned again in patch 9, even though the code wasn't touched.
The issue is that it the change from 7 ends up in the context of 9; the
actual modification in patch 9 is in those final couple lines touching a
comment (and they didn't change at all between the two versions).

I wonder if it would be reasonable to suppress range-diff hunks in which
all of the changed lines are context lines.

-Peff

             reply	other threads:[~2020-11-05 13:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 13:34 Jeff King [this message]
2020-11-05 20:55 ` Junio C Hamano
2020-11-17 21:35   ` Johannes Altmanninger
2020-11-17 21:35     ` [PATCH 1/3] range-diff: move " ## filename ##" headers to the first column Johannes Altmanninger
2020-11-17 21:35     ` [PATCH 2/3] range-diff: ignore context-only changes Johannes Altmanninger
2020-11-17 22:56       ` Eric Sunshine
2020-11-17 21:35     ` [PATCH 3/3] range-diff: only compute patch diff when patches are different Johannes Altmanninger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201105133437.GC91972@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=newren@gmail.com \
    --subject='Re: range-diff should suppress context-only changes?' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).