Task Description: Implement a Git Initialization Functionality
You need to implement a function that initializes a Git repository when provided with a specified directory. The functionality should include:
If the init command is called without any arguments, it should create a new Git repository in the current directory (where the command is executed).
If the init command is called with a directory name argument (e.g., "repo"), it should create a new Git repository in that directory.
Requirements:
Create a function named InitRepo in the /app/ directory that accepts a context and a directory name string.
The function should:
Create the specified directory if it does not already exist.
Initialize a new Git repository by creating a .git subdirectory within the specified directory.
Return an error if the repository cannot be initialized for any reason (e.g., if the directory already contains a .git directory).
Ensure that your implementation makes the provided tests in the Go test code pass by correctly managing both the default initialization (in the current directory) and custom directory initialization.
Important: declare your solution in package main (the test file uses package main, so the implementation must use the matching package name).