Skip to content

Commit 7dd95b8

Browse files
Oded WelgreenOded Welgreen
authored andcommitted
Remove CultureInfo parameter from LibGit2sharpException ctor and use always InvariantCulture
1 parent ac4c7d9 commit 7dd95b8

17 files changed

+31
-56
lines changed

LibGit2Sharp/AmbiguousSpecificationException.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ public AmbiguousSpecificationException(string message)
2727
/// <summary>
2828
/// Initializes a new instance of the <see cref="AmbiguousSpecificationException"/> class with a specified error message.
2929
/// </summary>
30-
/// <param name="cultureInfo">An object that supplies culture-specific formatting information.</param>
3130
/// <param name="format">A composite format string for use in <see cref="String.Format(IFormatProvider, string, object[])"/>.</param>
3231
/// <param name="args">An object array that contains zero or more objects to format.</param>
33-
public AmbiguousSpecificationException(CultureInfo cultureInfo, string format, params object[] args)
34-
: base(String.Format(cultureInfo, format, args))
32+
public AmbiguousSpecificationException(string format, params object[] args)
33+
: base(String.Format(format, args))
3534
{
3635
}
3736

LibGit2Sharp/BranchCollection.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ public virtual Branch Rename(Branch branch, string newName, bool allowOverwrite)
263263

