mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
Corrected rewrting history, but still disabled.
This commit is contained in:
parent
ca3f272040
commit
0aed37f007
1 changed files with 24 additions and 4 deletions
|
|
@ -348,6 +348,7 @@ bool amend_commit()
|
||||||
|
|
||||||
fprintf(cmd_pipe, "[%d] %s", rev, head_message);
|
fprintf(cmd_pipe, "[%d] %s", rev, head_message);
|
||||||
pclose(cmd_pipe);
|
pclose(cmd_pipe);
|
||||||
|
if(putenv(old_index_cmd) != 0) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -679,11 +680,30 @@ bool change_sql_history()
|
||||||
|
|
||||||
for(std::list<std::string>::reverse_iterator next = hashes.rbegin(), itr = next++; next != hashes.rend(); ++itr, ++next)
|
for(std::list<std::string>::reverse_iterator next = hashes.rbegin(), itr = next++; next != hashes.rend(); ++itr, ++next)
|
||||||
{
|
{
|
||||||
snprintf(cmd, MAX_CMD, "git cherry-pick %s", itr->c_str());
|
// stage the changes from the orignal commit
|
||||||
|
snprintf(cmd, MAX_CMD, "git cherry-pick -n %s", itr->c_str());
|
||||||
system(cmd);
|
system(cmd);
|
||||||
snprintf(cmd, MAX_CMD, "git checkout %s %s%s", origin_hash, path_prefix, sql_update_dir);
|
|
||||||
|
// remove changed and deleted files
|
||||||
|
snprintf(cmd, MAX_CMD, "git checkout HEAD %s%s", path_prefix, sql_update_dir);
|
||||||
system(cmd);
|
system(cmd);
|
||||||
snprintf(cmd, MAX_CMD, "git commit --amend -C HEAD %s%s", path_prefix, sql_update_dir);
|
|
||||||
|
// remove the newly added files
|
||||||
|
snprintf(cmd, MAX_CMD, "git diff --cached --diff-filter=A --name-only %s%s", path_prefix, sql_update_dir);
|
||||||
|
if( (cmd_pipe = popen( cmd, "r" )) == NULL )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
while(fgets(buffer, MAX_BUF, cmd_pipe))
|
||||||
|
{
|
||||||
|
buffer[strnlen(buffer, MAX_BUF) - 1] = '\0';
|
||||||
|
snprintf(cmd, MAX_CMD, "git rm -f %s%s", path_prefix, buffer);
|
||||||
|
system(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
pclose(cmd_pipe);
|
||||||
|
|
||||||
|
// make a commit with the same author and message as the original one
|
||||||
|
snprintf(cmd, MAX_CMD, "git commit -C %s", itr->c_str());
|
||||||
system(cmd);
|
system(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue