merge-recursive: Defer rename/rename(2to1) handling until process_entry
[gitweb.git] / test-line-buffer.c
index 19bf2d4403d03498b5c246367e59265535d2f90c..7ec9b13c9b2ceb84fb6dd0dd229e9f6cb8c1a635 100644 (file)
@@ -32,12 +32,6 @@ static void handle_command(const char *command, const char *arg, struct line_buf
                        buffer_copy_bytes(buf, strtouint32(arg));
                        return;
                }
-       case 'r':
-               if (!prefixcmp(command, "read ")) {
-                       const char *s = buffer_read_string(buf, strtouint32(arg));
-                       fputs(s, stdout);
-                       return;
-               }
        case 's':
                if (!prefixcmp(command, "skip ")) {
                        buffer_skip_bytes(buf, strtouint32(arg));
@@ -69,13 +63,18 @@ int main(int argc, char *argv[])
        else if (argc == 2)
                filename = argv[1];
        else
-               usage("test-line-buffer [file] < script");
+               usage("test-line-buffer [file | &fd] < script");
 
        if (buffer_init(&stdin_buf, NULL))
                die_errno("open error");
        if (filename) {
-               if (buffer_init(&file_buf, filename))
-                       die_errno("error opening %s", filename);
+               if (*filename == '&') {
+                       if (buffer_fdinit(&file_buf, strtouint32(filename + 1)))
+                               die_errno("error opening fd %s", filename + 1);
+               } else {
+                       if (buffer_init(&file_buf, filename))
+                               die_errno("error opening %s", filename);
+               }
                input = &file_buf;
        }