|
From: Nutan S. <ns...@ci...> - 2008-08-04 17:27:44
|
Actually, I looked into API and its test package and didn't see a
single call of add with working tree object(or any folder). That's
where the doubt arose from. Probably its not tested.
After exploring it further I found that we in deed trying to make it
work that way i.e. making add() work for a directory where all the
files in the directory should get added(if not added already). But, I
think the the following code in gitFileSystemObject doesn't work as
expected
"
if(relativePath.isDirectory()){
for(File f : relativePath.listFiles()){
list.add(f);
}
}
"
Because the getRelativePath() method which fills up the relativePath
always returns a new File object which is not a directory, hence,
isDirectory() will never be true.
Thanks,
Nutan
On Mon, Aug 4, 2008 at 11:41 AM, James Linder <jam...@gm...> wrote:
> On Mon, Aug 4, 2008 at 11:27 AM, James Linder <jam...@gm...> wrote:
>> [inline]
>>
>> On Mon, Aug 4, 2008 at 11:19 AM, Nutan Singh <ns...@ci...> wrote:
>>> Hi,
>>>
>>> In,
>>>
>>> "Adding files to the repository
>>>
>>> // The "/path/to/working/tree" is the directory containing the .git directory
>>> File workingTreePath = new File("/path/to/working/tree");
>>> WorkingTree wt = WorkingTree.getInstance(workingTreePath);
>>>
>>> GitFile file = new GitFile("path/relative/to/workingtree/root.txt", wt);
>>>
>>> GitAddResponse ar = wt.add();
>>> "
>>>
>>> Shouldn't the last line be
>>> GitAddResponse ar = file.add(); ?
>>
>> I think it can be either. file.add() will add that specific file.
>> wt.add() will add the working tree root and everything under it; it's
>> like running the command 'git add .' when in the working tree root.
>
> At least, that is my understanding of how wt.add() is supposed to
> work. In any case, wt.add() should be made to work in a predictable
> manner and have its javadocs clearly written to explain how it works.
>
>>> A bug (http://sourceforge.net/tracker/index.php?func=detail&aid=2037398&group_id=233450&atid=1089899)
>>> is also raised about add not working for workingTree. I think the
>>> reason is improper calling, and, its not a bug.
>>>
>>> Thanks,
>>> Nutan
>>
>
>
|