Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
Add additional logging for #124
Browse files Browse the repository at this point in the history
  • Loading branch information
GeertvanHorrik committed Nov 27, 2016
1 parent 1943799 commit d932f28
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/GitLink/ArgumentParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,34 @@ public static Context ParseArguments(List<string> commandLineArguments, IProvide

if (string.IsNullOrEmpty(context.TargetUrl))
{
Log.Info("No target url was specified, trying to determine the target url automatically");
Log.Info($"No target url was specified, trying to determine the target url automatically based on directory '{context.SolutionDirectory}'");

var gitDir = GitDirFinder.TreeWalkForGitDir(context.SolutionDirectory);
if (gitDir != null)

if (gitDir == null)
{
Log.Warning("Could not find a .git directory by walking up the directory tree");
}
else
{
Log.Debug($"Found git directory at '{gitDir}', opening repository");

using (var repo = RepositoryLoader.GetRepo(gitDir))
{
var currentBranch = repo.Head;

if (string.IsNullOrEmpty(context.ShaHash))
{
context.ShaHash = currentBranch.Tip.Sha;

Log.Debug($"Automatically determined sha '{context.ShaHash}'");
}

if (currentBranch.Remote == null || currentBranch.IsDetachedHead())
{
currentBranch = repo.GetBranchesContainingCommit(context.ShaHash).FirstOrDefault(b => b.Remote != null);

Log.Debug($"Automatically determined branch '{currentBranch}'");
}

if (currentBranch != null && currentBranch.Remote != null)
Expand Down

0 comments on commit d932f28

Please sign in to comment.