Solved

C# - Find git repository programmatically - source code requested

Posted on 2016-08-10
3
454 Views
Last Modified: 2016-08-18
In a C# windows form application, if I want to scan my entire hard drive and locate all of the git repositories that were created using "git clone [path_to_repository]".  Of course I know where they all are already - I want to find the same repos programmatically. -- how would this best be done?

When a "git clone ..." command is run, are there always certain files created?  Tell-tale ways to know a folder is a repo?

Is the presence of a hidden ".git" folder enough to pretty much a "guarantee" that I am inside a repository?

Please provide working C# source code.
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
plusone3055 earned 500 total points
ID: 41751045
I suggest looking at github

https://github.com/manojlds/cmd

The API/SDK may have the source code you need :)
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 41751127
An interesting share, but I still want to accomplish the above FIRST - then perhaps use the library to run git commands SECOND.
0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 41761160
Well, no other takers, so you get the points, my friend.

My final solution was to not try and find the .git folders.  It took such a long time to search the entire drive that it was not worth attempting a brute force approach.  So I just have the user provide the git directory herself.

I will still consider your advice and will pursue it more if I think I need to.

Tom
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
How to commit changes, push them to a remote repository, and pull them from another location using the EGit plugin for Eclipse.
Explains the Git Index and the differences between a Remote, a Remote Tracking Branch, and a Local (or Tracking) branch.

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question