-
Notifications
You must be signed in to change notification settings - Fork 0
add 002-my-vcs #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
yurii-litvinov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- неплохо бы создавать какую-нибудь ветку по умолчанию, чтобы не вынуждать вручную создавать ветку перед первым коммитом
log -bпишет current branch: null всегда- создал бранч, добавил туда файл, закоммитил, переключился на первый бранч, переключился обратно ---
Exception in thread "main" java.lang.NullPointerException
at java.nio.file.Files.provider(Files.java:97)
at java.nio.file.Files.createDirectory(Files.java:674)
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
at java.nio.file.Files.createDirectories(Files.java:727)
at com.maxim.vcs_impl.VcsImpl.checkoutCommit(VcsImpl.java:101)
at com.maxim.vcs_impl.VcsImpl.checkoutBranch(VcsImpl.java:120)
at com.maxim.Main$4.execute(Main.java:60)
at com.maxim.Main.run(Main.java:140)
at com.maxim.Main.main(Main.java:132)
- нельзя удалить ветку?
- есть подозрение, что log -c показывает все коммиты вообще, а не коммиты текущей ветки
| package com.maxim; | ||
|
|
||
| import com.google.common.collect.ImmutableList; | ||
| import com.google.common.collect.ImmutableSet; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDEA говорит, что этот класс тут не нужен
| } | ||
|
|
||
| public void run() { | ||
| List<Command> ok_commands = commands.stream().filter(command -> command.check(args)).collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok_commands как-то не по стайлгайду. camelCase же (https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html)
|
|
||
| private abstract static class Command { | ||
| private final ImmutableList<String> args_names; | ||
| private final int prefix_len; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут тоже все поля не по стайлгайду названы
| } catch (ClassNotFoundException e) { | ||
| e.printStackTrace(); | ||
| } | ||
| throw new RuntimeException(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так мы теряем информацию о причине исключения, лучше e обернуть
| Files.createDirectories(commits_dir_path); | ||
| Files.createDirectories(blobs_dir_path); | ||
| Files.createDirectories(branches_dir_path); | ||
| Files.createDirectories(branches_dir_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мм?
| readIndex(); | ||
|
|
||
| if (index.branch == null) { | ||
| throw new IOException("Please, checkout branch or create branch"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше свои исключения кидать, иначе не отличить ошибку на уровне библиотеки от ошибки на уровне Вашего кода
| vcs.createBranch("branch"); | ||
|
|
||
| Callable<List<Path>> getAdded = () -> { | ||
| Map < Path, String > cur_status = vcs.status(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Необычная расстановка пробелов
| @Test | ||
| public void logTest() throws IOException { | ||
| final Vcs vcs = new VcsImpl(Paths.get(temporaryFolder.getRoot().getPath())); | ||
| List<Path> paths = initFolder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется, не используется
| this.commit_id = branch.commit_id; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Суперумный репозиторий, против которого я выступал на паре. Нельзя ли часть функциональности перенести в vcs_objects или в новые классы?
yurii-litvinov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По поводу продвинутой VCS:
- status показывает статус файлов из .vcs, а не должен
- файлы, которые commited, лучше в status вообще не показывать, иначе для большого проекта мы никогда содержательную информацию в выдаче не найдём
- если просто удалить закоммиченный файл с диска, status его вообще не покажет (а должен говорить что-то про то, что он missing)
- кстати, reset на удалённый таким образом файл ругается "no such committed file", но он же закоммичен, просто его в рабочей копии нет
- если на изменённый файл сделать add, то status всё равно показывает его как modified (а должен как staged или что-то такое)
- команда clean снесла вообще весь репозиторий, оставив только пустые папки. Кстати, по-хорошему, пустые папки лучше удалять (гит по умолчанию так не делает, но там опция есть)
Ещё по условию требовалось добавить логирование и mock-объекты.
No description provided.