git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Weirdness with git change detection

From
Jeff King <peff@peff.net>
Date
Jul 11, 2017, 07:06 UTC
Message-ID
<20170711070618.dq52o67ixvjudafg@sigill.intra.peff.net>
In-Reply-To
<d047a884-b698-c25b-59e9-3a2704f79fb3@web.de>
On Tue, Jul 11, 2017 at 06:15:17AM +0200, Torsten Bögershausen wrote:
Show 17 quoted lines
> On 11/07/17 01:45, Peter Eckersley wrote:
> > I have a local git repo that's in some weird state where changes
> > appear to be detected by "git diff" and prevent operations like "git
> > checkout" from switching branches, but those changes are not removed
> > by a "git reset --hard" or "git stash".
> > 
> > Here's an example of the behaviour, with "git reset --hard" failing to
> > clear a diff in the index:
> > 
> > https://paste.debian.net/975811/
> > 
> > Happy to collect additional debugging information if it's useful.
> > 
> If possible, we need to clone the repo and debug ourselfs - in other
> words, the problem must be reproducible for others.
> 
> It the repo public ?
It looks like https://github.com/AI-metrics/AI-metrics.
I notice it has a .gitattributes file with:
  *.ipynb filter=clean_ipynb
There's a config snippet in the repo with:
  [filter "clean_ipynb"]
    clean = ipynb_drop_output
    smudge = cat

and the drop_output script is included. From the paste we can see that Peter was at commit c464aaa. Checking out that commit and running the script shows that it produces the differences that Git is showing.

The problem is that the currently committed contents do not match the output of the clean filter. So even when "git reset --hard" puts the content from the repository back into the working tree (putting it through the smudge filter, which is a noop), running the clean filter on the result will always have a difference. Either the filter needs to be disabled, or the cleaned contents committed.

-Peff
Previous: Torsten BögershausenNext: Peter Eckersley
Message 3 of 11 in “Weirdness with git change detection”
  1. Peter EckersleyJul 10, 2017
  2. Torsten BögershausenJul 11, 2017
  3. Jeff KingJul 11, 2017
  4. Peter EckersleyJul 11, 2017
  5. Jeff KingJul 11, 2017
  6. Torsten BögershausenJul 11, 2017
  7. Jeff KingJul 11, 2017
  8. Michael J GruberAug 18, 2017
  9. Jeff KingAug 18, 2017
  10. Junio C HamanoJul 11, 2017
  11. Junio C HamanoJul 11, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.