Skip to content

Commit 5218c83

Browse files
Oded WelgreenOded Welgreen
Oded Welgreen
authored and
Oded Welgreen
committed
Remove CultureInfo parameter from LibGit2sharpException ctor and use always InvariantCulture
1 parent ac4c7d9 commit 5218c83

14 files changed

+18
-33
lines changed

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: 2 additions & 3 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
}

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(

LibGit2Sharp/Reference.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal static T BuildFromPtr<T>(ReferenceSafeHandle handle, Repository repo) w
5959
break;
6060

6161
default:
62-
throw new LibGit2SharpException(CultureInfo.InvariantCulture, "Unable to build a new reference from a type '{0}'.", type);
62+
throw new LibGit2SharpException("Unable to build a new reference from a type '{0}'.", type);
6363
}
6464

6565
return reference as T;

LibGit2Sharp/ReferenceCollection.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,7 @@ public virtual Reference Rename(string currentName, string newName,
404404

405405
if (reference == null)
406406
{
407-
throw new LibGit2SharpException(
408-
CultureInfo.InvariantCulture,
409-
"Reference '{0}' doesn't exist. One cannot move a non existing reference.",
407+
throw new LibGit2SharpException("Reference '{0}' doesn't exist. One cannot move a non existing reference.",
410408
currentName);
411409
}
412410

@@ -547,8 +545,7 @@ public virtual Reference UpdateTarget(string name, string canonicalRefNameOrObje
547545
return UpdateTarget(symbolicReference, targetRef, logMessage);
548546
}
549547

550-
throw new LibGit2SharpException(CultureInfo.InvariantCulture,
551-
"Reference '{0}' has an unexpected type ('{1}').",
548+
throw new LibGit2SharpException("Reference '{0}' has an unexpected type ('{1}').",
552549
name,
553550
reference.GetType());
554551
}

LibGit2Sharp/Repository.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,8 +1858,7 @@ public void Move(IEnumerable<string> sourcePaths, IEnumerable<string> destinatio
18581858
FileStatus sourceStatus = keyValuePair.Key.Item2;
18591859
if (sourceStatus.HasAny(new Enum[] { FileStatus.Nonexistent, FileStatus.DeletedFromIndex, FileStatus.NewInWorkdir, FileStatus.DeletedFromWorkdir }))
18601860
{
1861-
throw new LibGit2SharpException(CultureInfo.InvariantCulture,
1862-
"Unable to move file '{0}'. Its current status is '{1}'.",
1861+
throw new LibGit2SharpException("Unable to move file '{0}'. Its current status is '{1}'.",
18631862
sourcePath,
18641863
sourceStatus);
18651864
}
@@ -1870,8 +1869,7 @@ public void Move(IEnumerable<string> sourcePaths, IEnumerable<string> destinatio
18701869
continue;
18711870
}
18721871

1873-
throw new LibGit2SharpException(CultureInfo.InvariantCulture,
1874-
"Unable to overwrite file '{0}'. Its current status is '{1}'.",
1872+
throw new LibGit2SharpException("Unable to overwrite file '{0}'. Its current status is '{1}'.",
18751873
destPath,
18761874
desStatus);
18771875
}

LibGit2Sharp/RepositoryExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ internal static IEnumerable<ObjectId> Committishes(this Repository repo, object
485485

486486
if (throwIfNotFound)
487487
{
488-
throw new LibGit2SharpException(CultureInfo.InvariantCulture, "Unexpected kind of identifier '{0}'.", identifier);
488+
throw new LibGit2SharpException("Unexpected kind of identifier '{0}'.", identifier);
489489
}
490490

491491
yield return null;

LibGit2Sharp/SubmoduleCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ internal T Lookup<T>(string name, Func<SubmoduleSafeHandle, T> selector, bool th
160160

161161
if (throwIfNotFound)
162162
{
163-
throw new LibGit2SharpException(CultureInfo.InvariantCulture, "Submodule lookup failed for '{0}'.", name);
163+
throw new LibGit2SharpException("Submodule lookup failed for '{0}'.", name);
164164
}
165165

166166
return default(T);

0 commit comments

Comments
 (0)