Skip to content

Conversation

@maxkvant
Copy link
Owner

No description provided.

Copy link
Collaborator

@yurii-litvinov yurii-litvinov left a 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;
Copy link
Collaborator

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());
Copy link
Collaborator

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;
Copy link
Collaborator

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();
Copy link
Collaborator

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);
Copy link
Collaborator

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");
Copy link
Collaborator

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();
Copy link
Collaborator

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();
Copy link
Collaborator

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;
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Суперумный репозиторий, против которого я выступал на паре. Нельзя ли часть функциональности перенести в vcs_objects или в новые классы?

Copy link
Collaborator

@yurii-litvinov yurii-litvinov left a 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-объекты.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants