nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: sharkdp/fd
Pull request #908 (2021-12-21 07:15:26)

Fix logic for --no-ignore-parent
Make sure that using `--no-ignore-vcs` or `--no-ignore` don't also
enable `--no-ignore-parent`. So that if `--no-ignore-vcs` is enabled, it
continues to respect .fdignore and .ignore in the parent directories.

Fixes: #907
Fixes: #901

tmccombs: Yeah haven't gotten a chance to run that yet

Patch:
diff --git a/src/main.rs b/src/main.rs
index 4f4ab14..56d6bfb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -260,10 +260,7 @@ fn construct_config(matches: clap::ArgMatches, pattern_regex: &str) -> Result<Co
         read_vcsignore: !(matches.is_present("no-ignore")
             || matches.is_present("rg-alias-hidden-ignore")
             || matches.is_present("no-ignore-vcs")),
-        read_parent_ignore: !(matches.is_present("no-ignore")
-            || matches.is_present("rg-alias-hidden-ignore")
-            || matches.is_present("no-ignore-vcs")
-            || matches.is_present("no-ignore-parent")),
+        read_parent_ignore: !matches.is_present("no-ignore-parent"),
         read_global_ignore: !(matches.is_present("no-ignore")
             || matches.is_present("rg-alias-hidden-ignore")
             || matches.is_present("no-global-ignore-file")),
diff --git a/src/walk.rs b/src/walk.rs
index d69c813..037baae 100644
--- a/src/walk.rs
+++ b/src/walk.rs
@@ -72,7 +72,7 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<Config>) -> R
     walker
         .hidden(config.ignore_hidden)
         .ignore(config.read_fdignore)
-        .parents(config.read_parent_ignore)
+        .parents(config.read_parent_ignore && (config.read_fdignore || config.read_vcsignore))
         .git_ignore(config.read_vcsignore)
         .git_global(config.read_vcsignore)
         .git_exclude(config.read_vcsignore)


Test patch:
diff --git a/tests/tests.rs b/tests/tests.rs
index 807b91b..e6cee6c 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -614,6 +614,22 @@ fn test_no_ignore_vcs() {
     );
 }
 
+/// Test that --no-ignore-vcs still respects .fdignored in parent directory
+#[test]
+fn test_no_ignore_vcs_child_dir() {
+    let te = TestEnv::new(
+        &["inner"],
+        &["inner/fdignored.foo", "inner/foo", "inner/gitignored.foo"],
+    );
+
+    te.assert_output_subdirectory(
+        "inner",
+        &["--no-ignore-vcs", "foo"],
+        "./foo
+        ./gitignored.foo",
+    );
+}
+
 /// Custom ignore files (--ignore-file)
 #[test]
 fn test_custom_ignore_files() {
Repository: sharksforarms/deku
Pull request #166 (2021-01-09 05:08:21)

Some improvements
Small code changes I found while looking over the code


Patch:
diff --git a/deku-derive/src/macros/deku_write.rs b/deku-derive/src/macros/deku_write.rs
index fe86a65..e0985d8 100644
--- a/deku-derive/src/macros/deku_write.rs
+++ b/deku-derive/src/macros/deku_write.rs
@@ -382,14 +382,11 @@ fn emit_field_writes(
     fields: &Fields<&FieldData>,
     object_prefix: Option<TokenStream>,
 ) -> Result<Vec<TokenStream>, syn::Error> {
-    let mut field_writes = vec![];
-
-    for (i, f) in fields.iter().enumerate() {
-        let field_write = emit_field_write(input, i, f, &object_prefix)?;
-        field_writes.push(field_write);
-    }
-
-    Ok(field_writes)
+    fields
+        .iter()
+        .enumerate()
+        .map(|(i, f)| emit_field_write(input, i, f, &object_prefix))
+        .collect()
 }
 
 fn emit_field_updates(
diff --git a/src/impls/cstring.rs b/src/impls/cstring.rs
index 87d486b..bb1a404 100644
--- a/src/impls/cstring.rs
+++ b/src/impls/cstring.rs
@@ -8,9 +8,7 @@ where
 {
     fn write(&self, output: &mut BitVec<Msb0, u8>, ctx: Ctx) -> Result<(), DekuError> {
         let bytes = self.as_bytes_with_nul();
-        bytes.write(output, ctx)?;
-
-        Ok(())
+        bytes.write(output, ctx)
     }
 }
 


Test patch:
diff --git a/tests/test_attributes/test_temp.rs b/tests/test_attributes/test_temp.rs
index ff7d667..ac913ab 100644
--- a/tests/test_attributes/test_temp.rs
+++ b/tests/test_attributes/test_temp.rs
@@ -54,7 +54,7 @@ fn test_temp_enum_field() {
             #[deku(count = "field_a")]
             field_b: Vec<u8>,
         },
-    };
+    }
 
     let test_data: Vec<u8> = [0xAB, 0x01, 0x02].to_vec();
Repository: sharksforarms/deku
Pull request #366 (2023-10-07 14:16:16)

Fix hygiene in gen_internal_field_ident
- Change generated ident prefix to `__deku___` (three underscores) so that emitted field reads are immediately obvious in expanded code, although I think two underscores would be valid as well.
- Also add a field to `test_named_struct`.


Patch:
diff --git a/deku-derive/src/macros/mod.rs b/deku-derive/src/macros/mod.rs
index eaae7a8..a039cab 100644
--- a/deku-derive/src/macros/mod.rs
+++ b/deku-derive/src/macros/mod.rs
@@ -117,7 +117,7 @@ fn gen_internal_field_ident(ident: &TokenStream) -> TokenStream {
     // Concat token: https://github.com/rust-lang/rust/issues/29599
     let span = ident.span();
     let s = ident.to_string();
-    let mut name = "__deku_".to_owned();
+    let mut name = "__deku___".to_owned();
     // If its a raw identifier, we must remove 'r#'
     name.push_str(s.strip_prefix("r#").unwrap_or(&s));
 


Test patch:
diff --git a/tests/test_struct.rs b/tests/test_struct.rs
index c620af5..b239ca4 100644
--- a/tests/test_struct.rs
+++ b/tests/test_struct.rs
@@ -113,6 +113,7 @@ fn test_named_struct() {
         pub vec_len: u8,
         #[deku(count = "vec_len")]
         pub vec_data: Vec<u8>,
+        pub rest: u8,
     }
 
     let test_data: Vec<u8> = [
@@ -128,6 +129,7 @@ fn test_named_struct() {
         0x02,
         0xBE,
         0xEF,
+        0xFF,
     ]
     .to_vec();
 
@@ -148,7 +150,8 @@ fn test_named_struct() {
                 }
             },
             vec_len: 0x02,
-            vec_data: vec![0xBE, 0xEF]
+            vec_data: vec![0xBE, 0xEF],
+            rest: 0xFF
         },
         ret_read
     );