pike.git / lib / modules / Git.pmod / Export.pike

version» Context lines:

pike.git/lib/modules/Git.pmod/Export.pike:376:   //! Convenience funtion for exporting a filesystem file   //! or directory (recursively) to git.   //!   //! @param file_name   //! Name of the file on disc.   //!   //! @param git_name   //! Name of the file in git. Defaults to @[file_name].   void export(string file_name, string|void git_name)   { -  int mode = file_stat(file_name)->mode; +  Stdio.Stat st = file_stat(file_name); +  if (!st) return; +  int mode = st->mode;    if (mode & Git.MODE_DIR) {    mode = Git.MODE_DIR;    } else if (mode & 0111) {    mode = Git.MODE_EXE;    } else if (mode & 0666) {    mode = Git.MODE_FILE;    } else {    error("Unsupported filesystem mode for %O: %03o\n", file_name, mode);    }    if (mode == Git.MODE_DIR) {    foreach(get_dir(file_name), string fn) {    export(combine_path(file_name, fn),    combine_path(git_name || file_name, fn));    }    } else {    filemodify(mode, git_name);    data(Stdio.read_bytes(file_name));    }   }   Newline at end of file added.