mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-18 06:22:28 +03:00
avoid forcefully making files executable on Windows (#3329).
Instead, respect the existing bit if set in Git, but do not try to derive it from the filesystem which is something Git doesn't seem to be doing on Windows either. This also makes me think that `gitoxide` should make it easy to build a tree from a file and deal with this.
This commit is contained in:
parent
6033a62a94
commit
34770a4b77
@ -2101,9 +2101,7 @@ pub fn write_tree_onto_tree(
|
|||||||
let git_repository = &project_repository.git_repository;
|
let git_repository = &project_repository.git_repository;
|
||||||
let mut builder = git_repository.treebuilder(Some(base_tree));
|
let mut builder = git_repository.treebuilder(Some(base_tree));
|
||||||
// now update the index with content in the working directory for each file
|
// now update the index with content in the working directory for each file
|
||||||
for (filepath, hunks) in files {
|
for (rel_path, hunks) in files {
|
||||||
// convert this string to a Path
|
|
||||||
let rel_path = Path::new(&filepath);
|
|
||||||
let full_path = project_repository.path().join(rel_path);
|
let full_path = project_repository.path().join(rel_path);
|
||||||
|
|
||||||
let is_submodule = full_path.is_dir()
|
let is_submodule = full_path.is_dir()
|
||||||
@ -2122,12 +2120,21 @@ pub fn write_tree_onto_tree(
|
|||||||
filemode = git::FileMode::BlobExecutable;
|
filemode = git::FileMode::BlobExecutable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
{
|
{
|
||||||
// TODO(qix-): Pull from `core.filemode` config option to determine
|
// NOTE: *Keep* the existing executable bit if it was present
|
||||||
// TODO(qix-): the behavior on windows. For now, we set this to true.
|
// in the tree already, don't try to derive something from
|
||||||
// TODO(qix-): It's not ideal, but it gets us to a windows build faster.
|
// the FS that doesn't exist.
|
||||||
filemode = git::FileMode::BlobExecutable;
|
filemode = base_tree
|
||||||
|
.get_path(rel_path)
|
||||||
|
.ok()
|
||||||
|
.and_then(|entry| {
|
||||||
|
(entry.filemode() & 0o100000 == 0o100000
|
||||||
|
&& entry.filemode() & 0o111 != 0)
|
||||||
|
.then_some(git::FileMode::BlobExecutable)
|
||||||
|
})
|
||||||
|
.unwrap_or(filemode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if metadata.file_type().is_symlink() {
|
if metadata.file_type().is_symlink() {
|
||||||
|
Loading…
Reference in New Issue
Block a user