264264
if (branch.IsRemote)
265265
{
266-
throw new LibGit2SharpException(CultureInfo.InvariantCulture,
267-
"Cannot rename branch '{0}'. It's a remote tracking branch.",
266+
throw new LibGit2SharpException("Cannot rename branch '{0}'. It's a remote tracking branch.",
268267
branch.FriendlyName);
269268
}
270269

LibGit2Sharp/Configuration.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,7 @@ private ConfigurationSafeHandle RetrieveConfigurationHandle(ConfigurationLevel l
693693

694694
if (handle == null && throwIfStoreHasNotBeenFound)
695695
{
696-
throw new LibGit2SharpException(CultureInfo.InvariantCulture,
697-
"No {0} configuration file has been found.",
696+
throw new LibGit2SharpException("No {0} configuration file has been found.",
698697
Enum.GetName(typeof(ConfigurationLevel), level));
699698
}
700699

LibGit2Sharp/Core/Proxy.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,9 +1432,8 @@ public static IntPtr git_odb_backend_malloc(IntPtr backend, UIntPtr len)
14321432

14331433
if (IntPtr.Zero == toReturn)
14341434
{
1435-
throw new LibGit2SharpException(CultureInfo.InvariantCulture,
1436-
"Unable to allocate {0} bytes; out of memory",
1437-
len,
1435+
throw new LibGit2SharpException("Unable to allocate {0} bytes; out of memory",
1436+
len,
14381437
GitErrorCode.Error,
14391438
GitErrorCategory.NoMemory);
14401439
}
@@ -2556,8 +2555,7 @@ public static Tuple<GitObjectSafeHandle, ReferenceSafeHandle> git_revparse_ext(R
25562555
return null;
25572556

25582557
case (int)GitErrorCode.Ambiguous:
2559-
throw new AmbiguousSpecificationException(CultureInfo.InvariantCulture,
2560-
"Provided abbreviated ObjectId '{0}' is too short.",
2558+
throw new AmbiguousSpecificationException("Provided abbreviated ObjectId '{0}' is too short.",
25612559
objectish);
25622560

25632561
default:
@@ -2778,8 +2776,7 @@ public static FileStatus git_status_file(RepositorySafeHandle repo, FilePath pat
27782776
return FileStatus.Nonexistent;
27792777

27802778
case (int)GitErrorCode.Ambiguous:
2781-
throw new AmbiguousSpecificationException(CultureInfo.InvariantCulture,
2782-
"More than one file matches the pathspec '{0}'. " +
2779+
throw new AmbiguousSpecificationException("More than one file matches the pathspec '{0}'. " +
27832780
"You can either force a literal path evaluation " +
27842781
"(GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH), or use git_status_foreach().",
27852782
path);

LibGit2Sharp/Diff.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ private static T BuildDiffResult<T>(DiffSafeHandle diff) where T : class, IDiffR
109109

110110
if (!ChangesBuilders.TryGetValue(typeof(T), out builder))
111111
{
112-
throw new LibGit2SharpException(CultureInfo.InvariantCulture,
113-
"User-defined types passed to Compare are not supported. Supported values are: {0}",
112+
throw new LibGit2SharpException("User-defined types passed to Compare are not supported. Supported values are: {0}",
114113
string.Join(", ", ChangesBuilders.Keys.Select(x => x.Name)));
115114
}
116115

LibGit2Sharp/GitObject.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ internal static GitObject BuildFrom(Repository repo, ObjectId id, GitObjectType
7777
return new Blob(repo, id);
7878

7979
default:
80-
throw new LibGit2SharpException(CultureInfo.InvariantCulture,
81-
"Unexpected type '{0}' for object '{1}'.",
80+
throw new LibGit2SharpException("Unexpected type '{0}' for object '{1}'.",
8281
type,
8382
id);
8483
}

LibGit2Sharp/LibGit2SharpException.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ public LibGit2SharpException(string message, Exception innerException)
3737
/// <summary>
3838
/// Initializes a new instance of the <see cref="LibGit2SharpException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception.
3939
/// </summary>
40-
/// <param name="cultureInfo">An object that supplies culture-specific formatting information.</param>
4140
/// <param name="format">A composite format string for use in <see cref="String.Format(IFormatProvider, string, object[])"/>.</param>
4241
/// <param name="args">An object array that contains zero or more objects to format.</param>
43-
public LibGit2SharpException(CultureInfo cultureInfo, string format, params object[] args)
44-
: base(String.Format(cultureInfo, format, args))
42+
public LibGit2SharpException(string format, params object[] args)
43+
: base(String.Format(CultureInfo.InvariantCulture, format, args))
4544
{
4645
}
4746

LibGit2Sharp/Network.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,7 @@ public virtual void Push(
399399
{
400400
if (string.IsNullOrEmpty(branch.UpstreamBranchCanonicalName))
401401
{
402-
throw new LibGit2SharpException(
403-
CultureInfo.InvariantCulture,
404-
"The branch '{0}' (\"{1}\") that you are trying to push does not track an upstream branch.",
402+
throw new LibGit2SharpException("The branch '{0}' (\"{1}\") that you are trying to push does not track an upstream branch.",
405403
branch.FriendlyName, branch.CanonicalName);
406404
}
407405
}

LibGit2Sharp/Rebase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ public virtual RebaseResult Start(Branch branch, Branch upstream, Branch onto, I
8181

8282
if (this.repository.Info.CurrentOperation != CurrentOperation.None)
8383
{
84-
throw new LibGit2SharpException(CultureInfo.InvariantCulture,
85-
"A {0} operation is already in progress.",
84+
throw new LibGit2SharpException("A {0} operation is already in progress.",
8685
this.repository.Info.CurrentOperation);
8786
}
8887

LibGit2Sharp/RebaseOperationImpl.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ private static RebaseResult RunRebaseStep(RebaseSafeHandle rebaseOperationHandle
119119
case RebaseStepOperation.Fixup:
120120
case RebaseStepOperation.Reword:
121121
// These operations are not yet supported by lg2.
122-
throw new LibGit2SharpException(CultureInfo.InvariantCulture,
123-
"Rebase Operation Type ({0}) is not currently supported in LibGit2Sharp.",
122+
throw new LibGit2SharpException("Rebase Operation Type ({0}) is not currently supported in LibGit2Sharp.",
124123
stepToApplyInfo.Type);
125124
default:
126125
throw new ArgumentException(string.Format(

0 commit comments

Comments
 (0)