{"action":"opened","issue":{"url":"https://api.github.com/repos/dmusican/Elegit/issues/139","repository_url":"https://api.github.com/repos/dmusican/Elegit","labels_url":"https://api.github.com/repos/dmusican/Elegit/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/dmusican/Elegit/issues/139/comments","events_url":"https://api.github.com/repos/dmusican/Elegit/issues/139/events","html_url":"https://github.com/dmusican/Elegit/issues/139","id":138895475,"number":139,"title":"Git shallow clone as a way of viewing remote","user":{"login":"shangdrk","id":7304910,"avatar_url":"https://avatars.githubusercontent.com/u/7304910?v=3","gravatar_id":"","url":"https://api.github.com/users/shangdrk","html_url":"https://github.com/shangdrk","followers_url":"https://api.github.com/users/shangdrk/followers","following_url":"https://api.github.com/users/shangdrk/following{/other_user}","gists_url":"https://api.github.com/users/shangdrk/gists{/gist_id}","starred_url":"https://api.github.com/users/shangdrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shangdrk/subscriptions","organizations_url":"https://api.github.com/users/shangdrk/orgs","repos_url":"https://api.github.com/users/shangdrk/repos","events_url":"https://api.github.com/users/shangdrk/events{/privacy}","received_events_url":"https://api.github.com/users/shangdrk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dmusican/Elegit/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-07T05:52:51Z","updated_at":"2016-03-07T05:52:51Z","closed_at":null,"body":"Motivation: \r\nWe want to support viewing remote repos in Elegit. One way of achieving this is to do a shallow clone of the remote repository, store it in a temp directory, and implement a simple directory tree viewer using javaFX to display it. However, at this point JGit doesn't support shallow clone.\r\n\r\nCurrent Progress:\r\nI explored the possibility of implementing shallow clone in JGit. It seems to be a complicated task. Basically to download all the objects we need, we can see what commit objects that the references in .git/refs/heads point to, find those commit objects and only download blob and tree objects that the commit objects specify, and leave out all the parents of those commits. This works fine until git creates something called pack to save disk space. For relatively large repos, git packs different versions of the same file (actually not necessarily the same file but that's the basic idea) into a pack object. Each time the user changes the file, git will store only the changes instead of an object containing all the contents. Due to this feature, a shallow clone becomes very complicated, because some objects we want to download might be in a packfile, and we need to figure out which pack it's in and what part of that pack is the version we want, etc."}}