SVCS - English Documentation
Loading...
Searching...
No Matches
HubCommand.cxx File Reference

Implementation of the HubCommand class for creating bare repositories. More...

#include "../include/HubCommand.hxx"
#include "../../services/Event.hxx"
#include <filesystem>
#include <fstream>
#include <iostream>

Namespaces

namespace  svcs::server
 Server-side components and administration commands.
namespace  svcs::server::cli
 Server administration command-line interface components.

Detailed Description

Implementation of the HubCommand class for creating bare repositories.

This file provides the concrete implementation for the HubCommand class. The execute method handles the logic for:

  1. Argument Validation: Ensures exactly one valid path is provided.
  2. Filesystem Checks: Verifies that a repository doesn't already exist at the target location.
  3. Directory Creation: Creates the target directory and the full .svcs "bare" repository structure (objects, refs, hooks, etc.).
  4. File Seeding: Writes the initial config, HEAD, and description files.
  5. Notifications: Uses the ISubject event bus to report success, info, or error messages. This command uses the RepositoryManager dependency indirectly, as the logic is simple enough to be self-contained filesystem operations, but it relies on the manager's path conventions.