DiffOptions::DiffOptions() { git_diff_init_options(&diffopts_, GIT_DIFF_OPTIONS_VERSION); git_diff_find_init_options(&findopts_, GIT_DIFF_FIND_OPTIONS_VERSION); }
static int luagi_diff_find_init_options( lua_State *L, int index, git_diff_find_options *opts ) { int ret = git_diff_find_init_options( opts, GIT_DIFF_FIND_OPTIONS_VERSION ); add_flag( opts->flags, L, index, BY_CONFIG, GIT_DIFF_FIND_BY_CONFIG ); add_flag( opts->flags, L, index, RENAMES, GIT_DIFF_FIND_RENAMES ); add_flag( opts->flags, L, index, RENAMES_FROM_REWRITES, GIT_DIFF_FIND_RENAMES_FROM_REWRITES ); add_flag( opts->flags, L, index, COPIES, GIT_DIFF_FIND_COPIES ); add_flag( opts->flags, L, index, COPIES_FROM_UNMODIFIED, GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED ); add_flag( opts->flags, L, index, REWRITES, GIT_DIFF_FIND_REWRITES ); add_flag( opts->flags, L, index, BREAK_REWRITES, GIT_DIFF_BREAK_REWRITES ); add_flag( opts->flags, L, index, FOR_UNTRACKED, GIT_DIFF_FIND_FOR_UNTRACKED ); add_flag( opts->flags, L, index, ALL, GIT_DIFF_FIND_ALL ); add_flag( opts->flags, L, index, IGNORE_WHITESPACE, GIT_DIFF_FIND_IGNORE_WHITESPACE ); add_flag( opts->flags, L, index, DONT_IGNORE_WHITESPACE, GIT_DIFF_FIND_DONT_IGNORE_WHITESPACE ); add_flag( opts->flags, L, index, EXACT_MATCH_ONLY, GIT_DIFF_FIND_EXACT_MATCH_ONLY ); add_flag( opts->flags, L, index, REWRITES_FOR_RENAMES_ONLY, GIT_DIFF_BREAK_REWRITES_FOR_RENAMES_ONLY ); add_flag( opts->flags, L, index, REMOVE_UNMODIFIED, GIT_DIFF_FIND_REMOVE_UNMODIFIED ); lua_getfield( L, index, RENAME_THRESHOLD ); int rthresh = luaL_optinteger( L, -1, -1 ); if( rthresh >= 0 ) { opts->rename_threshold = rthresh; } lua_getfield( L, index, RENAME_FROM_REWRITE_THRESHOLD ); int rwthresh = luaL_optinteger( L, -1, -1 ); if( rwthresh >= 0 ) { opts->rename_from_rewrite_threshold = rwthresh; } lua_getfield( L, index, COPY_THRESHOLD ); int copy = luaL_optinteger( L, -1, -1 ); if( copy >= 0 ) { opts->copy_threshold = copy; } lua_getfield( L, index, BREAK_REWRITE_THRESHOLD ); int brthresh = luaL_optinteger( L, -1, -1 ); if( brthresh >= 0 ) { opts->break_rewrite_threshold = brthresh; } lua_getfield( L, index, RENAME_LIMIT ); int rename_limit = luaL_optinteger( L, -1, -1 ); if( rename_limit >= 0 ) { opts->rename_limit = rename_limit; } //TODO similarity mertic return ret; }