2

I have a task to implement a program in Java (pure Java without 3rd party libraries) that reads a history of any git repository and puts the commits into tree data structure. enter image description here

Could you give me any hints? How to read git log in Java without 3rd party libraries?

Pasha
  • 1,768
  • 6
  • 22
  • 43
  • If you are not allowed to use 3rd party libs like jgit, you will need to study [git internals](https://git-scm.com/book/en/v1/Git-Internals), and, basically, reinvent the wheel. – jingx Jun 17 '18 at 09:23
  • Will it take much much time? – Pasha Jun 17 '18 at 09:28
  • Yes, parsing command output yourself generally takes more time – OneCricketeer Jun 17 '18 at 09:44
  • Can u give me any hints that can help me to parse it? I think I can put branches in LinkedHashSet but how can I establish connections(merges etc) between them? – Pasha Jun 17 '18 at 09:47
  • Give an example of output you're trying to parse and the code you've tried in the question, please – OneCricketeer Jun 17 '18 at 09:50

1 Answers1

2

You might want to take a look at Processes and Threads and how to execute a command in the runtime. It does have some details and need fundamental understanding of java.lang.Runtime, java.io and some other relevant topics, so that I'd refrain to write a whole method here and recommend you to search for a good tutorial and also get the first idea from other questions here, like → getting output from executing a command line program

roxch
  • 351
  • 3
  • 16