mirror of
https://github.com/AGWA/git-crypt.git
synced 2025-12-26 20:53:08 -08:00
Fix 'git-crypt init' for newer versions of Git
At some point between Git 1.7.1 and Git 1.8.1.3, both 'git reset' and 'git status' stopped noticing that files were modified after their smudge filter changed. Consequentially, 'git reset --hard HEAD' would not decrypt existing encrypted files in the repo. This commit changes 'git-crypt init' to use 'git checkout -f HEAD /top/of/repo' instead, which does the job.
This commit is contained in:
4
util.cpp
4
util.cpp
@@ -40,7 +40,7 @@
|
||||
#include <errno.h>
|
||||
#include <fstream>
|
||||
|
||||
int exec_command (const char* command, std::string& output)
|
||||
int exec_command (const char* command, std::ostream& output)
|
||||
{
|
||||
int pipefd[2];
|
||||
if (pipe(pipefd) == -1) {
|
||||
@@ -65,7 +65,7 @@ int exec_command (const char* command, std::string& output)
|
||||
char buffer[1024];
|
||||
ssize_t bytes_read;
|
||||
while ((bytes_read = read(pipefd[0], buffer, sizeof(buffer))) > 0) {
|
||||
output.append(buffer, bytes_read);
|
||||
output.write(buffer, bytes_read);
|
||||
}
|
||||
close(pipefd[0]);
|
||||
int status = 0;
|
||||
|
||||
Reference in New Issue
Block a user