Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » different status between JGit and console command "git status"(getUntracked and getMissing are NOT empty for a clean working directory)
different status between JGit and console command "git status" [message #1760805] Wed, 03 May 2017 07:58
Youfeng Chen is currently offline Youfeng ChenFriend
Messages: 1
Registered: May 2017
Junior Member
I'm trying to use JGit to add file, commit and then push to remore git repository by software. the JGit version is: org.eclipse.jgit-4.6.1.201703071140-r.jar.

I find getUntracked and getMissing are NOT empty for a clean working directory.
the step is:

here is a master, ecg_dev and ecg_qa branch on remote, and in local, there is only master branch.

before doing other operations, I check status, and find the difference:

[root@sl1d-ecgagui01a ucdp_core]# git status
# On branch master
nothing to commit (working directory clean)


new displayGitRepoStatus Just enter commitConfigFileToGit
getChanged: []
getConflicting: []
getModified: []
getUntracked: [ucdpconfig_data/resources]
getUntrackedFolders: []
getAdded: []
getRemoved: []
getMissing: [...a lot of files here ...]

my code:
public static void displayGitRepoStatus(String displayInfo) {
System.out.println("new displayGitRepoStatus "+displayInfo);
try {
if(!openLocalRepository()) {
return;
}
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (GitAPIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {


StatusCommand statusCmd = GIT.status();
Status status;
status = statusCmd.call();
System.out.println("getChanged: "+status.getChanged());
System.out.println("getConflicting: "+status.getConflicting());
System.out.println("getModified: "+status.getModified());
System.out.println("getUntracked: "+status.getUntracked());
System.out.println("getUntrackedFolders: "+status.getUntrackedFolders());
System.out.println("getAdded: "+status.getAdded());
System.out.println("getRemoved: "+status.getRemoved());
System.out.println("getMissing: "+status.getMissing());
System.out.println("hasUncommittedChanges: "+status.hasUncommittedChanges());
System.out.println("isClean: "+status.isClean());
} catch (NoWorkTreeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (GitAPIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

I really need help to find out why this happens, thanks very much.
Previous Topic:Invalid history entries after push
Next Topic:Counting objects slow after Neon 3 update
Goto Forum:
  


Current Time: Thu Apr 25 07:41:02 GMT 2024

Powered by FUDForum. Page generated in 0.02931 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top