Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Cannot get FollowFilter to work

Hi All

I am trying to show the history of a single file and follow renames. My test setup is as follows:
  1. Create a file named 'old' with some content
  2. commit
  3. Rename the 'old' file to 'new', the content remains exactly the same
  4. commit

The git config file contains:
  [diff]
  renames = true
  renameLimit = 2000  # doesn't seem to have an impact

My expectation would be to see two commits, however only the most recent commit is shown.
Here is the code I am experimenting with:

  DiffConfig diffConfig = repo.getConfig().get( DiffConfig.KEY );
  RevWalk walk = new RevWalk( repo );
  walk.setTreeFilter( FollowFilter.create( "new", diffConfig );
  for( RevCommit commit : walk ) {
    System.out.println( commit.getShortMessage() );
  }

On the very same repository 'git --follow new' shows both commits

I also studied the EGit history view code in an attempt to adopt the RevWalk setup and RenameTracker for my needs - however without success. Showing the history of 'new' with EGit from Neon.1 does not track renames either.

Is there a bug preventing the rename detection from working, or am I missing something?

Thanks in advance
Rüdiger


Back to the top