From: Maxim A. <ma...@ny...> - 2008-08-05 05:30:39
|
James, you did understand correctly the behavior (if the javadoc comment is obscure, please let me know). There is a genuine bug here, related to chages to relative paths, I think. I'll fix it. Anirudha, there is actually a pronblem with the cookbook documentation. You cannot create instance of GitFile, because constructor for that class is protected (my unit tests were probably misleading, as they are part of the same package. They were made before we decided to restrict that access; I apologize about the confusion). Please change this line: GitFile file = new GitFile("path/relative/to/workingtree/root.txt", wt); to: GitFile file = wt.getFile(new File("path/relative/to/workingtree/root.txt")); Thanks, - Max ----- Original Message ----- From: James Linder <jam...@gm...> Date: Monday, August 4, 2008 11:41 am Subject: Re: [Javagit-users] Cookbook To: Nutan Singh <ns...@ci...> Cc: jav...@li... > 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 > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the > world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Javagit-users mailing list > Jav...@li... > https://lists.sourceforge.net/lists/listinfo/javagit-users |