repo git: Move conflicted files to right subfolder. Fixes #1736
This commit is contained in:
parent
c36ab4454b
commit
f737a5bcc3
|
@ -497,10 +497,8 @@ namespace Sparkles.Git {
|
||||||
// Remove possible rename indicators
|
// Remove possible rename indicators
|
||||||
string [] separators = {" -> \"", " -> "};
|
string [] separators = {" -> \"", " -> "};
|
||||||
foreach (string separator in separators) {
|
foreach (string separator in separators) {
|
||||||
if (conflicting_path.Contains (separator)) {
|
if (conflicting_path.Contains (separator))
|
||||||
conflicting_path = conflicting_path.Substring (
|
conflicting_path = conflicting_path.Substring (conflicting_path.IndexOf (separator) + separator.Length);
|
||||||
conflicting_path.IndexOf (separator) + separator.Length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.LogInfo ("Git", Name + " | Conflict type: " + line);
|
Logger.LogInfo ("Git", Name + " | Conflict type: " + line);
|
||||||
|
@ -535,11 +533,12 @@ namespace Sparkles.Git {
|
||||||
// Windows doesn't allow colons in the file name, so
|
// Windows doesn't allow colons in the file name, so
|
||||||
// we use "h" between the hours and minutes instead.
|
// we use "h" between the hours and minutes instead.
|
||||||
string timestamp = DateTime.Now.ToString ("MMM d H\\hmm");
|
string timestamp = DateTime.Now.ToString ("MMM d H\\hmm");
|
||||||
|
|
||||||
string our_path = Path.GetFileNameWithoutExtension (conflicting_path) +
|
string our_path = Path.GetFileNameWithoutExtension (conflicting_path) +
|
||||||
" (" + base.local_config.User.Name + ", " + timestamp + ")" + Path.GetExtension (conflicting_path);
|
" (" + base.local_config.User.Name + ", " + timestamp + ")" + Path.GetExtension (conflicting_path);
|
||||||
|
|
||||||
string abs_conflicting_path = Path.Combine (LocalPath, conflicting_path);
|
string abs_conflicting_path = Path.Combine (LocalPath, conflicting_path);
|
||||||
string abs_our_path = Path.Combine (LocalPath, our_path);
|
string abs_our_path = Path.Combine (Path.GetDirectoryName (abs_conflicting_path), our_path);
|
||||||
|
|
||||||
if (File.Exists (abs_conflicting_path) && !File.Exists (abs_our_path))
|
if (File.Exists (abs_conflicting_path) && !File.Exists (abs_our_path))
|
||||||
File.Move (abs_conflicting_path, abs_our_path);
|
File.Move (abs_conflicting_path, abs_our_path);
|
||||||
|
|
Loading…
Reference in a new issue