-
Notifications
You must be signed in to change notification settings - Fork 865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Branch name for git detached head #1098
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2634cc8
fix(GitUtility): get remote branch when git is a detached head
richardschneider 34cabfb
test(GitUtility): remove test because of caching
richardschneider ff92a6e
Merge remote-tracking branch 'upstream/dev' into detect-branch
richardschneider 561be0c
feat(GitUtility): Allow DOCFX_SOURCE_BRANCH_NAME environment variable
richardschneider 2375d60
docs(ci): using docfx with a build server
richardschneider 8406788
test(GitUtility): remove empty line
richardschneider 9204df9
fix(GitUtility): LogInfo to tell users that branch name is found in env
richardschneider 3d9a5b5
fix(GitUtility); only use build server env names when there is git d…
richardschneider 5f474cb
fix(GitUtilities): more logging and code cleanup
richardschneider File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.DocAsCode.Common.Tests | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
using Xunit; | ||
using YamlDotNet.Core; | ||
|
||
using Microsoft.DocAsCode.Common.Git; | ||
using Microsoft.DocAsCode.YamlSerialization; | ||
|
||
[Trait("Owner", "makaretu")] | ||
public class GitUtilityTest | ||
{ | ||
[Fact] | ||
public void Environment_ForBranchName() | ||
{ | ||
const string envName = "DOCFX_SOURCE_BRANCH_NAME"; | ||
var original = Environment.GetEnvironmentVariable(envName); | ||
try | ||
{ | ||
Environment.SetEnvironmentVariable(envName, "special-branch"); | ||
var info = GitUtility.GetFileDetail(Directory.GetCurrentDirectory()); | ||
Assert.Equal("special-branch", info.RemoteBranch); | ||
} | ||
finally | ||
{ | ||
Environment.SetEnvironmentVariable(envName, original); | ||
} | ||
} | ||
|
||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Support
DOCFX_SOURCE_BRANCH_NAME
is enough? Use documentation to tell CI users how to configure environment variables with different build systems?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to have docfx run on common the build system without any special instructions.