Bug 411492 - add() fails with InvalidPathException when repo contains a certain combination of folders including a folder beginning with a space-character
Summary: add() fails with InvalidPathException when repo contains a certain combinatio...
Status: NEW
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-24 09:38 EDT by Florian Sellmayr CLA
Modified: 2013-06-24 09:39 EDT (History)
1 user (show)

See Also:


Attachments
JUnit-Test that reproduces the bug (1.58 KB, text/x-java)
2013-06-24 09:38 EDT, Florian Sellmayr CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Sellmayr CLA 2013-06-24 09:38:13 EDT
Created attachment 232701 [details]
JUnit-Test that reproduces the bug

If the repository contains a certain combination of folders, mainly one containing a space as first character, the AddCommand fails after moving one of the folders. 

Steps to reproduce: 
Create this directory-structure: 
./ startsWithSpace
./ startsWithSpace/x
./ startsWithSpace/a
./ startsWithSpace/a/b
./ startsWithSpace/a/b/c.file

initialize git, commit the whole structure
move "./ startsWithSpace/a/b" to "./ startsWithSpace/x"
call the add(.) 
This results in the following exception: 
org.eclipse.jgit.dircache.InvalidPathException: Invalid path: /startsWithSpace/x/b/c.file
	at org.eclipse.jgit.dircache.DirCacheEntry.<init>(DirCacheEntry.java:270)
	at org.eclipse.jgit.dircache.DirCacheEntry.<init>(DirCacheEntry.java:251)
	at org.eclipse.jgit.dircache.DirCacheEntry.<init>(DirCacheEntry.java:220)
	at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:170)

Notice that the invalid path does not contain the space-character. 

For details, refer to the attached JUnit-Test which reproduces the bug. 
This bug was tested on releases 2.3.1.201302201838-r and 2.1.0.201209190230-r